# API tokens and permissions

Create a personal API token with the projects, permissions and lifetime your integration needs.

## Create and manage a token

1. In Hecaton, go to **Settings → API tokens → Create a token**. Give the token a name that identifies the integration.
2. Select a preset or choose each permission with **Custom**. Select all your projects or a list of projects. Choose 30, 90 (default) or 365 days, or **No expiration**.
3. Copy the value starting with `hec_` when shown. Save it in your CI secret store as `HECATON_TOKEN`, or send it in the API's `Authorization: Bearer <token>` header.

The token acts in your organization on your behalf. Workspace activity counts toward your quota. The token can only use projects that its selection and your current access both allow. Permissions and project selections are fixed after creation. Create a different token to change them.

Use **Renew** to get a new value with the same permissions, projects and duration. The previous value stops working immediately. **Revoke** also cuts off access immediately. Organization administrators can list and revoke members’ tokens from **Member tokens**. They never see the token values.

## Presets

| Preset | Permissions                                                                                                                         |
| ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| Read   | Read projects, workspaces, conversations, results, agent questions, scheduled jobs and sent webhooks.                               |
| CI     | Adds workspace creation and messages, answers to agent questions, sleep and wake, and archive for workspaces created by this token. |
| Full   | Adds archive for all the member’s workspaces in scope, and management of scheduled jobs and sent webhooks.                          |
| Custom | Starts from the preceding preset and lets you choose each permission below.                                                         |

## Custom permissions

| Resource        | Levels                                    |
| --------------- | ----------------------------------------- |
| Projects        | None, read                                |
| Workspaces      | None, read, create and write              |
| Agent questions | None, read, answer                        |
| Sleep and wake  | No, yes                                   |
| Archive         | None, created by this token, all in scope |
| Scheduled jobs  | None, read, manage                        |
| Sent webhooks   | None, read, manage                        |

Workspace permissions imply project read access. Select at least one permission. These tokens cover the public operations listed in the [REST API reference](api.md). Credentials, secrets and configuration are managed in Hecaton.

## Resolve authentication errors

- 401 `token_missing`, `token_invalid`, `token_expired` or `token_revoked` — check which credential your integration is sending.
- 403 `scope_denied` — check the permission the operation requires and whether the requested project is in scope. Operations on resources outside your visible projects can also return 404.

For a workstation, see [browser sign-in and connected tools](local-agent.md).
