Docs menuAuthentication

Authentication

Every call needs an API key. You create keys in the app, under API keys, and one key works for every API on Fare.

Send your key

Put the key in the X-API-Key header, or send it as Authorization: Bearer followed by the key. Keys start with fare_live_ followed by 32 letters and digits.

Check your keycurl · not billed
curl https://api.fare.dev/v1/account \
  -H "X-API-Key: $FARE_KEY"

# or
curl https://api.fare.dev/v1/account \
  -H "Authorization: Bearer $FARE_KEY"
{"key_id": "key_1a2b3c4d5e6f7a8b", "access": "active", "monthly_cap": 1000000,
 "per_second": 10, "used_this_month": 42}

GET /v1/account tells you whether the key can make calls, its limits and its calls this month. It's never billed.

Keys and billing

A key makes calls once its org has a card on file. Without one, calls return 402 payment_required. A call that fails is never billed.

When the key is wrong

Key errors
StatusCodeMessage
401missing_keySend your API key in the X-API-Key header.
401invalid_keyThat API key is not valid.
402payment_requiredAdd a card at https://fare.dev/app/billing to use this key.

A revoked key also returns invalid_key. None of these calls are billed.

NextErrors