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

# Authentication

> All API requests require a valid API key passed in the X-API-Key header.

## API keys

Every request to the NextKS API must include an API key in the `X-API-Key` header.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://app.nextks.com/api/notify \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ ... }'
  ```

  ```typescript Node.js theme={null}
  const response = await fetch('https://app.nextks.com/api/notify', {
    method: 'POST',
    headers: {
      'X-API-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ /* ... */ }),
  })
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://app.nextks.com/api/notify",
      headers={"X-API-Key": "YOUR_API_KEY"},
      json={ ... },
  )
  ```
</CodeGroup>

Keys are personal — each key is tied to the user who created it. When you send an interactive notification, your display name appears in the message footer as the sender.

## Creating a key

1. Sign in at [app.nextks.com](https://app.nextks.com)
2. Open the **Account** page from the sidebar
3. Under **Personal API Keys**, click **Generate New Key**
4. Enter a descriptive label (e.g., "CI/CD Pipeline", "Monitoring Alerts")
5. Copy the key from the dialog immediately — it is shown only once

<Warning>
  API keys are SHA-256 hashed before storage. If you lose a key, you must generate a new one.
</Warning>

## Key dashboard

### Your keys (Account page)

Every user can create and revoke their own keys from the **Account** page. The table shows:

| Column     | Description                           |
| ---------- | ------------------------------------- |
| Key prefix | First characters, for identification  |
| Created    | When the key was generated            |
| Last used  | Timestamp of the most recent API call |

### Organization overview (Admin Settings)

Organization admins can see all API keys created by any user in **Admin Settings**. This view includes the key owner's name and email. Admins can search and revoke any key.

## Error responses

| Status | Meaning                                                             |
| ------ | ------------------------------------------------------------------- |
| `401`  | Missing or invalid API key                                          |
| `429`  | Rate limit exceeded — see [Rate Limits](/api-reference/rate-limits) |

```json theme={null}
{
  "status": "error",
  "details": "Invalid API key"
}
```

## Security notes

* Keys are transmitted over HTTPS only
* Each key is SHA-256 hashed before storage — NextKS never stores plaintext keys
* Revoking a key is immediate and cannot be undone
* Rotate keys regularly and revoke any that may have been exposed
