Personal Access Token
Personal Access Token
A personal access token is the credential for automating your BeatAPI account. You choose the permissions each token carries, so a script can do only what you allow: read your balance, manage API keys, list payments, or read account data such as what each task or text request cost. Model, task and workflow requests still use an API key.
Personal access token or API key
Create and manage tokens
- Sign in to the Dashboard and open Account security.
- Choose Create personal token, enter a name, tick the permissions the token needs and pick an expiry: 7, 30 (the default), 90 or 365 days, or never.
- Complete the verification step, then copy the token. The full token is shown only once; closing the window removes it from the page.
- Store it as a secret where your automation runs, for example in
BEATAPI_PERSONAL_TOKEN.
An account can hold up to 20 tokens. Give each one a name that says where it runs and grant only the permissions it needs. The token list shows every token’s name, permissions, expiry and when it was last used.
You can rename a token at any time without verification. Changing a token’s permissions and revoking a token both ask for verification. Edited permissions apply to the same token, so nothing needs redeploying. Revoke removes the token, and tools that use it lose access at once. Keep tokens on trusted servers: never put one in browser code, a mobile app or a shared repository.
A token created before multiple tokens were available keeps working with the permissions it already had.
Permissions
Each token carries only the permissions you ticked. A call that needs a permission the token lacks is refused with 403 forbidden, and the message names the missing permission.
A token cannot top up your balance, change sign-in or security settings, or manage other tokens; those stay in the Dashboard. Grant api_key:reveal only to tokens that really need to read key secrets.
Endpoints it can call
Send the token as Authorization: Bearer <token>. Each endpoint needs the permission shown.
The /v1/account endpoints refuse an API key with 403 forbidden; GET /v1/usage accepts either an API key or a token with usage:read and returns the same summary. Responses are wrapped in data. IDs are strings, times are Unix seconds and money is in USD. Lists return object, data, has_more and next_cursor, and take limit (1–100, default 20) and cursor. An unknown query parameter is refused with 400 bad_request.
Read your balance
Needs profile:read.
List API keys
Needs api_key:read. Keys are masked: only key_prefix, the first characters, is returned. Use GET /v1/account/keys/{id} to read one key.
Create an API key
Needs api_key:write. Only title is required. expires_at (Unix seconds), remaining_credits (USD), models and allowed_ips are optional; leave them out for no expiry, no spending cap, every model and any IP address. The full key is in key in this response only: later reads return just key_prefix, so store the key now.
Edit a key with PATCH /v1/account/keys/{id}, sending any of title, status (active or disabled), expires_at (null for never), remaining_credits (null for unlimited), models ([] for every model) and allowed_ips. DELETE /v1/account/keys/{id} returns object, id and deleted: true.
Reveal an API key
Needs api_key:reveal, which is separate from api_key:read: a token that can list keys cannot read their secrets unless you grant this too.
List payments
Needs wallet:read. status is paid (the default), pending, failed, expired, reviewing or all. currency is USD or CNY, the currency paid in; credits is the balance the payment adds, in USD.
Update the notification threshold
Needs profile:write; reading the settings with GET /v1/account/notifications needs profile:read. Send any of type (email or none), threshold_credits and notification_email. BeatAPI alerts you when usage takes your balance below the threshold; 0 selects the default. The response is the updated settings, where effective_threshold_credits is the threshold in force.
Reconcile one task
Save data.id from the task-creation response, then look it up:
For a text request, use the request ID from the X-BeatAPI-Request-Id response header. When a text response body carries chatcmpl-<request ID> as its id, that value works as well. The request ID of a task’s creation call returns the same record as its task ID.
List usage records
While has_more is true, request the next page with cursor. An unknown parameter, a limit outside 1–100 or a timestamp in milliseconds is refused with 400 bad_request instead of being ignored.
The usage record
A task’s amounts match usage.credits_charged and usage.credits_refunded from GET /v1/tasks/{task_id}. When a task settles above or below its reserved amount, the record shows the settled total. You can read only your own records: another account’s ID returns 404 not_found.
Errors
Errors use the standard error object.

