Skip to main content

Authentication

Every call is made as an account: the one whose API key it sends. A key sees exactly what its account sees, and only the sources that account's plan opens.

Send your key​

Send the key in the Authorization header of every call, as a bearer token: Authorization: Bearer bk_…. Keys are never read from the address, so they do not end up in logs.

GET /api/v1/me

curl --request GET \
--url 'https://carryspec.com/api/v1/me' \
--header "Authorization: Bearer $CARRYSPEC_API_KEY"
note

A browser that is logged in on the site is recognised too, which is how Swagger works for you without a key. Only calls made with a key count against your plan's calls a day.

Calls that need no key​

These answer anyone:

Making and revoking keys​

  • Make a key on the API page of your account. It needs a name, so you can tell later which program uses it.
  • The key is shown once. Only a hash of it is kept, so it cannot be shown again: if it is lost, make another and revoke the old one.
  • An account can have 5 working keys at once.
  • Revoking a key on the same page stops it at once.

When a key is refused​

A refusal carries the header WWW-Authenticate: Bearer and an error whose code says why:

StatuscodeWhen
401not_signed_inNo key was sent.
401bad_keyThe key is wrong, revoked, or its account is blocked.
403account_blockedThe account was blocked.

Keeping keys safe​

  • Keep keys on a server, in an environment variable such as CARRYSPEC_API_KEY, which every example in these docs reads.
  • Use one key per program, so one can be revoked without stopping the rest.
warning

Never put a key in a web page, a mobile app or a public repository: anyone who finds it can use your account's calls.