Skip to main content

Authentication

The X-API-Key header​

Every request must send the key in the X-API-Key header:

GET /api/public/v1/balances/ HTTP/1.1
Host: service.talano.ir
X-API-Key: tln_7KQ2M9XA_vZ3c8...
Accept: application/json
  • The public API accepts only this header.
  • App login tokens (JWT, Authorization: Bearer ...) are ignored on the public API, so such a request gets 401 not_authenticated.
  • Every 401 response carries WWW-Authenticate: X-API-Key.
  • API keys are rejected on the app's own endpoints.

Each key can have 0–10 exact IPs (no ranges or CIDR):

  • With an allow-list: requests from any other IP get 403 ip_not_allowed. Your code must run on a server with a static public IP (VPS, dedicated server, or NAT with a fixed IP). Behind a proxy or VPN, the outgoing IP is what counts.
  • Without one: the key works from any IP, and allowed_ips is [] in GET /key/.
warning

For trade keys an allow-list is strongly recommended. A trade key without one can be used from anywhere if it leaks.

To change IPs, create a new key and revoke the old one.

Expiry and revocation​

SituationError code
No header, or a JWT was sent401 not_authenticated
Unknown or malformed key401 invalid_api_key
Key revoked (by you, support, or a password change/reset)401 api_key_revoked
Key validity (30/60/90 days) has ended401 api_key_expired
The key owner's account is deactivated401 user_inactive
The account's KYC is no longer valid (until restored)403 kyc_required

Request check order​

Checks run in this order, and the first failure is returned:

  1. Key present (not_authenticated)
  2. Key valid (invalid_api_key)
  3. Not revoked (api_key_revoked)
  4. Not expired (api_key_expired)
  5. Owner active (user_inactive)
  6. IP allowed (ip_not_allowed)
  7. Public API enabled (api_disabled)
  8. User not blocked (api_blocked)
  9. KYC (kyc_required)
  10. Access level (insufficient_scope)
  11. Rate limit (throttled)
  12. The endpoint's own validation

Requests rejected before step 11 are not counted against the rate limit and carry no X-RateLimit-* headers.

Read the key's expiry date with GET /key/ and create a new key before it:

curl -s -H "X-API-Key: $TALANO_API_KEY" https://service.talano.ir/api/public/v1/key/
{
"name": "my-bot",
"prefix": "tln_7KQ2M9XA",
"scope": "trade",
"allowed_ips": ["203.0.113.10"],
"created_at": "2026-11-01T08:00:00Z",
"expires_at": "2026-12-01T08:00:00Z",
"rate_limits": { "read_per_minute": 60, "trade_per_minute": 20 }
}
tip

Add a daily check to your bot that alerts you when expires_at is less than 7 days away.

Key security checklist​

  • Never put the key in a URL or query string.
  • Never commit the key to git. Use an environment variable or a secret manager, and put files like .env in .gitignore.
  • Never use the key in a browser, mobile app or any client-side code. The key stays on your server.
  • Do not log the full key. If you must, log only the prefix (tln_7KQ2M9XA).
  • Create a separate key per application so you can revoke each one on its own.
  • Choose the lowest access level you need (read for dashboards).
  • If the key may have leaked, revoke it in the app immediately.

Next: Access levels.