Skip to content

Authenticate Requests

CLI: Interactive Browser Login

bash
chainabit auth login

Opens a device-approval page in your browser. Sign in and click Approve. Done.

Check who you are logged in as:

bash
chainabit auth whoami

Print the current token:

bash
export TOKEN=$(chainabit auth token)

CLI: CI/CD with Developer Tokens

Create a token once (shown once — copy it immediately):

bash
chainabit auth keys create "github-actions" --ttl 90 --scope execution:run
# → cbt_live_xxxxxxxxxxxxxxxxxxxx

Use it in your pipeline:

bash
export CHAINABIT_TOKEN=cbt_live_xxxx
chainabit workspace use ws_yourworkspace
chainabit ai session list --json

Add scopes or bind the token to an account when you need tighter isolation:

bash
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:run

List and revoke keys:

bash
chainabit auth keys list
chainabit auth keys revoke <id>

API: Password Login

bash
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": "you@example.com",
    "password": "yourPassword123"
  }'

Store data.tokens.accessToken and data.tokens.refreshToken from the response.

API: Send Authenticated Requests

bash
curl "$BASE_URL/ai/sessions" \
  -H "Authorization: Bearer $TOKEN"

If a request returns 401 Unauthorized, refresh the session and retry once.

API: Refresh Session

bash
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:

bash
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.


Built with purpose.