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

# Authentication

> Exchange your credentials for a token.

Every authenticated call carries **two** credentials: your API key, and a bearer token you fetch first.

This page gets you authenticated and nothing more — the two calls, the shape they return, and the two ways they fail. The endpoint itself, with every field and a live "Try it", is [Get access token](/api-reference/authentication/get-access-token).

## Get a token

Only the API key is needed for this call. The client id and password go in the body.

```bash theme={null}
curl -X POST "$KIRA_BASE/auth" \
  -H "x-api-key: $KIRA_API_KEY" \
  -H 'X-Api-Version: 2026-06-01' \
  -H 'Content-Type: application/json' \
  -d '{
    "client_id": "'"$KIRA_CLIENT_ID"'",
    "password": "'"$KIRA_CLIENT_PASSWORD"'"
  }'
```

The token comes back **nested under `data`**:

```json theme={null}
{
  "message": "Auth token",
  "data": {
    "access_token": "eyJ…",
    "token_type": "Bearer",
    "expires_in": 3600
  }
}
```

<Warning>
  Read the lifetime from `data.expires_in` rather than assuming it. It is set per account, so a number you hard-code from one environment can be wrong in another.
</Warning>

## When it fails

| You get | It means                                                                                     |
| ------- | -------------------------------------------------------------------------------------------- |
| `401`   | A credential is missing or wrong, or the token has expired. Fetch a new one.                 |
| `403`   | The request was turned away before reaching the API — most often a missing or wrong API key. |

Both come back with a message that talks about routing whichever the cause, so read the status code rather than the text. Check the headers first.

<Card title="Your first call" icon="arrow-right" href="/get-started/your-first-call">
  Create something and read it back.
</Card>
