Skip to content

Mint a token and make your first call

Every REST call is authenticated with a short-lived bearer token you mint yourself from a long-lived credential. You end up with a token, the two headers every later call needs, and a response that proves both of them resolved.

  1. POST /api/auth/api-token takes { apiKey, apiSecret } and returns a 24-hour HS256 JWT in token. The credential pair itself is issued out of band — by an operator in the admin console, or by self-serve tenant signup where that is enabled. See Credentials & tokens.

    Terminal window
    curl -s https://api.troncharts.xyz/api/auth/api-token \
    -H 'content-type: application/json' \
    -d '{"apiKey":"'"$TC_API_KEY"'","apiSecret":"'"$TC_API_SECRET"'"}'
    # → { "token": "eyJ…", "tier": "fullTrading", "accountId": "…",
    # "expiresAt": 1754300000000, "enabledTools": null, … }

    tier is snapshotted at mint: a tier change on the credential needs a fresh token to take effect.

  2. GET /api/v1/_meta/test-connection is the one round-trip that confirms the bearer, the tenant and the tier all resolved. It returns { ok, accountId, apiClientId, tier, serverTime }.

    Terminal window
    curl -s https://api.troncharts.xyz/api/v1/_meta/test-connection \
    -H "authorization: Bearer $TOKEN" \
    -H "x-tenant-slug: $TC_TENANT_SLUG"
    # → { "ok": true, "accountId": "…", "apiClientId": "…",
    # "tier": "fullTrading", "serverTime": "2026-08-04T12:00:00.000Z" }
  3. GET /api/v1/accounts lists every account the credential can reach and gives you the accountId that every /api/v1/accounts/{id}/* read needs.

    Terminal window
    curl -s https://api.troncharts.xyz/api/v1/accounts \
    -H "authorization: Bearer $TOKEN" \
    -H "x-tenant-slug: $TC_TENANT_SLUG"
    # → { rootAccountId, activeAccountId,
    # accounts: [ { accountId, accountNumber, kind, capitalModel,
    # displayName, baseCurrency, wallets: [...] } ] }

    Revoke a token before its 24 hours are up with POST /api/auth/api-token/revoke and { token }.

Next: Create a paper account · Read balance, positions and open orders · Scopes & tiers