# API keys (/docs/api-keys)

An API key gives your application access to a workspace. Create a key for the integration that needs it, with the permissions required for that work.

## Create a key [#create-a-key]

Open **API Keys** in the portal and select **Create key**. Enter a name that identifies the application or environment, then choose its permissions.

| Portal permission  | API scope                | Allows                                                              |
| ------------------ | ------------------------ | ------------------------------------------------------------------- |
| Create uploads     | `uploads:create`         | Submit documents                                                    |
| Read job status    | `jobs:read`              | Check processing progress and result availability                   |
| Read results       | `results:read`           | Read document content and use Search when the workspace is eligible |
| Classify documents | `classifications:create` | Classify an existing document, together with Read results           |

The SDK's complete creation flow needs Create uploads, Read job status, and Read results because it submits the document, waits for processing, and retrieves the result. Classification requested during upload is included in Create uploads. Classifying an existing document also needs Classify documents. An integration that only reads existing content can use a more limited key.

Select **Create key** and copy the secret. The full key is shown once. The portal retains its name, prefix, permissions, and status so you can identify it later.

## Use the key [#use-the-key]

Store the key in your application's environment as `PAGELET_API_KEY`. The SDK reads it when you create a client:

```js
import { Pagelet } from "@pagelet-ai/sdk"

const client = new Pagelet()
```

You can also supply `apiKey` explicitly. This takes precedence over the environment value. See the [SDK quickstart](/docs/sdk-quickstart) for local setup.

For HTTP requests, send `Authorization: Bearer YOUR_API_KEY` to the product API. Use the key only in your backend or local scripts. Browser applications should call your backend rather than expose a workspace key.

A key's permissions do not enable features that its workspace plan does not include. For example, `results:read` permits the Search operation, but the workspace still needs Search access.

## Replace or revoke a key [#replace-or-revoke-a-key]

To replace a key, create a new one, update your application's secret, and verify that the application can use it. Then revoke the old key from **API Keys**. Revocation prevents further use; it does not undo documents already submitted.

The plan limits how many active keys a workspace can have. If you have reached that limit, review existing keys before revoking one that an application still uses.

A webhook signing secret has a different purpose: it verifies incoming notifications. It cannot authenticate API requests. See [Webhooks](/docs/background-processing#set-up-a-webhook).
