# Authenticate with an API key

Preview: opening soon. These rules describe the planned key gate; the [reference](/docs/api) shows open routes.

Send one key in one header: `Authorization: Bearer og_live_YOUR_KEY`. Never put the key in a URL, query string, JSON body, or second header. A misplaced or repeated key gets 400 `key_misplaced`. A URL can be logged before Outdoor Grid receives it.

Call from a trusted server, command line, or server automation. Never embed the key in browser JavaScript, a public repository, or a spreadsheet shared with guests. Requests with an `Origin` header get 403 `key_from_browser`; this is a leak safeguard, not a way to secure a browser app.

Each key belongs to one person in one shop. The person's current access, the selected areas, the shop's API switch, and the key's state are checked on use. A revoked, unknown, malformed, or expired key gets 401 `invalid_key`. An optional IP allowlist accepts only its saved network ranges; calls from elsewhere get 403 `ip_not_allowed`.

Expiry choices are 7, 30, 90, or 365 days, or Never when the shop permits it. The default is 90 days. For planned rotation, use **Replace this key** in Settings, Developers, API keys. Update the server's secret first; the old key has a 24 hour grace period, then stops working. If a key leaks, revoke it immediately instead of waiting for the grace period.
