Authentication
How to authenticate with the Surfbot API using cookies, API keys, or Bearer tokens.
Base URL
All API requests are made to:
Auth endpoints (login, register, API key management) use:
Authentication Methods
The API supports three authentication methods, checked in this order:
1. HttpOnly Cookie (Dashboard)
When you log in via the web dashboard, the API sets an sb_token HttpOnly cookie automatically. This is the primary auth method for browser-based access.
2. API Key Header (Integrations)
For programmatic access, use the X-API-Key header. Generate API keys from the dashboard or via the API.
3. Bearer Token (Alternative)
You can also pass a JWT token in the Authorization header.
API Key Management
Create API Key
Requires authentication. Returns the full key only once — store it securely.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A label for this key |
scopes | string[] | No | Permission scopes (default: []) |
live | boolean | No | true for live key (sb_live_), false for test key (sb_test_) |
Response (201):
Important: The
keyfield is only returned on creation. Store it immediately.
List API Keys
Returns all API keys for your organization. Keys are shown with prefix only (not the full key).
Response (200):
Revoke API Key
Response (200):
Error Format
Error responses use this format:
Some errors include additional fields:
Rate Limits
Rate limits are applied per IP and per user, independent of your plan tier.
| Scope | Limit |
|---|---|
| Unauthenticated | 100 req/min per IP |
| Authenticated | 1,000 req/min per IP |
| Per user | 300 req/min per user |
| Auth endpoints (login, register) | 10 req/min per IP |
| OAuth callbacks | 20 req/min per IP |
| Registration | 3 per IP per 24h |
Rate limit headers are included in every response:
When rate limited, you receive a 429 response with a Retry-After header:
HTTP Status Codes
| Code | Meaning |
|---|---|
200 | Success |
201 | Created |
202 | Accepted (scan queued) |
400 | Bad request — check your parameters |
401 | Unauthorized — invalid or missing credentials |
403 | Forbidden — insufficient permissions or quota exceeded |
404 | Resource not found |
409 | Conflict — resource already exists |
422 | Unprocessable entity — validation failed |
429 | Rate limited — retry after the indicated time |
500 | Internal server error |
503 | Service unavailable — rate limiting service down |