# Personal access tokens

Source: https://dropshelf.ai/docs/use/tokens

Create a personal access token for a script, CI or an agent, use it with the API and the CLI, and revoke it.

A personal access token lets something that cannot sign in use dropshelf as you. Create one for a
script, a CI job, or an agent that cannot sign in with OAuth. Claude Code and Codex can sign in with
your account on most instances, and need no token.

## Prerequisites [#prerequisites]

- You are signed in to the dashboard at `drop.example.com`. Tokens are managed only from a signed-in
  session.

## Create a token [#create-a-token]

To create a token:

1. Open the account menu at the foot of the sidebar and select **Connections**. Where the page has
   tabs, select **Apps and tokens**.
2. Under **Tokens**, select **Create token**.
3. In **Name**, say what will use the token, such as `ci` or `laptop`. Names need not be unique, but a
   clear one helps you tell tokens apart later.
4. Under **Expires in**, choose how long the token lives.
5. Select **Create token**.

The new token appears once, starting with `odp_`. Select **Copy token** and store it where the
script runs, such as a CI secret. Then select **Done**.

<Callout type="warn">
dropshelf stores only a hash of the token, so nobody can show it to you again. If you lose it, revoke
it and create another.
</Callout>

## Know when it expires [#know-when-it-expires]

Every token expires. Your instance sets the longest lifetime and the default, so **Expires in**
offers only lifetimes your instance allows. Out of the box, a token lives 90 days unless you choose
otherwise, and at most 365 days. The [configuration reference](/docs/reference/configuration#tokens)
lists both settings, which your admin controls.

The panel with the new token shows the date it expires. A request through the API for a longer
lifetime is shortened to the longest one, not refused, so trust that date.

## Use a token [#use-a-token]

Send the token in the `Authorization` header of each request to the dashboard's address. This
request asks who the token belongs to:

```bash
curl -H "Authorization: Bearer $DROPSHELF_TOKEN" https://drop.example.com/api/v1/me
```

The same header opens a drop at its own address, such as `https://<name>.drop.example.com`, for a
drop you may open.

The `dropshelf` CLI reads a token from `DROPSHELF_TOKEN` and stores nothing. It sends the token only
to the instance in `DROPSHELF_URL` or `--instance`, so set both:

```bash
export DROPSHELF_URL=https://drop.example.com
export DROPSHELF_TOKEN=<token>
dropshelf whoami
```

The output names you and the instance, and shows your member id:

```text
Mia Hansen <mia@example.com> on https://drop.example.com
Member id: 01JDZ8K3V7Q2M4N6P8R0S2T4W6
```

[Publish from CI](/docs/agents/ci) shows a whole pipeline. An agent that cannot sign in with OAuth
sends the token to `/mcp` on the dashboard's address, as [Connect an agent](/docs/agents/connect)
describes.

## What a token can do [#what-a-token-can-do]

A token acts as you, with your access. It can publish, change and delete your drops, read the drops
you may see, comment, and open drops at their own addresses.

A token cannot create or revoke tokens. Only a signed-in session can, so a leaked token cannot make a
longer-lived copy of itself. A token also stops working when an admin disables
your account.

## Revoke a token [#revoke-a-token]

To revoke a token:

1. On the **Connections** page, under **Tokens**, find the token by its name and the first
   characters after `odp_`. The **Last used** column helps you spot one that nothing uses.
2. Select **Revoke** on its row.
3. Confirm with the button that names the token.

Anything that uses the token stops working at once, and a revoke cannot be undone.

Agents you signed in with OAuth are listed under **Signed-in apps** on the same page. Select **Sign
out** on one to end its sign-in.

## Confirm it worked [#confirm-it-worked]

The new token's row shows **Never used** until something uses it. Run `dropshelf whoami` or the
`curl` request above, then reload the **Connections** page. Its **Last used** column shows when the
token was last used, updated at most once a minute.

## Next steps [#next-steps]

- [Publish from CI](/docs/agents/ci)
- [Use the CLI](/docs/agents/cli)
- [Connect an agent](/docs/agents/connect)
- [REST API](/docs/reference/rest)
