# isPublishableKey()

> A publishable key is the only key allowed in a browser.

Source: https://docs.tryyoursize.com/reference/web/is-publishable-key/

*Function* · `@tryyoursize/sdk`

A publishable key is the only key allowed in a browser.

```ts
function isPublishableKey(key: string): boolean
```

## Parameters

- **`key`** (`string`, required): Any string.

## Returns

`boolean`: True for `pk_test_…` and `pk_live_…` keys.

## Example

**JavaScript**

```js
if (!isPublishableKey(settings.tysKey)) throw new Error("Use the publishable key");
```
