spicrawlspicrawlDocs
Partner

Provision a workspace, or fetch it and its default key

Creates the workspace for this end user if it does not exist, makes sure it has its default API key, and returns that key's plaintext.

Requires scope: partner

PUT
/v1/partner/workspaces/{external_user_id}

Creates the workspace for this end user if it does not exist, makes sure it has its default API key, and returns that key's plaintext. Calling it again is how the key is read again.

201 when this call created the workspace, 200 when it already existed. created says which. The key is normally the same on every call, but a new one is issued when the stored key has expired or can no longer be read, so store whatever the latest call returned. The response is sent with Cache-Control: no-store.

A partner may create at most a fixed number of workspaces per UTC day. Past that, a new user is 429 ERR::LIMIT::PARTNER_WORKSPACE_LIMIT. An existing user is never limited.

A workspace that has been soft-deleted is 409 ERR::REQUEST::CONFLICT and returns no key: Spicrawl support must restore it first. A closed workspace is 409 ERR::REQUEST::CONFLICT too, with no key; closure is terminal.

Rate limit: this route allows 2 requests per second per partner, with bursts of 20, on top of the 20-per-second limit every partner route shares.

The optional body names the tier a new workspace starts on, by id or name. Without it the workspace gets the partner's default tier, or no tier when there is none. An existing workspace keeps its tier, but an unknown tier is 404 either way. Move a workspace with PUT .../tier.

The optional display_name is a label for your own reference. It is optional; use any label you like, and avoid personal data you do not need to share. It is applied only when this call creates the workspace: an existing workspace keeps its name whatever body you send. Change it with PATCH.

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), and partner (only on a partner account's key). A missing scope is 403 ERR::AUTH::INSUFFICIENT_SCOPE naming the scope.

In: header

Path Parameters

external_user_id*string

The partner's own id for the end user.

Match^[A-Za-z0-9._:-]{1,128}$

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X PUT "https://example.com/v1/partner/workspaces/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "workspace_id": "string",  "external_user_id": "string",  "display_name": "string",  "status": "active",  "created_at": "2019-08-24T14:15:22Z",  "free_credits": 0,  "wallet_cap": 0,  "tier": {    "id": "string",    "name": "string"  },  "requests_per_minute": 1,  "concurrency": 1,  "wallet_cap_source": "tier",  "window_resets_at": "2019-08-24T14:15:22Z",  "wallet_used": 0,  "wallet_used_source": "live",  "free_used": 0,  "own_credits": 0,  "created": true,  "api_key": "string"}