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

# Authentication

> Create an API key and authenticate your requests

Every request to the TrueFan API is authenticated with an API key, scoped to a single workspace.

## Creating a key

API keys are created, listed, and revoked from the TrueFan dashboard's [API Keys page](https://app.truefan.ai/dashboard/api-keys) — any active member of a workspace can manage keys there, not just owners/admins, the same way any member can already trigger a generation that spends the workspace's shared credits.

<Warning>
  The raw key is shown **exactly once**, right after you create it. It is never stored in a retrievable form and can never be shown again — if it's lost, revoke it and create a new one from the dashboard.
</Warning>

## Using a key

Every other endpoint in this API — templates, generation, status, webhooks — lives on the editor host and is authenticated with the raw key as a bearer token:

```bash theme={null}
curl "https://dev-backend-ai.truefans.in/api/external/v1/templates/" \
  -H "Authorization: Bearer tf_live_a1b2c3d4e5f6..."
```

<ParamField header="Authorization" type="string" required>
  `Bearer {api_key}` — every request without a valid, active key returns `401 Unauthorized`.
</ParamField>

## Revoking a key

Revoke a key from the same [API Keys page](https://app.truefan.ai/dashboard/api-keys) in the dashboard. A revoked key stops authenticating immediately. There's no way to un-revoke a key — create a new one instead.

## What a key can see

An API key inherits the workspace it belongs to:

* **Templates** — only templates that exist in that workspace.
* **Generations & bulk jobs** — only ones created by that workspace (whether from the API or the dashboard).
* **Billing** — usage is charged to the workspace's account, and attributed back to the specific key that spent it, so you can see which integration is driving cost.

Every active key in a workspace can read every template in it — there is currently no way to restrict a key to a subset of templates.
