Authentication
API keys, how to send them and how to keep them safe.
Send your key
Every request under /v1 needs an API key, sent as a bearer token. After setting the
quickstart environment variables, try:
curl -fsS "$TRIP_TOPOLOGY_URL/v1/places/FRA" \
-H "Authorization: Bearer $TRIP_TOPOLOGY_KEY"
Keys start with ttk_. A key cannot be sent in the query string. The API does not answer
cross-origin requests from browsers: call it from your server, so that the key stays there.
Manage keys
The console creates, lists and revokes keys. Keys belong to your account, not to the person who created them, and each works alone.
- The full key is shown once, when it is created. Only a hash of it is stored, so a lost key cannot be recovered. Create another one.
- Give each program its own key, named after it, with an expiry where you can.
- To replace a key, create the new one, deploy it, then revoke the old one.
- A revoked key stops working within a minute.
Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | unauthorized |
The request has no bearer token |
| 401 | invalid_api_key |
The key is malformed, unknown, expired or revoked |
| 503 | auth_unavailable |
Keys cannot be checked right now; honour Retry-After |
A 401 carries a WWW-Authenticate: Bearer header. Retrying it unchanged does not help.