---
url: https://docs.ridgedata.ai/reference/embed-api/Function.embedStateToParams.md
---
# Function: embedStateToParams()

```ts
function embedStateToParams(state: StateValues): URLSearchParams;
```

Encode dashboard state as JSON and UTF-8 base64 in a `state` query parameter.
Use the returned `URLSearchParams` to construct a URL with initial dashboard state.
This function only encodes state; it does not create or sign an embed credential.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `state` | [`StateValues`](TypeAlias.StateValues.md) | Initial values keyed by component id and state key. |

## Returns

`URLSearchParams`

Parameters containing the encoded state. Invalid state logs a warning and returns
an empty `URLSearchParams` object.

## Example

```ts
const params = embedStateToParams({ "region-menu": { filter: "EMEA" } });
const queryString = params.toString();
```
