Foldkit docs

API reference

The Foldkit partner API. Server-to-server, authenticated with a secret API key (`Authorization: Bearer sk_live_…`). Every response is scoped to the tenant the key belongs to; a resource belonging to another tenant is indistinguishable from one that does not exist, so every denial is a 404.

The basics

Base URLhttps://foldkit.theboxes.asia/api/v1
AuthAuthorization: Bearer sk_live_…
Version1.0.0
Operations25 across 6 resources
Specopenapi.json

Point a Swagger UI, a Postman import or your language’s codegen at the spec. It carries the security scheme, so “Authorize” with a sandbox key lets you exercise the whole API from the browser.

Paging

List endpoints are cursor-paged. Pass limit (1–200, default 50) and follow nextCursor until it is null. The cursor is opaque — it encodes a keyset position, not an offset, so a page cannot skip or repeat a row when something is created while you are reading.

let cursor = null
do {
  const page = await foldkit.designs.list({ limit: 100, cursor })
  for (const design of page.items) process(design)
  cursor = page.nextCursor
} while (cursor)

Operations

designs

OperationWhat it doesScopes
GET /v1/designsList designs (active only unless includeArchived is set)designs:read
POST /v1/designsCreate a design from a style, a template, or a documentdesigns:write
GET /v1/designs/{id}Get a designdesigns:read
PATCH /v1/designs/{id}Rename a design or re-attribute it to an end-userdesigns:write
DELETE /v1/designs/{id}Delete a design and its version historydesigns:write
GET /v1/designs/{id}/versionsList a design's version historydesigns:read
GET /v1/designs/{id}/preview.pngServer-rendered PNG of a design’s flat dieline with artworkA PNG of the **flat dieline with the artwork on it** — a print-shop proof, not a photorealistic folded carton. Rendered once per (design version, width) and cached, so a handful of sizes costs a handful of renders for the life of the version. Send the previous response’s `ETag` back as `If-None-Match` to get a `304` without a render.designs:read

exports

OperationWhat it doesScopes
POST /v1/designs/{id}/exportsEnqueue an export of a designdesigns:read, exports:write
GET /v1/exportsList export jobsexports:read
GET /v1/exports/{id}Get an export job, with a download URL once it completesexports:read

assets

OperationWhat it doesScopes
POST /v1/assetsPresign an artwork uploadassets:write
POST /v1/assets/{id}/confirmConfirm an upload and run the ingest pipelineassets:write
GET /v1/assets/{id}Get an assetassets:read

catalog

OperationWhat it doesScopes
GET /v1/stylesList the box styles this tenant may offertemplates:read
GET /v1/templatesList this tenant's starter templatestemplates:read
GET /v1/quotesList quote requests captured in this tenant's embedsquotes:read

usage

OperationWhat it doesScopes
GET /v1/usageMetered usage for a billing periodusage:read

webhooks

OperationWhat it doesScopes
GET /v1/webhooksList webhook endpointswebhooks:manage
POST /v1/webhooksCreate a webhook endpoint (returns the signing secret once)webhooks:manage
PATCH /v1/webhooks/{id}Update, pause or resume a webhook endpointwebhooks:manage
DELETE /v1/webhooks/{id}Delete a webhook endpointwebhooks:manage
POST /v1/webhooks/{id}/testSend a synthetic delivery so a partner can prove their endpointwebhooks:manage
POST /v1/webhooks/{id}/rotate-secretRotate an endpoint signing secret, with an overlap windowwebhooks:manage
GET /v1/webhook-deliveriesList webhook deliverieswebhooks:manage
POST /v1/webhook-deliveries/{id}/replayRe-send a delivery as a new delivery with a new idwebhooks:manage

What is not in the spec

Two routes exist that the generated document does not describe, and both omissions are deliberate.

  • GET /exports/:id/stream — a server-sent event stream of export progress. OpenAPI cannot model an open stream, so it is documented in prose rather than misdescribed as a request/response. Polling GET /v1/exports/:id carries identical progress and is the supported fallback.
  • /sandbox/echo/:bucket — the webhook echo. It sits outside /v1 because it takes no credential: our own dispatcher is the caller, and a webhook receiver that demanded an API key could not be a webhook receiver.

Headers

HeaderDirectionMeaning
X-Request-IdBothEchoed back if you send one, minted if you do not. Quote it to support.
X-RateLimit-LimitResponseRequests permitted in the current window.
Retry-AfterResponseSeconds to wait, on a 429.
ETagResponseOn preview.png. Send it back as If-None-Match for a 304.

Foldkit-Version and an idempotency-key header are accepted and not yet honoured. They are declared so an SDK can send them from day one; today they are inert, and we would rather say so than have you rely on behaviour that is not there.