DocumentationAPI v1
Documentation/Guides/Authentication
GuideFree

Authentication

One key, sent in one header, on every call.

Every call carries your key in a header. Keys start da_live_ and are 40 characters long. There are two ways to send it, and the API takes either: use whichever your client makes easier.

1. As a bearer token

The usual way, in the Authorization header. Every example in these docs uses it.

curl https://api.dartsapi.com/v1/usage \
  -H "Authorization: Bearer $DARTS_API_KEY"

2. As X-API-Key

For a client or tool that cannot set a bearer token, send the key on its own in X-API-Key. When both are sent, the bearer token is the one read.

curl https://api.dartsapi.com/v1/usage \
  -H "X-API-Key: $DARTS_API_KEY"

Never in the address

A key in a URL ends up in logs, proxies, browser history and screenshots, so the API refuses one there: a call with ?key= or ?api_key= and no header answers 400 key_in_query, and says how to send it instead.

In the documentation

Your key is kept in this browser, so Run works on every endpoint page with nothing to paste. Your dashboard puts it there when you sign up and again when you rotate it.

When a key is refused

StatusCodeWhat happened
400key_in_queryThe key was put in the address. Send it in a header instead.
401no_keyNo Authorization or X-API-Key header.
401bad_keySomething was sent, but it is not shaped like a Darts API key.
401unknown_keyA well-formed key that is not ours, or one that has been rotated.

Rotating your key

Rotate from your dashboard. The old key stops the moment the new one is issued, so put the new one in place first. Your plan, usage and history stay with your account, not the key.