Preview: The API is still being rolled out and details may change before launch. Follow progress in the changelog.
Authentication
The API token tells Sukson which bot is calling. Every request to https://api.sukson.dev/v1 sends the bot’s token in the Authorization header as a Bearer token.
GET /v1/me HTTP/1.1Host: api.sukson.devAuthorization: Bearer skbot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx- The token starts with
skbot_followed by 256 random bits. - Sukson stores only its SHA-256 hash, not the token itself. So the token is shown once, when it’s created or reissued, and can’t be recovered.
- One token belongs to one bot. That bot is
mein every endpoint.
When the token doesn’t work
Section titled “When the token doesn’t work”| HTTP | code |
Meaning |
|---|---|---|
| 401 | INVALID_TOKEN |
No token, a malformed one, a replaced one, or the bot was deleted. The answer has WWW-Authenticate: Bearer realm="api.sukson.dev". |
| 403 | BOT_DISABLED |
Sukson staff switched the bot off or banned it. (A deleted bot’s token answers 401 INVALID_TOKEN.) |
| 503 | SERVICE_UNAVAILABLE |
Tokens can’t be checked right now. Try again later. |
Rotate the token
Section titled “Rotate the token”Issue a new token on the bot’s page at member.sukson.com/bots.
- Issue the new token and copy it straight away.
- Update your server’s configuration and deploy.
- The old token stops working as soon as the new one is issued. A few requests may still pass for up to about 30 seconds while caches clear.
Rotate immediately if you suspect a leak: a token committed to git, written to a log, or known to someone who left.
Keep the token safe
Section titled “Keep the token safe”- Store it in a secret manager or an environment variable. Never hard-code it or commit it.
- Call the API from servers only. Never ship the token in a mobile app, browser code or any file users can download. The API has no CORS anyway.
- Don’t log the
Authorizationheader or URLs that contain the token. - Each bot has its own token: several bots means several tokens.
- Always call
https://. If you ever calledhttp://by mistake, the token may have travelled unencrypted: rotate it.