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

# Authentication

> API tokens: making them, using them, revoking them and keeping them secret.

Send an API token in the `Authorization` header for each job. The model catalogue is public, including `GET /v1/models`, `HEAD /v1/models` and `GET /v1/models/{id}`.

```http theme={null}
Authorization: Bearer smai_...
```

A job request with an invalid token gets `401 invalid_api_key`. The message tells you what to fix.

| What you sent | What the message tells you |
| - | - |
| No Authorization header | Send a bearer token from the API tokens section of your account panel. |
| A key without the `smai_` prefix | This looks like another provider's key. Use a ShareMyAI token. |
| An unknown or revoked `smai_` token | Create a new API token in your account panel. |

A valid token for a suspended account gets `403 account_suspended`. All tokens on an account share its four concurrent job slots.

## Make a token

1. Sign in on [sharemy.ai](https://sharemy.ai) and open the account panel (your balance, or **Account**, at the top right).
2. Under **API tokens**, type a name, such as "my server". Names can be up to 40 characters.
3. Press **Create token**.
4. Copy the token. It is shown once and cannot be shown again.

An account can have up to 10 tokens. To make an 11th, revoke one first.

Each token spends the credits of the account that made it. A token also signs in a [headless share worker](https://docs.sharemy.ai/share-your-gpu.md#headless-with-docker), whose earnings go to the same account.

## See and revoke tokens

The **API tokens** list shows each token's first characters, its name, and the day it was last used. Press **Revoke** next to a token to delete it. Calls with a revoked token fail with `401` at once.

## Keep tokens secret

Anyone with a token can spend your credits. ShareMyAI keeps only a hash of each token, so we cannot show it to you again or recover it for you.

* Keep tokens in environment variables or a secrets manager, not in source code.
* Do not put a token in a web page or app that other people download. Call the API from your server instead.
* Give each server or script its own token, so you can revoke one without stopping the others.
* If a token may have leaked, revoke it and make a new one.

## Browsers

CORS allows any origin and echoes the headers requested by a browser during preflight, including those sent by the OpenAI JavaScript SDK. Browser code can read the [API response headers](https://docs.sharemy.ai/api-reference/overview.md#response-headers). Use your own token on your own machine. Keep shared app tokens on your server.


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