---
title: "appendQueryParam"
description: "Append a query parameter to a URL without replacing existing values of the same name, returning a new URL string with the value added."
canonical_url: "https://core.mhaibaraai.cn/en/docs/utilities/url/append-query-param"
---
# appendQueryParam

> Append a query parameter to a URL without replacing existing values of the same name, returning a new URL string with the value added.

## Usage

`appendQueryParam` appends a query parameter to a URL without overwriting existing values of the same key.

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

appendQueryParam('https://example.com?tag=a', 'tag', 'b')
// 'https://example.com?tag=a&tag=b'
```

## API

### `appendQueryParam(url, key, value)`

Append a query parameter without replacing existing values of the same name.

### Parameters

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

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

**value** (`QueryParamValue`) *required*: The parameter value.

### Returns

**returns** (`string`): A new URL string with the parameter appended.

## 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.
