Skip to content
PuniDocs
Open Puni

API


The HTTP routes behind the studio and the command line: projects, transfers, assets, links, devices, agent turns, search and films.

The command line and the MCP server are clients of these routes. They live at https://puni.design/api and answer JSON. Prefer the command line or the MCP tools when one fits; the routes are here for the cases they do not cover.

#Signing requests

Send a token as a bearer: Authorization: Bearer puni_access_…. Tokens from Settings, from the command line's sign-in and from the OAuth door are the same kind. The route exchanges one for a short session on every call. The browser signs in with its own session cookie.

#Scenes

RouteMethodDoes
/api/projectsGET, POSTList your scenes; create one from a document
/api/projects/{id}GET, PATCHRead a scene with its revision (?metadata=1 for its summary and documentUrl); rename or archive
/api/projects/{id}/checkpointsGET, POSTList checkpoints; keep one now
/api/projects/{id}/coverPOSTSet the cover for a saved document hash
/api/projects/{id}/sharesGET, POSTList links; make one for a revision
/api/projects/transfersPOSTBegin and finish a scene upload
/api/assetsPOSTUpload a small asset inline
/api/assets/transfersPOSTBegin and finish a direct asset upload
/api/assets/{id}GETRead an asset you own

Writes carry the revision they expect. A stale revision answers 409.

RouteMethodDoes
/api/share/{id}GETThe link's public metadata
/api/share/{id}/documentGETThe saved document the link points at
/api/share/{id}/assets/{hash}GETAn asset that document references
/api/share/{id}/copyPOSTRemix into the caller's library
/api/share/{id}/viewPOSTCount a view, once per session

#Devices and agents

RouteMethodDoes
/api/device/connect, exchange, session, revokePOSTThe sign-in flow the command line runs
/api/device/status, sessionsGETA pending code; your connected devices
/.well-known/oauth-protected-resource, oauth-authorization-serverGETHow a connector finds the sign-in door
/api/oauth/authorizeGETStart connector authorization; consent is a Puni page
/api/oauth/register, token, revokePOSTRegister a client, exchange a grant, or revoke access
/api/agent/turnsGET, POSTList turns with ?projectId={id}, or deliver one for a revision; no connected runner returns PUNI_RUNNER_REQUIRED
/api/agent/turns?turnId={id}GETOne turn with its events
/api/agent/turns/{id}/cancelPOSTStop a turn; edits already saved remain
/api/projects/{id}PATCHLand one command batch on the revision you read, with a label; the scene keeps a checkpoint
/api/agent/runnerGET, POSTRead presence; register or unregister a connected runner
/api/agent/runner/turnsGETList the signed-in owner's runner-delivered turns
/api/agent/runner/turns/[id]POSTClaim, heartbeat, complete, fail or release a turn with its runner capability
/api/mcpGET, POST, DELETEThe MCP server

#Search, films, runtime

RouteMethodDoes
/api/library/searchPOSTKeyword or semantic search of your scenes
/api/films/*GET, POSTFilm job uploads and downloads, when enabled
/api/runtimeGETThe app's builds, for puni runtime

#Errors

Product errors use JSON with an error sentence to show. A catalogued refusal adds a code to branch on and its detail, such as the revision a 409 conflict is now at. A 409 also carries conflict: true. A server fault answers 5xx with a code too, such as BACKEND_UNAVAILABLE, so a client knows to retry rather than change its request. The OpenAPI document lists every code and every status a refusal can answer with, including 422, 502 and 504. OAuth errors use error and may include error_description.

Limits: a scene document is 32 MB and an asset 64 MB. Ordinary MCP requests are capped at 768,000 bytes. upload_asset admits a larger base64 envelope for up to 8 MiB of decoded bytes; SVG retains its 2 MiB format cap. puni_compare_reference also admits a larger envelope for its bounded image input. Hosting proxies can impose smaller limits.

Inline scene and asset API transfers have a 4 MB budget. These transfer limits are separate from the MCP upload exception. Save a larger scene through /api/projects/transfers and upload a larger asset through /api/assets/transfers. A saved scene or checkpoint larger than that is refused inline with SCENE_READ_BY_URL: read it with ?metadata=1, download the documentUrl it names, and check the bytes against its sha256.

#OpenAPI

https://puni.design/api/openapi.json describes every route above as OpenAPI 3.1, generated from the routes and kept honest by a test. Point a client generator or an agent framework at it when neither MCP nor the command line fits.

Read MCP tools for the contract agents use first.

Was this useful?