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

# Authentication

> Create and use a Fanify Hub API key.

Except for key management, which is restricted to the console session, authenticated routes accept an API key in the HTTP `Authorization` header.

```http theme={null}
Authorization: Bearer fanify_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

<Warning>
  A new key is displayed only once. Store it in a secret manager and never send it in a URL or request body.
</Warning>

## Check the key and balance

```bash theme={null}
curl https://fanifyai.com/api/v1/me \
  -H "Authorization: Bearer $FANIFY_API_KEY"
```

```json theme={null}
{
  "client_id": 42,
  "email": "client@example.com",
  "membership": true,
  "balance": 4.952100,
  "available": 4.912100,
  "currency": "EUR",
  "key": {
    "name": "Instance ABCD-EFGH-IJKL-MNOP-QRST",
    "prefix": "fanify_sk_a1B2c3D4"
  }
}
```

`available` subtracts estimates for every generation that has not been settled yet. Use it to determine whether a new generation can be accepted.

## Manage keys

The Fanify console lets you create, list, and revoke keys. The `/api/v1/hub/keys` routes require the console session cookie and the `X-Requested-With: XMLHttpRequest` header. They reject Bearer authentication.

A revoked key returns `401 unauthorized`. See the [error reference](/en/hub/errors).


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