Getting started
Authentication
Every request is made with an API key. Keys carry scopes, can be locked to IP addresses, and can be rotated without downtime.
API keys
Create keys in Dashboard → API keys. A key is tk_live_ followed by 40 letters and digits, and it works for both APIs. Give each integration its own key — one per panel, one per script — so you can revoke one without touching the others.
A key is shown once
We store a SHA-256 hash of the key, plus its first 12 and last 4 characters so you can tell keys apart. Nobody — including us — can show you the full key again. If you lose it, create a new one and revoke the old one.
Sending your key
Provider API v2 takes the key as the key parameter, alongside action, in a form body, a JSON body or the query string. It also accepts Authorization: Bearer, which keeps the key out of logs.
curl https://ultrasmm.io/api/v2 \
-d key=tk_live_your_key_here \
-d action=balanceREST API v3 takes it only as a bearer token. There’s no key parameter.
curl https://ultrasmm.io/api/v3/balance \
-H "Authorization: Bearer tk_live_your_key_here"A missing, mistyped or revoked key fails before anything else. v2 answers {"error": "Invalid API key"} with HTTP 200; v3 answers 401 with a WWW-Authenticate header:
{
"error": {
"code": "invalid_api_key",
"message": "The API key is missing, mistyped or revoked. Copy it again from Dashboard → API keys.",
"doc_url": "/docs/errors#invalid_api_key",
"request_id": "req_f8xrrISYryqXQcXJ3x"
}
}Scopes
Each key carries one or more scopes. A new key gets all four unless you untick some. A request outside the key’s scopes fails with insufficient_scope (v3, HTTP 403) or {"error": "API key does not have permission for this action"} (v2).
| Scope | Allows | v2 actions | v3 endpoints |
|---|---|---|---|
orders:write | Place and cancel orders | addcancel | |
orders:read | Read orders and services | servicesstatus | |
refills:write | Request refills | refillrefill_status | |
balance:read | Read balance | balance |
GET /api/v3/status is public and needs no key at all. Give a panel all four scopes; give a read-only reporting script just orders:read and balance:read.
IP allowlists
Lock a key to the servers that use it. When a key has an allowlist, requests from any other address are refused with ip_not_allowed (v3, HTTP 403) or {"error": "IP address is not allowed"} (v2). The v3 message names the address we saw, so you know exactly what to add.
- Entries are exact IPv4 or IPv6 addresses. Ranges and CIDR blocks aren’t supported.
- We use the first address in
X-Forwarded-For, thenX-Real-IP. Add your server’s public egress address, not a private one. - An empty allowlist means any address can use the key.
Rotating a key
Rotate on a schedule, when someone with access leaves, or if a key may have leaked. There’s no downtime if you overlap:
- Create a new key with the same scopes and allowlist.
- Deploy it to your panel or script. Both keys work in the meantime.
- Watch the old key’s “last used” time in the dashboard. Once it stops moving, revoke it. Rate limits are per key, so during the overlap each key has its own bucket.
Revoking a key
Revoking is immediate and permanent: the next request with that key gets invalid_api_key. Orders placed with it keep running and stay on your account — they belong to the account, not the key.
Keeping keys safe
- Keep keys on your server. Never put one in browser JavaScript, a mobile app or a public repository.
- Prefer POST bodies or the
Authorizationheader over query strings, which end up in access logs. Our own request logs only ever show the first 12 and last 4 characters. - Use the narrowest scopes that work and an IP allowlist for anything that runs on a fixed server.
Something unclear or out of date? Write to [email protected] and quote the page.