# Authentication

## Bearer authentication

Create and manage keys in [your account](/me?section=api-keys). Send this header on task creation, result queries and account requests.

```http
Authorization: Bearer YOUR_API_KEY
```

## Restrict an API key by IP

Set an IP allowlist when creating or editing a key. Enter up to 10 public IPv4 addresses, IPv6 addresses, or CIDR ranges, one per line. Leave it blank to allow all sources. A request outside the allowlist, or a request whose source IP cannot be verified, returns HTTP `403`. The rule applies to Playground and MCP requests that use that API key.

## Read your balance

```bash
curl "https://api.i2v.ai/api/v1/account" \
  -H "Authorization: Bearer $I2V_API_KEY"
```

The response contains `userId`, `email`, `name`, `balance`, `reserved`, `funding` and `createdAt`. `balance` and `reserved` are USD money objects with eight-decimal `amount` strings. `funding` provides available and reserved amounts by funding type. The timestamp is in Unix milliseconds. The account response is private and uses `Cache-Control: no-store`.

## Handle authentication errors

HTTP `401` indicates that the key is missing, invalid, expired or revoked. Update the key before retrying. Task queries only expose tasks owned by the authenticated account.

Keep API keys in server-side environment variables. Revoke a compromised key through your account. MCP client authorization is described in [MCP integration](/docs/mcp).