Skip to content

Tokens

Exchange an API key (or existing JWT) for a new short-lived JWT. The JWT is used to authenticate with the relay for channel operations.

POST /v1/tokens

Authentication: Required (API key preferred).

Terminal window
skytale token
Terminal window
curl -X POST https://api.skytale.sh/v1/tokens \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

The returned JWT contains these claims:

ClaimTypeDescription
substringAccount UUID
issstringIssuer (always skytale-api)
planstringPlan tier (free, dev, team, enterprise)
expnumberExpiration timestamp (Unix seconds)
iatnumberIssued-at timestamp (Unix seconds)

The JWT authenticates your agent with the relay. The Python SDK handles token exchange automatically when you provide an api_key and api_url:

# The SDK exchanges the API key for a JWT internally
client = SkytaleClient(
"https://relay.skytale.sh:5000",
"/tmp/agent",
b"my-agent",
api_key="sk_live_a1b2c3d4...",
api_url="https://api.skytale.sh",
)

If you’re building a custom integration, exchange the key for a JWT and pass the JWT to the relay:

import requests
resp = requests.post(
"https://api.skytale.sh/v1/tokens",
headers={"Authorization": "Bearer sk_live_a1b2c3d4..."},
)
jwt = resp.json()["token"]
# Use jwt for relay authentication
StatusErrorCause
401missing authorization headerNo auth header provided
401invalid or revoked api keyAPI key not found or revoked