Get the current state of a run (poll-friendly).
GET/ai-builder-api/projects/:projectId/runs/:runId
Strictly tenant- and project-scoped. A run that exists under a
different projectId (or under a different tenant entirely)
returns 404 not_found — never 403, never the run record.
This matches OWASP API1:2023 Broken Object Level Authorization
guidance: same shape for "doesn't exist" and "not yours".
Request
The API version.
v3The project's id.
Possible values: Value must match regular expression ^prj_[A-Za-z0-9_-]+$
The run's id.
Possible values: Value must match regular expression ^run_[A-Za-z0-9_-]+$
Run state.
- application/json
- Schema
- Example (auto)
Schema
The run.
The project the run belongs to.
What the run was asked to build or change.
Who sent the prompt.
The run's status.
queuedrunningdeployingreadyfailedcancelledneeds_inputInternal Spec Kit phase for the active builder run. Stream-v6 maps this to user-facing data-status.data.phase values such as planning, clarifying, coding, and building.
initconstitutionspecifyclarifyplantasksanalyzeimplementindexingbuilddeployreadyPhase-local status for the active Spec Kit phase.
queuedrunningawaiting_inputterminalThe question the run is paused on, while it waits for the creator.
When the run was created.
When the run last changed.
Convenience field equal to preview.primaryUrl. Kept for
single-service callers; multi-service callers should read
preview.services[] for per-service URLs. This is the
durable customer-facing preview URL produced after a
successful build/deploy, not the live sandbox edit URL.
Where to see what the run built.
Deprecated 2026-05-17. Will be removed 2026-11-17.
Use sandboxUrl instead — same value, accurate name.
Misleadingly named: this is the SANDBOX URL (the agent's
HMR/edit workshop), not the customer-facing preview. The
customer preview lives at previewUrl. Co-populated with
sandboxUrl for the deprecation window; readers should
migrate to sandboxUrl.
Deprecated 2026-05-17. Will be removed 2026-11-17.
Use sandboxStatus instead.
startingreadyfailedstoppedURL of the project sandbox runtime.
This is the agent's compile + HMR workshop — NOT the
customer-facing preview. The customer preview is at
previewUrl, which surfaces in the builder UI's right
pane after the deploy gate succeeds.
Current state of the sandbox dev server.
startingreadyfailedstoppedURL of the production ("Published") runtime service for this project.
Populated when the project has
been explicitly published at least once. Distinct from
previewUrl/preview.primaryUrl, which always point at the
durable customer preview service that auto-updates on every
successful agent run. Absent for projects that have never
been published — the FE renders "Not published" in that case.
ISO-8601 timestamp of the most recent publish, snapshotted
onto the run at the moment it reached ready. Used by the
FE to render staleness like "Last published 5 hours ago".
Number of successful (status=ready) runs completed since
the project was last published. Reset to 0 by publish.
Snapshotted onto each ready run so the FE can render a
staleness indicator without an extra round-trip. Absent
for projects that have never been published.
Possible values: >= 0
AI-generated 1-line checkpoint description, snapshotted onto
the run record at setStatus("ready") time. Sourced from
the agent's completion narrator event when present,
otherwise falls back to a deterministic prompt-derived
stub. Read by Timeline + chat UI so users see "what
changed in this checkpoint" at a glance. Absent on
non-terminal or legacy runs.
Image of the primary service.
Digest of the primary service's image.
Why the run failed, in one line.
Structured failure taxonomy for a terminated run. Set in
tandem with failureMessage (which is the human-readable
derivation). Discriminated by category; consumers should
branch on category + code to render an actionable hint
instead of a generic "Internal error".
Reproducibility/debug metadata selected during run setup.
{
"runId": "run_8f3c2a91",
"projectId": "prj_5f0c2a3e",
"prompt": "Add a page listing upcoming events",
"promptAuthor": {
"id": "usr_9a8b7c",
"name": "Jane Doe",
"avatarUrl": "https://images.example.com/avatars/jane.png"
},
"status": "queued",
"phase": "plan",
"phaseStatus": "running",
"awaitingQuestion": {
"capId": "cap_portal_modules",
"question": "Which areas should your portal have?",
"choices": [
"Courses",
"Communities"
],
"form": {
"kind": "record_fields",
"recordType": {
"label": "Policy",
"exists": false
},
"existingFields": [
{
"label": "Policy number",
"type": "TEXT",
"shown": true
}
],
"fields": [
{
"label": "Renewal date",
"type": "DATE"
}
],
"edit": true,
"types": [
{
"value": "TEXT",
"label": "Single line"
}
]
},
"details": "Your portal will use the Courses and Communities modules.",
"preview": {},
"multiSelect": false,
"allowOther": true,
"input": "short_text",
"placeholder": "e.g. Weekly yoga classes",
"askedAt": "2026-10-15T09:32:00.000Z"
},
"createdAt": "2026-10-15T09:30:00.000Z",
"updatedAt": "2026-10-15T09:41:12.000Z",
"previewUrl": "https://preview.example.com/my-portal",
"preview": {
"primaryUrl": "https://preview.example.com/my-portal",
"services": [
{
"name": "web",
"url": "https://preview.example.com/my-portal"
}
]
},
"sandboxUrl": "https://sbx-prj-5f0c2a3e.example.com",
"sandboxStatus": "ready",
"publishedUrl": "https://my-portal.example.com",
"publishedAt": "2026-10-14T18:02:00.000Z",
"runsSinceLastPublish": 2,
"summary": "Added an events page",
"imageUri": "registry.example.com/apps/web:run_8f3c2a91",
"imageDigest": "sha256:3b1f0c9e2d7a",
"failureMessage": "The build failed: pages/events.vue has a type error",
"failure": {
"category": "build",
"code": "build_failed",
"retryable": false,
"responsibleModule": "runtime",
"userMessage": "Describe the page you want in a sentence or two.",
"details": "No stack manifest for this template",
"provider": "anthropic",
"attempt": 3,
"failureHead": "pages/events.vue(12,5): error TS2339",
"failureTail": "Found 1 error.",
"cause": "The sandbox did not become ready in time",
"phase": "plan",
"stack": "TypeError: Cannot read properties of undefined",
"message": "The preview could not start."
},
"metadata": {
"generationFailure": {
"code": "provider_transient",
"retryable": true,
"source": "provider",
"detail": "The model provider was overloaded"
},
"failedWorkspace": {
"preservedAt": "2026-10-15T09:45:00.000Z",
"uploadedFiles": 128,
"durationMs": 2140
}
}
}