---
title: "getQueryParams"
description: "Read every value of a repeated query parameter from a URL by key, returning an array so multi-value filters and tags are easy to handle."
canonical_url: "https://core.mhaibaraai.cn/en/docs/utilities/url/get-query-params"
---
# getQueryParams

> Read every value of a repeated query parameter from a URL by key, returning an array so multi-value filters and tags are easy to handle.

## Usage

`getQueryParams` retrieves all values of a repeated query parameter from a URL.

```ts
import { getQueryParams } from '@movk/core'

getQueryParams('https://example.com?tags=a&tags=b&tags=c', 'tags')
// ['a', 'b', 'c']

getQueryParams('https://example.com?name=John', 'name')
// ['John']

getQueryParams('https://example.com', 'name')
// []
```

## API

### `getQueryParams(url, key)`

Get all values of a specific query parameter from a URL.

### Parameters

**url** (`string`) *required*: The URL string.

**key** (`string`) *required*: The parameter key.

### Returns

**returns** (`string[]`): An array of parameter values.

## Changelog

See commit history for [src/utilities/url/query.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/utilities/url/query.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-core/blob/main/src/utilities/url/query.ts)


## Sitemap

See the full [sitemap](https://core.mhaibaraai.cn/sitemap.md) for all pages.
