Authentication and keys
How to send your key, what the key format means, and how to roll a key.
Every request carries one key, in one place: the Authorization header.
GET /v1/<part>/key HTTP/1.1
Host: api.traki.io
Authorization: Bearer traki_<part>_live_8Hq2LmNpXr_…The header is the only place
The API refuses a key anywhere else. A key in the address gets key_in_url and a key in the body gets key_in_body. Addresses end up in server logs, proxies and browser history, so a key sent that way should be rolled.
The key format
traki_<part>_<mode>_<keyId>_<secret><check>
traki_account_live_8Hq2LmNpXr_<43 characters><6 characters>| Piece | What it is |
|---|---|
traki_ | Marks a TRAKI Developer API key, so secret scanners can find a leaked one |
part | account, publisher or buyer: the part of the API the key opens |
mode | live for real data, test for the test copy of the account |
keyId | Ten letters and digits. Not secret: it shows in the portal, your request log and support tickets |
secret | 43 random letters and digits. Shown once, when the key is made. TRAKI keeps only a hash of the key |
check | Six characters of checksum, so a mistyped key is refused at once with key_malformed |
Keys for this part of the API start traki_publisher_. A key for another part is refused with wrong_api, and the answer names the right part.
Ask the API about your key
GET /v1/publisher/key needs no scope. It answers the key's name, mode, scopes, pinned version, expiry and the account it belongs to. Use it to check a key before you rely on it.
curl 'https://api.traki.io/v1/publisher/key' \
-H "Authorization: Bearer $TRAKI_KEY"What a key can carry
- Scopes. What the key may read and change. See scopes.
- An IP allow-list. Addresses or ranges the key may be used from. Others get
ip_not_allowed. Keys with a high-risk scope must have one. - An expiry. 30, 90 or 365 days, or none.
- A pinned version. The dated API version the key was made on. See versions.
Rolling a key
Rolling gives a key a new secret and keeps its ID, scopes and settings. You choose how long the old secret keeps working: not at all, 1 hour, 24 hours or 7 days. Deploy the new secret within that time. Revoking stops a key at once and for good.