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

# Authenticate a user and return a fresh API key.

> **Required scope:** write

**Required scope:** `write`

### Request body

`AuthLoginRequest`

<ParamField body="email" type="string" required />

<ParamField body="password" type="string" required />

### Response

`AuthResponse`

<ResponseField name="api_key" type="string" required />

<ResponseField name="api_key_created_at" type="string" required />

<ResponseField name="api_key_prefix" type="string" required />

<ResponseField name="email" type="string" required />

<ResponseField name="org_id" type="string" required />

<ResponseField name="user_id" type="string" required />

### Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `200` | Login successful                                   |
| `401` | Unauthorized — missing or invalid credentials      |
| `403` | Forbidden — the key/token lacks the required scope |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/api/v1/auth/login' \
    --header 'X-API-Key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "email": "ada.lovelace@example.com",
    "password": "YOUR_API_KEY"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "api_key": "YOUR_API_KEY",
    "api_key_created_at": "2026-08-31T14:22:05Z",
    "api_key_prefix": "YOUR_API_KEY",
    "email": "ada.lovelace@example.com",
    "org_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
  ```
</ResponseExample>
