Skip to Content

Authentication

Every endpoint requires a Bearer API key. The sections below cover headers, the error format and billing.

API keys

Authorization: Bearer YOUR_API_KEY

Create and manage keys in the dashboard  under API Keys. Keep keys secret; do not commit them to repositories. The same keys authenticate the MCP server.

A missing or invalid key gets 401.

Common headers

HeaderRequiredDescription
AuthorizationYesBearer <api-key>
Content-TypeFor JSON bodiesapplication/json
X-Request-IDNoYour own request id; it is written to the server logs next to the task, which helps when you ask about a task later. It must be new for every request: one used already is refused with 409 and code: request_id_in_use

Error format

Every error is a JSON object with one field, error; a 402 adds code and exhausted:

// 401 { "error": "Authentication required: missing Authorization header. Please provide Authorization header with Bearer token format: 'Authorization: Bearer <your-api-key>'" } // 400 { "error": "Invalid input data" } // 402 { "error": "Insufficient balance: the browser_seconds quota is used up and there is no USD balance to cover overage; top up in the dashboard (https://dash.dat.ai) or check GET /api/v1/account/balance", "code": "insufficient_balance", "exhausted": "browser_seconds" } // 404 { "error": "Task not found" }

HTTP status codes

CodeWhen
400Invalid JSON, an unknown field, a missing required field, a value out of range
401Missing or invalid API key
402No active subscription, or insufficient balance
403Access denied: another account’s task, or script / uv_args not enabled for this key
404Task or screenshot not found
405Wrong HTTP method
502SERP only: no results page could be obtained
504A sync call outlived its wait; the task itself may still finish

Billing

A task is billed only when it succeeded and produced a result. A task that failed, timed out or was refused by the site costs nothing, and a SERP request pays only for the one attempt that returned the page. Traffic figures (traffic_in, traffic_out, traffic_total) come back with every finished task. When the account balance is too low, or the subscription has expired, the server returns 402 naming the quota that ran out; top up in the dashboard . GET /api/v1/account/balance says where the account stands before that, and every task reply carries a balance_warning while a quota is used up or nearly so.