---
title: API keys and website access
description: Use one key pair for all widgets and restrict website access.
icon: Shield
---

Each API key pair has two parts:

| Key prefix      | Location    | Function                         |
| --------------- | ----------- | -------------------------------- |
| `coristen_pk_`  | Browser     | Connect a widget to a workspace. |
| `coristen_key_` | Server only | Sign verified customer identity. |

Use the same pair for chat, the contact form, the dock, and the modal.
A public key does not give access to the workspace inbox.
Customer sessions control access to conversation messages.

## Store the server key

Store the server key in a protected server environment variable.
Coristen shows the full server key only when you create the pair.
Do not put this key in browser code or a public environment variable.

## Restrict website access

Open **Settings > Workspace security > Websites**.
Find **Allowed websites**.
These settings apply to all widgets in the workspace.
An empty list permits all websites.

Add each hostname that you use. Include the port when necessary.
Do not include a URL path.

```text
example.com
preview.example.com
localhost:3000
```

## Replace a key pair

1. Create a new API key pair.
2. Replace the public key in all widgets that use the old pair.
3. Replace the server key in each identity service that uses the old pair.
4. Test each widget.
5. Revoke the old key pair.

Key rotation does not create a new workspace.
For signed-in customers, keep the same account ID in the identity route.
