# Authentication

For AI agents: this is the Markdown version of https://docs.fashiolabs.com/authentication.html. The index of all Fashio API docs is at https://docs.fashiolabs.com/llms.txt, and the complete reference in one file is at https://docs.fashiolabs.com/llms-full.txt.

Every request carries one bearer API key. The key resolves to your Fashio account — generations bill against the same diamond balance as the app.

## Get a key

Create keys yourself from the dashboard — no waitlist, no approval step:

1. Sign in at [dash.fashiolabs.com](https://dash.fashiolabs.com/)
2. Open **Profile → API Keys**
3. Name the key and create it — the full key is shown **once**. Copy it immediately.

> Only a sha256 hash of the secret is ever stored server-side. If you lose the key, revoke it and mint a new one — it cannot be recovered or re-displayed. You can keep up to 5 active keys per account.

## Key format

A key looks like:

```text
fio_live_6f2a9e1c8b3d4f0a1c2b3d4e.9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b
```

`fio_live_<keyId>.<secret>` — send the whole string as a bearer token:

**cURL**

```bash
curl https://api.fashiolabs.com/v1/models \
  -H "Authorization: Bearer fio_live_6f2a9e1c8b3d4f0a.9a8b7c6d5e4f3a2b"
```

**Node.js**

```javascript
const res = await fetch("https://api.fashiolabs.com/v1/models", {
  headers: { Authorization: "Bearer " + process.env.FASHIO_API_KEY },
});
const data = await res.json();
```

**Python**

```python
import os, requests

res = requests.get(
    "https://api.fashiolabs.com/v1/models",
    headers={"Authorization": f"Bearer {os.environ['FASHIO_API_KEY']}"},
)
data = res.json()
```

## Auth error responses

| Status | Body | Cause |
| --- | --- | --- |
| 401 | `Missing or malformed API key.` | No `Authorization` header, or it doesn't start with `fio_live_`. |
| 401 | `Invalid API key.` | The key doesn't exist, or the secret doesn't match. |
| 401 | `This API key has been revoked.` | Revoked from the dashboard — mint a new one. |

> Never call the API directly from client-side/browser code — the key would be visible to anyone viewing your page source. Keep it server-side only.

---

Source: https://docs.fashiolabs.com/authentication.html · OpenAPI spec: https://docs.fashiolabs.com/openapi.yaml · Docs index: https://docs.fashiolabs.com/llms.txt
