
# Authentication

Every call carries an API key as a bearer token:

```http
Authorization: Bearer fincalc_live_3kQ9...
```

There is no other way to send it: not a query parameter, not a cookie. Keys are for your servers.
The API sends no CORS headers, so a browser can't call it, and a key in a web page or an app is a key
anyone can copy.

## Keys

- **Made by your institution.** Its Administrators make keys in the FinCalc console, under **API
  keys**. FinCalc staff can't make one, or see yours.
- **Shown once.** We keep only a hash. If you lose a key, make a new one and revoke the old.
- **Test or live.** A test key (`fincalc_test_`) runs every published calculator, limited to 10 calls a
  minute, and is never counted or billed. A live key (`fincalc_live_`) runs what your institution
  licenses for the API.
- **Two at a time.** Each integration can hold two usable keys of each kind, so you can rotate with no
  gap: make the new key, deploy it, then revoke the old one.
- **Expiry.** A key can be set to expire after 30, 90 or 365 days, or never.
- **Networks.** An integration can be limited to your servers' networks; a call from anywhere else is
  refused with [`network-not-allowed`](/problems/network-not-allowed).

## When a key doesn't work

Every reason a key can't be used (missing, malformed, unknown, revoked, expired, or its integration
suspended) answers the same [`unauthorized`](/problems/unauthorized), so the answer tells someone
holding a guessed key nothing. Your Administrators can see each key's state, and when it was last
used, on the API keys page.

Too many refused keys from one address in a minute and that address is refused for a minute:
[`too-many-failed-keys`](/problems/too-many-failed-keys). A key that has been working keeps working
from it.
