spicrawlspicrawlDocs
Sessions

Create a persisted browser session

Creates a session: a sealed cookie jar and web-storage snapshot, pinned to one engine and one exit intent, that you reuse by passing its `id` as `session_id` on `/v1/scrape`.

Requires scope: sessions

POST
/v1/sessions

Creates a session: a sealed cookie jar and web-storage snapshot, pinned to one engine and one exit intent, that you reuse by passing its id as session_id on /v1/scrape.

Pitfalls:

  • Every field is optional. An empty body (Content-Length 0) means "all defaults"; {} also works. Unknown fields are refused with 400.
  • Sessions are single-writer. While a render holds the lease, a second scrape on the same session, and release/delete without force=true, get 409 ERR::SESSION::BUSY with a Retry-After. Serialise work per session, or create one session per concurrent worker.
  • rotate_ip and sticky_key are mutually exclusive (400 ERR::REQUEST::INCOMPATIBLE_FLAGS). Omitting both pins the exit: sticky_key is derived from the session id.
  • ttl_seconds above the organization's maximum is refused (400), never clamped. It slides on use but never past hard_expires_at.
  • proxy_country requires premium_proxy: true. fingerprint requires engine: camoufox.
  • A project may hold only one active session per sticky_key (409 ERR::REQUEST::CONFLICT).
  • An organization may hold at most 100 live sessions (429 ERR::LIMIT::SESSIONS_EXCEEDED, Retry-After 30).
  • When engine is omitted, the default is the first of obscura, chromium that the deployment runs, else fetch. Check the engine in the response.
  • An explicit engine must be fetch or a render engine this deployment runs; otherwise 503 ERR::ENGINE::UNAVAILABLE and nothing is created. The detail lists the deployed engines.

Authorization

bearerAuth
AuthorizationBearer <token>

Authorization: Bearer <key>. Read the key from the SPICRAWL_API_KEY environment variable; never hard-code or log it. spicrawl_test_… keys can never spend live credits. Scopes: scrape, batch, sessions (granted by default), browser and read (granted deliberately). A missing scope is 403 ERR::AUTH::INSUFFICIENT_SCOPE naming the scope.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body of POST /v1/sessions. All fields optional; unknown fields are refused with 400.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/v1/sessions" \  -H "Content-Type: application/json" \  -d '{    "engine": "chromium",    "ttl_seconds": 7200,    "premium_proxy": true,    "proxy_country": "de",    "sticky_key": "acct-4812"  }'
{  "id": "01J9ZQ4M7R3T8VX2K5N6P0B1CD",  "project_id": "01J9Y0000000000000000PROJ1",  "engine": "chromium",  "status": "active",  "sticky_key": "acct-4812",  "proxy": {    "tier": "residential",    "country": "de"  },  "created_at": "2026-09-22T10:00:00Z",  "last_used_at": null,  "expires_at": "2026-09-22T12:00:00Z",  "hard_expires_at": "2026-09-29T10:00:00Z",  "usage_count": 0,  "context": {    "schema_version": 1,    "cookies": 0,    "origins": 0,    "bytes": 131  }}