Developers

API overview

The REST API is versioned under /v1 and speaks JSON. Server-to-server calls authenticate with an API key from Studio.

Authentication

Send the key in the Authorization header as a bearer token, on every request.

curl -H "Authorization: Bearer $PUZZLE_API_KEY" \
  "https://dev-api.pluzzento.com/v1/puzzles?limit=25"
const response = await fetch("https://dev-api.pluzzento.com/v1/puzzles?limit=25", {
  headers: { Authorization: `Bearer ${process.env.PUZZLE_API_KEY}` },
});
if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message} (${error.requestId})`);
}
const { data, nextCursor } = await response.json();

Create and manage keys in Studio

Scopes

Each key gets one or more scopes. A call needs the scope that matches its permission.

puzzle:read Read puzzles
Puzzles, series and publications of the workspace, without solutions.
analytics:read Read analytics
The workspace's play analytics.
embed-tokens:create Create embed tokens
Short-lived tokens that let your pages embed the workspace's token-protected puzzles.

A key acts as the person who created it, in the key's own workspace: it never grants more than that person holds there at the time of the call. If their role changes, the key's reach changes with it.

Requests and responses

GET /v1/puzzles?limit=25
GET /v1/puzzles?limit=25&cursor=<nextCursor of the previous page>

Errors

Errors share one shape: a stable code, a human message, the requestId to quote to support, and sometimes details. Branch on the code, never on the message.

{
  "error": {
    "code": "INSUFFICIENT_SCOPE",
    "message": "This API key lacks the scope this call needs.",
    "requestId": "01JB3Q9V7Z4K2M8N6P5R3S1T0W"
  }
}
Errors specific to API keys
StatusCodeMeaning
401API_KEY_INVALIDThe key is malformed, unknown, revoked or expired (the answer never says which).
403INSUFFICIENT_SCOPEThe key lacks the scope this call needs.
403ENTITLEMENT_REQUIREDThe workspace's plan no longer includes API access.
403ACCOUNT_DISABLEDThe account the key acts as is disabled.
402QUOTA_EXCEEDEDThe workspace used its monthly API calls.
429RATE_LIMITEDToo many requests in a short time: wait for Retry-After, then try again.

Rate limits and quotas

{
  "error": {
    "code": "QUOTA_EXCEEDED",
    "message": "Monthly API call quota reached.",
    "requestId": "01JB3Q9V7Z4K2M8N6P5R3S1T0X",
    "details": {
      "entitlement": "api_calls_monthly_included"
    }
  }
}

OpenAPI document

The API describes itself in an OpenAPI document: generate a client from it, or read it in the reference.