POST /v2/runs
Start a run of a project version and return its current persisted state.
How to use
Send project_id and singular input. A 201 creates a run but does not mean it succeeded. Persist data.run_id, then poll with analytics.read. Omitted/null project_version selects published, -1 selects draft, and a nonnegative integer pins a snapshot. A 500 can occur after execution starts; reconcile instead of automatically retrying.
Authentication and permissions
Required permissions: projects.run. Resource and owner access checks also apply.
Prepare request.json
Save the example body below as request.json for the curl sample. Replace example IDs, node keys, and dynamic configuration with values for your organization; these are illustrative, not pre-existing resources.
{
"project_id": "YOUR_PROJECT_ID",
"input": {
"in-0": "Summarize our refund policy"
},
"project_version": 1
}Personal API key (sk_...) or supported user access JWT. See Authentication and authorization for endpoint restrictions and scopes. Use exactly one Authorization header.
Body for starting a project run.
Project version to run. Omit or use null for the current published version, use -1 for the current draft, or use a non-negative version for an exact snapshot.
Run created. Execution is asynchronous; poll the Location URL for progress.
Machine-readable response code, when provided.
Invalid request body.
Authentication required.
Organization usage limit reached.
Project run permission or credential scope required.
Project or requested project version not found, project not published, or run logging disabled.
Validation Error
Run start or response retrieval failed; execution may already have started.
Run reservation failed; execution was not dispatched.
curl --fail-with-body -sS \
"$STACKAI_BASE_URL/v2/runs" \
-H "Authorization: Bearer $STACKAI_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @request.json{
"data": {
"run_id": "5f4c3b2a-1111-4111-8111-123456789abc",
"project_id": "YOUR_PROJECT_ID",
"project_version": 1,
"status": "queued",
"error": null,
"created_at": "2026-10-05T12:00:00Z",
"started_at": null,
"completed_at": null,
"run_type": "api",
"created_by": null,
"usage": {
"total_tokens": 0,
"details": []
},
"parent_run_id": null,
"parent_project_id": null,
"input": {
"in-0": "Summarize our refund policy"
},
"output": null,
"citations": null,
"pending_input": null
}
}Last updated
Was this helpful?

