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

# Create and manage API keys

> Choose inference or account keys, send Bearer authentication, manage access and IP restrictions, and troubleshoot rejected API requests.

AntiRouter authenticates server-side requests with API keys. Use an **Inference key** for video generation, task queries, and model discovery. Pass it in the `Authorization` header on every request.

## Choose a key type

| Type | Purpose | Endpoints |
| - | - | - |
| `inference` | Model inference and related queries | Video generation, task queries, `/v1/models` |
| `account` | Read-only account access | `/user/billing/balance`, `/user/billing/usage` |

These types are not interchangeable. An account key cannot generate videos or query video tasks.

## Create and use a key

Open [API Keys](https://anti.rs/app/api-keys), choose the key type, select **Create key**, and enter a name. Create separate keys for each application or environment, such as `production-video`. Copy the key after creation; you can also reveal and copy it again from the list.

```bash theme={null}
curl https://anti.rs/v1/models \
  --header "Authorization: Bearer $ANTI_API_KEY"
```

The header format is `Authorization: Bearer sk-...`. `ANTI_API_KEY` is the environment variable used in these examples; use the variable name that fits your application.

## Control access

* **Disable** a key with its **Enabled** switch to pause access. You can enable it again later.
* **Revoke** a key to permanently deny access with that credential. Create a replacement key if needed.
* **Restrict IPs** in [Security](https://anti.rs/app/security) with individual IP addresses or CIDR ranges. Include your application's public egress IP before enabling the allowlist. The setting applies to API keys across your account.

> [!WARNING]
>
> Keep keys in server-side environment variables or a secrets manager. Do not embed them in browser code, mobile apps, public repositories, or logs. Revoke an exposed key and update your application with a replacement.

## Resolve authentication errors

`401 unauthorized` can mean a missing, invalid, wrong-type, disabled, or revoked key. It can also mean the request IP is outside your allowlist. Check the header and key type first, then the console settings and egress IP. Do not share a complete API key while troubleshooting.


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