Canvases
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
POST | |
POST | |
POST | |
GET | |
GET | |
POST | |
GET | |
POST | |
GET | |
GET | |
GET | |
GET | |
POST |
Create canvases report error
Report a runtime error observed while rendering a canvas build.
Files the report in the authoring task's thread (deduped per build and
error type) so the canvas's agent can be asked to fix it. Reports never
start an agent run by themselves — dispatch is request_fix. Only the
error class crosses the server; full messages and stacks stay
client-side because rendering sessions can carry viewer data.
Required API key scopes
canvas:writePath parameters
- idstring
Request parameters
- build_idstring
- error_typestring
Response
Example request
POST /api /projects /:project_id /canvases /:id /report_errorExample response
Status 202
Status 404 Build not found for this canvas.
Create canvases request agent
Route a viewer-approved change request to the canvas's authoring task.
Required API key scopes
canvas:writetask:writePath parameters
- idstring
Request parameters
- promptstring
Response
Example request
POST /api /projects /:project_id /canvases /:id /request_agentExample response
Status 202
Status 403 Agent requests are not declared or the caller is a sandbox.
Status 409 The canvas has no authoring task.
Status 429 The request was denied for compute: the team's quota is exhausted (retry later), or the organization is deactivated (not retryable).
Create canvases request fix
Wake the canvas's authoring agent to fix a failing build or runtime error.
Starts (or signals) an agent run on the authoring task, instructed to stage the fix as a draft the user reviews and promotes. This is the human-initiated dispatch step behind error reports; it spends agent compute, so it never fires automatically, and only the authoring task's creator may dispatch — the run executes with their credentials.
Required API key scopes
canvas:writetask:writePath parameters
- idstring
Request parameters
- build_idstring
- error_typestring
Response
Example request
POST /api /projects /:project_id /canvases /:id /request_fixExample response
Status 202
Status 403 The caller is a sandbox (agents stage fixes directly as drafts), or is not the authoring task's creator (only the creator can dispatch a run under their credentials).
Status 404 Build not found for this canvas.
Status 409 The canvas has no authoring task to route the fix to.
Status 429 The team's compute quota is exhausted; retry later.
Create canvases revert
Move the canvas's head back to an existing source version and rebuild it.
Required API key scopes
canvas:writePath parameters
- idstring
Request parameters
- version_idstring
- expected_current_version_idstring | null
Response
Example request
POST /api /projects /:project_id /canvases /:id /revertExample response
Status 200
Status 429 The team's build capacity is exhausted; retry shortly.
Retrieve canvases source
Read the canvas's source project and its current_version_id.
Always call this before editing: edit the returned files, then publish
the complete project passing the returned version id as
expected_current_version_id so concurrent edits are not overwritten.
?version_id= reads a historical version instead of the head.
Required API key scopes
canvas:readPath parameters
- idstring
Query parameters
- version_idstring
Response
Example request
GET /api /projects /:project_id /canvases /:id /sourceExample response
Status 200
Retrieve canvases state
Read the canvas's runtime key-value state (the ph.state store).
Returns shared entries plus the authenticated user's own user-scoped entries — never another user's.
Required API key scopes
canvas:readPath parameters
- idstring
Query parameters
- cursorstring
- keystring
- key_prefixstring
- keys_onlybooleanDefault:
false - limitinteger
- offsetintegerDefault:
0 - scopestringOne of:
"user""shared"
Response
Example request
GET /api /projects /:project_id /canvases /:id /stateExample response
Status 200
Status 400 Invalid query, or a malformed cursor.
Status 403 Canvas state requires an authenticated user.
Create canvases state
Write one key of the canvas's runtime state, or delete it with a null value.
Required API key scopes
canvas:writePath parameters
- idstring
Request parameters
- scope
- keystring
- value
Response
Example request
POST /api /projects /:project_id /canvases /:id /state /setExample response
Status 200
Status 204 The key was deleted (value was null).
Status 400 The value or the scope's key count exceeds the state bounds.
Status 403 The scope is not declared in the canvas's capabilities, or the caller is a sandbox.
Retrieve canvases state value
Canvases: agent-built sandboxed browser apps, filed into channels.
Source is versioned per publish and built server-side; the canvas app renders the published build's artifact from the isolated artifact origin.
Required API key scopes
canvas:readPath parameters
- idstring
Query parameters
- keystring
- limitintegerDefault:
12000 - offsetintegerDefault:
0 - revisionstring
- scopestringOne of:
"user""shared"
Response
Example request
GET /api /projects /:project_id /canvases /:id /state /valueExample response
Status 200
Status 400 Invalid query, or the offset exceeds the value length.
Status 404 No readable value for this scope and key.
Status 409 The value changed. Restart from offset zero.
Create canvases validate
Validate a candidate source project without publishing it. Side-effect free.
Required API key scopes
canvas:readPath parameters
- idstring
Request parameters
- project
Response
Example request
POST /api /projects /:project_id /canvases /:id /validateExample response
Status 200
Retrieve canvases versions
The canvas's published source-version history, newest first (metadata only).
Drafts are excluded: they are staged versions that have never been the
head, so they are not part of the undo/revert timeline. Fetch a draft's
files with source?version_id= to preview it before promoting.
Required API key scopes
canvas:readPath parameters
- idstring
Query parameters
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /canvases /:id /versionsExample response
Status 200
Retrieve canvases view
Everything needed to open the canvas, in one round trip.
Returns the record, the live build (with its signed artifact URL), and — only when there is nothing built to render — the head source project (freeform/component) or the layout document (grid). Send the response's ETag back as If-None-Match to revalidate without a body.
Required API key scopes
canvas:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /canvases /:id /viewExample response
Status 200
Status 304 Not modified — the client's cached view payload is current.
Retrieve canvases actions
List the action registry: every verb a canvas may declare and invoke.
Response
Example request
GET /api /projects /:project_id /canvases /actionsExample response
Status 200
Retrieve canvases connectors
List the connector catalog: every provider and tool a canvas may declare, with the caller's connection state.
Authoring agents read this to write ph.connectors.call sites and the matching capabilities.connectors declarations. Sandbox tokens receive only static native tools, with no connection lookup or MCP installation data.
Required API key scopes
canvas:readQuery parameters
- mcp_hostsstring
Response
Example request
GET /api /projects /:project_id /canvases /connectorsExample response
Status 200
Status 403 Connectors are not enabled for this team.
Create canvases home
Get or provision the caller's home canvas.
Idempotent: returns the user's existing home canvas, or creates a grid canvas in their personal channel and points their home preference at it. The home surface calls this on open.
Required API key scopes
canvas:writeResponse
Example request
POST /api /projects /:project_id /canvases /home










