---
title: "Authentication · Function API"
description: "API keys: the bearer header, and each key's permissions, expiry, IP allowlist and spending limit."
canonical: https://functionvoice.ai/docs/api/authentication
---

# Authentication

Send your API key as a bearer token on every request:

```http
Authorization: Bearer fn_live_…
```

Create keys in the [dashboard](https://app.functionvoice.ai/keys). A key is shown once, when it is made. We keep only a fingerprint of it, so it can't be shown again. A revoked key stops working at once.

Keep keys on your server. Never ship one in an app or a web page, and never put one in a URL.

## Key rules

Each key can carry its own rules. The API checks them on every request, before any audio is heard.

| Rule | What it does | Refusal |
| --- | --- | --- |
| Permissions | Dictation, Transcription, or both. | `403 forbidden` |
| Expiry | A date after which the key stops working. | `401 expired_api_key` |
| IP allowlist | Addresses or CIDR ranges, IPv4 or IPv6. | `403 ip_not_allowed` |
| Spending limit | Dollars over the key's lifetime, each week (UTC, from Monday) or each month (UTC). | `403 spend_limit` |

A `spend_limit` refusal names the limit in `metadata.limit_source`: `key_lifetime`, `key_week` or `key_month`. [Key info](/docs/api/key) reads a key's spend and what is left of its limit.

## Streams

A WebSocket can't always set headers, as in a browser. There, send the key as two subprotocols instead: `function-api` and `bearer.` followed by the key. See [Streaming](/docs/api/streaming).
