> ## Documentation Index
> Fetch the complete documentation index at: https://developers.onio.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Personal access tokens, scopes and revocation.

The API uses personal access tokens. A token acts for the account that created it. It can only reach that account’s data, and only as far as its scopes allow.

## Send the token

Send the token in the `Authorization` header of each request:

```bash theme={null}
curl https://web.onio.app/api/v1/wishlists \
  -H "Authorization: Bearer onio_pat_your_token"
```

Tokens start with `onio_pat_`. The API does not accept session cookies or tokens in the query string.

## Create a token

1. Sign in to [Onio](https://web.onio.app) and open your profile.
2. In **API Access**, select **Create Token**.
3. Enter a name, select the permissions the tool needs and select **Create Token**.
4. Copy the token. Onio shows it only once. If you lose it, revoke it and create a new one.

You can have up to 10 tokens. Tokens do not expire. A token stays valid until you revoke it.

## Scopes

A scope sets what a token can do. You choose the scopes when you create the token. You cannot change them later. Create a new token instead.

| Scope | Permission in the profile | Grants |
| - | - | - |
| `wishlists:read` | Read wishlists and wishes | Read the wishlists you own and their wishes, including private ones. |
| `wishlists:write` | Create and edit wishlists | Create wishlists and change their title, occasion and notes. |
| `wishlists:delete` | Delete wishlists | Delete wishlists. Their wishes are deleted with them. |
| `wishlists:share` | Share wishlists | Share wishlists and get their share link, or set them back to private. |
| `wishes:write` | Add and edit wishes | Add wishes to your wishlists and change them. |
| `wishes:delete` | Delete wishes | Delete wishes. A deleted wish cannot be restored. |

Give each tool only the scopes it needs. A write scope does not include `wishlists:read`. A tool that adds wishes and then reads the list needs both.

Tokens created before the write scopes existed have `wishlists:read` only.

No scope gives access to giver data, followers or other people’s lists. Only `wishlists:share` returns a share link, and only when it shares the list.

## Revoke a token

Open your profile, find the token in **API Access** and select **Revoke**. Requests with the token fail at once with `401`.

Onio also revokes all your tokens when you reset your password. This protects your account when you recover it. Changing your password while you are signed in keeps your tokens.

The profile shows the day each token was last used. Onio stores only the day, not each request.

## Keep tokens safe

* Use the API from a server, a script or a local tool. The API sends no CORS headers, so a browser on another website cannot call it.
* Store tokens in environment variables or a secret manager. Never commit them.
* Use one token per tool. Then you can revoke one tool without breaking the others.

## Errors

| Status | Meaning |
| - | - |
| `401` | The token is missing, unknown or revoked. |
| `403` | The token does not have the scope that the endpoint needs. |

A `401` response includes the header `WWW-Authenticate: Bearer`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.