Authenticate Requests
CLI: Interactive Browser Login
chainabit auth loginOpens a device-approval page in your browser. Sign in and click Approve. Done.
Check who you are logged in as:
chainabit auth whoamiPrint the current token:
export TOKEN=$(chainabit auth token)CLI: CI/CD with Developer Tokens
Create a token once (shown once — copy it immediately):
chainabit auth keys create "github-actions" --ttl 90 --scope execution:run
# → cbt_live_xxxxxxxxxxxxxxxxxxxxUse it in your pipeline:
export CHAINABIT_TOKEN=cbt_live_xxxx
chainabit workspace use ws_yourworkspace
chainabit ai session list --jsonAdd scopes or bind the token to an account when you need tighter isolation:
chainabit auth keys create "wallet-bot" --ttl 30 --scope wallet:read --scope execution:run
chainabit auth keys create "account-bot" --ttl 30 --account <account-uuid> --scope execution:runList and revoke keys:
chainabit auth keys list
chainabit auth keys revoke <id>API: Password Login
export BASE_URL="https://api.chainabit.com/api/v1"
curl -X POST "$BASE_URL/auth/login" \
-H "Content-Type: application/json" \
-H "x-captcha-token: <captcha-token>" \
-d '{
"identifier": "[email protected]",
"password": "yourPassword123"
}'Store data.tokens.accessToken and data.tokens.refreshToken from the response.
API: Send Authenticated Requests
curl "$BASE_URL/ai/sessions" \
-H "Authorization: Bearer $TOKEN"If a request returns 401 Unauthorized, refresh the session and retry once.
API: Refresh Session
curl -X POST "$BASE_URL/auth/refresh" \
-H "Content-Type: application/json" \
-d '{"refreshToken":"'"$REFRESH_TOKEN"'"}'Replace both stored tokens after a successful refresh. Refresh tokens are single-use.
API: Legacy Exchange Compatibility
Current servers accept cbt_live_... developer tokens directly as bearer credentials. For older deployments, the exchange endpoint remains available during the compatibility window:
curl -X POST "$BASE_URL/auth/developer-tokens/exchange" \
-H "Content-Type: application/json" \
-d '{"token":"cbt_live_xxxx"}'Response contains accessToken and refreshToken — same shape as password login.
Captcha-Protected Flows
Registration, login, password recovery, and confirmation resend require a Cloudflare Turnstile token in the x-captcha-token header. This applies only to browser/UI flows — developer-token usage does not require captcha.