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 gets401 not_authenticated. - Every
401response carriesWWW-Authenticate: X-API-Key. - API keys are rejected on the app's own endpoints.
IP allow-list (optional, recommended)
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_ipsis[]inGET /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
| Situation | Error code |
|---|---|
| No header, or a JWT was sent | 401 not_authenticated |
| Unknown or malformed key | 401 invalid_api_key |
| Key revoked (by you, support, or a password change/reset) | 401 api_key_revoked |
| Key validity (30/60/90 days) has ended | 401 api_key_expired |
| The key owner's account is deactivated | 401 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:
- Key present (
not_authenticated) - Key valid (
invalid_api_key) - Not revoked (
api_key_revoked) - Not expired (
api_key_expired) - Owner active (
user_inactive) - IP allowed (
ip_not_allowed) - Public API enabled (
api_disabled) - User not blocked (
api_blocked) - KYC (
kyc_required) - Access level (
insufficient_scope) - Rate limit (
throttled) - 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
.envin.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 (
readfor dashboards). - If the key may have leaked, revoke it in the app immediately.
Next: Access levels.