Console API — programmatic usage, billing and resources
Everything you can see in the ATP Token web console is also available as a REST API at https://admin.atptoken.ai/api — real-time balances, monthly usage per model, billing events, the model catalog, and your org/workspace/project tree. Use it to drive dashboards, budget alarms, or automatic model switching.
The full, always-in-sync specification is served as a live Swagger UI at admin.atptoken.ai/api/docs — every endpoint on the pages that follow can be tried there directly. A static, agent-readable mirror of the same surface — with operation IDs and typed parameters for function-calling tools — is published at /openapi.json.
Authentication#
Your atp- API key authenticates the data plane only (api.atptoken.ai — chat, media, embeddings). The Console API uses a session token from POST /api/users/login (your console email + password). Sending an atp- key to Console API endpoints returns 401 — it will never work, no matter the endpoint.
Request
curl -sS -X POST https://admin.atptoken.ai/api/users/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"********"}'
# → { "token": "<JWT>", "exp": ..., "user": { ... } }The returned token is a Bearer token valid for roughly 2 hours. Long-running scripts should re-login on 401 rather than caching the token forever. POST /api/users/logout revokes the current session.
Poll the balance and switch models#
The most common integration: watch the real-time project balance and switch to a cheaper model when it crosses a threshold.
# 1) Login (console credentials, NOT the atp- API key)
TOKEN=$(curl -sS -X POST https://admin.atptoken.ai/api/users/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"********"}' | jq -r .token)
# 2) Real-time project balance (Redis-backed, reflects every request instantly)
curl -sS "https://admin.atptoken.ai/api/quota/balance?org_id=<org>&workspace_id=<ws>&project_id=<proj>" \
-H "Authorization: Bearer $TOKEN"
# 3) Current-month usage per model
curl -sS "https://admin.atptoken.ai/api/billing/summary?org_id=<org>" \
-H "Authorization: Bearer $TOKEN"Find your IDs#
Most endpoints take org_id / workspace_id / project_id query parameters. List them with:
curl -sS "https://admin.atptoken.ai/api/orgs" -H "Authorization: Bearer $TOKEN"
curl -sS "https://admin.atptoken.ai/api/workspaces?org=<org_id>" -H "Authorization: Bearer $TOKEN"
curl -sS "https://admin.atptoken.ai/api/projects?workspace=<workspace_id>" -H "Authorization: Bearer $TOKEN"Endpoint groups#
- Usage & balance — real-time balance, monthly usage, per-key usage, trends, wallet
- Billing & top-ups — billing events, top-up records, checkout, credit adjustments
- Model catalog — platform-wide model lists per modality (chat / image / video / audio / embedding)
- Resources & members — orgs, workspaces, projects, members, your account
- Request logs — per-request observability records (7-day retention)