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

# API keys

> Create, expire and revoke API keys.

Every API request needs a key. You manage them on the **Keys** page; what they spend comes off your credit.

## Create a key

**1. Open Keys**

Sign in at [platform.trustqai.com](https://platform.trustqai.com) and open **Keys**.

**2. Name it and choose an expiry**

Give the key a name that says where it is used, such as the application or environment. Choose when it expires: **Never expires**, 7, 30, 90 or 365 days, or a custom date.

**3. Copy the key**

The full key is shown once, when you create it. Copy it into your application's secret store. Afterwards the dashboard shows only its first and last characters.

Keys start with `sk-qai-`. Send the key in the `Authorization` header of every request:

```bash theme={null}
curl https://api.trustqai.com/v1/models \
  -H "Authorization: Bearer $QAI_API_KEY"
```

> [!NOTE]
>
> A new key can take up to a minute before the API accepts it. Requests sent sooner return `401`.

## Expiry

A key's expiry is set when you create it and cannot be changed afterwards. A custom expiry must be at least five minutes in the future. Once a key expires, the API rejects it with `401` and the dashboard marks it **Expired**. To keep an application running, create its replacement before the old key expires.

## Revoke a key

Revoke a key from its details on the **Keys** page when it is no longer needed or may have been exposed. Revoking is permanent: the key never works again, so create a new key for anything that still needs access. The API stops accepting a revoked key within a minute.

## Keep keys safe

* Store keys in environment variables or a secret manager, never in source code or client-side apps.
* Use a separate key per application or environment, so you can revoke one without affecting the others.
* Revoke a key straight away if it appears somewhere it should not, such as a public repository or a chat message.


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