> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/stackai-api/rest-api-v2/runs/get-v2-runs-run_id.md).

# GET /v2/runs/{run\_id}

## Get Run

> Get one of the organization's runs with its full payload.\
> \
> \*\*How to use\*\*\
> \
> Poll this after creation and inspect data.status. A 200 response can describe a failed run. The input/output may be null, and logging controls can block detail reads. pending\_input is only exposed when the caller can both read and resume the run.\
> \
> \*\*Authentication and permissions\*\*\
> \
> Required permissions: \`analytics.read\`. Resource and owner access checks also apply.

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"tags":[{"name":"endpoint-getRunV2"}],"servers":[{"url":"https://api.stack-ai.com","description":"Hosted API. Use your deployment-specific origin for private installations."}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer","description":"Personal API key (sk_...) or supported user access JWT. See Authentication and authorization for endpoint restrictions and scopes. Use exactly one Authorization header."}},"schemas":{"StackAIAPIDataResponse_RunResponseV2_":{"properties":{"response_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Code","description":"Machine-readable response code, when provided."},"meta":{"additionalProperties":true,"type":"object","title":"Meta","description":"Additional metadata","default":{}},"data":{"$ref":"#/components/schemas/RunResponseV2","description":"Data returned by the API service"}},"type":"object","required":["data"],"title":"StackAIAPIDataResponse[RunResponseV2]"},"RunResponseV2":{"properties":{"run_id":{"type":"string","format":"uuid","title":"Run Id","description":"ID of the run."},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id","description":"Project the run executed. Null for legacy runs."},"project_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Project Version","description":"Project version used for this run: -1 for a draft execution, a non-negative integer for a numbered version, or null when the version could not be determined."},"status":{"$ref":"#/components/schemas/RunStatusV2","description":"Lifecycle status of the run."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Failure message. Null when the run did not fail."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the run was recorded."},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"When execution started. Null when unknown or not yet started."},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"When execution finished. Null when unknown or not yet finished."},"run_type":{"anyOf":[{"$ref":"#/components/schemas/RunTypeV2"},{"type":"null"}],"description":"How the run was started. Null when not recorded."},"created_by":{"anyOf":[{"$ref":"#/components/schemas/RunCreatedByV2"},{"type":"null"}],"description":"Principal that started the run. Null when not recorded."},"usage":{"$ref":"#/components/schemas/RunUsageV2","description":"Token usage for the run."},"parent_run_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Run Id","description":"Run that started this one. Null unless this is a sub-workflow run."},"parent_project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Project Id","description":"Project of the parent run. Null unless this is a sub-workflow run."},"input":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Input","description":"Inputs the run was started with."},"output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Output","description":"Outputs the run produced."},"citations":{"anyOf":[{"items":{"$ref":"#/components/schemas/RunCitationV2"},"type":"array"},{"type":"null"}],"title":"Citations","description":"Sources cited by the run. Null when the run recorded none."},"pending_input":{"anyOf":[{"$ref":"#/components/schemas/RunPendingInputV2"},{"type":"null"}],"description":"Ask-human input for a paused run. Null unless the caller can both read and resume it."}},"additionalProperties":false,"type":"object","required":["run_id","project_id","status","error","created_at","started_at","completed_at","run_type","created_by","usage","parent_run_id","parent_project_id","input","output","citations","pending_input"],"title":"RunResponse","description":"A run with its input, output, citations, and token usage."},"RunStatusV2":{"type":"string","enum":["queued","running","paused","succeeded","failed","cancelled"],"title":"RunStatusV2","description":"Lifecycle status exposed by the Runs v2 API."},"RunTypeV2":{"type":"string","enum":["workflow_builder","form","batch","chat_assistant","agent_assistant","trigger","scheduled","sub_workflow","api","eval","unknown"],"title":"RunTypeV2","description":"How the run was started. Unrecognized types appear as `unknown`."},"RunCreatedByV2":{"properties":{"type":{"$ref":"#/components/schemas/RunCreatedByTypeV2","description":"Kind of principal that started the run."},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"ID of the principal identified by `type`: the user ID for `user` and `personal_api_key`, the organization ID for `org_api_key`, the end-user ID for `end_user`. Null if no ID is available."}},"additionalProperties":false,"type":"object","required":["type","id"],"title":"RunCreatedBy","description":"Who or what started the run."},"RunCreatedByTypeV2":{"type":"string","enum":["user","personal_api_key","org_api_key","system","end_user","unknown"],"title":"RunCreatedByTypeV2","description":"Type of user, API key, or system that started the run."},"RunUsageV2":{"properties":{"total_tokens":{"type":"integer","title":"Total Tokens","description":"Tokens used across every model call in the run."},"details":{"items":{"$ref":"#/components/schemas/RunUsageDetailV2"},"type":"array","title":"Details","description":"Usage aggregated per model and connection; models may appear more than once."}},"additionalProperties":false,"type":"object","required":["total_tokens","details"],"title":"RunUsage","description":"Total and per-model token usage for a run."},"RunUsageDetailV2":{"properties":{"provider":{"type":"string","title":"Provider","description":"Stable lowercase identifier of the model provider, e.g. `openai`."},"model_id":{"type":"string","title":"Model Id","description":"Identifier of the model the provider was called with."},"connection_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Connection Id","description":"ID of the connection used for the model calls. Null if no connection ID is available."},"input_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Input Tokens","description":"Tokens sent to the model. Null when the provider reported only a total."},"output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Tokens","description":"Tokens returned by the model. Null when the provider reported only a total."}},"additionalProperties":false,"type":"object","required":["provider","model_id","connection_id","input_tokens","output_tokens"],"title":"RunUsageDetail","description":"Token usage for one provider, model, and connection."},"RunCitationV2":{"properties":{"knowledge_base_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Knowledge Base Id","description":"Knowledge base the cited source belongs to, if any."},"resource_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Resource Id","description":"Knowledge base resource that was cited, if any."},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url","description":"External link to the cited source, if available."},"source_type":{"$ref":"#/components/schemas/RunCitationSourceTypeV2","description":"Kind of source that was cited."},"position":{"anyOf":[{"$ref":"#/components/schemas/RunCitationPositionV2"},{"type":"null"}],"description":"Where in the source the cited chunk sits. Null when not recorded."}},"additionalProperties":false,"type":"object","required":["knowledge_base_id","resource_id","source_url","source_type","position"],"title":"RunCitation","description":"Source cited by a run."},"RunCitationSourceTypeV2":{"type":"string","enum":["knowledge_base","website","document","other"],"title":"RunCitationSourceTypeV2","description":"Type of source cited by the run."},"RunCitationPositionV2":{"properties":{"page_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page Index","description":"Zero-based page the chunk was read from, if recorded."},"chunk_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Chunk Index","description":"Zero-based index of the chunk within the source, if recorded."},"page_number":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page Number","description":"Page number as printed in the source, if known."}},"additionalProperties":false,"type":"object","required":["page_index","chunk_index","page_number"],"title":"RunCitationPosition","description":"Position of a citation within its source."},"RunPendingInputV2":{"properties":{"question":{"type":"string","title":"Question","description":"Question shown to the human responder."},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context","description":"Additional context, if supplied."},"response_type":{"$ref":"#/components/schemas/RunPauseResponseTypeV2","description":"Expected answer kind."},"choices":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Choices","description":"Ordered choices, when supplied."},"resume_token":{"type":"string","title":"Resume Token","description":"Secret token authorizing this pause's resume."},"resume_token_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resume Token Expires At","description":"When the resume token expires; this is not the pause timeout."}},"additionalProperties":false,"type":"object","required":["question","context","response_type","choices","resume_token","resume_token_expires_at"],"title":"RunPendingInput","description":"Ask-human input awaiting a response from a caller who may run the project."},"RunPauseResponseTypeV2":{"type":"string","enum":["text","approval","choice","unknown"],"title":"RunPauseResponseTypeV2","description":"Kind of answer requested by a paused ask-human step."},"StackAIAPIErrorResponse":{"properties":{"response_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Code","description":"Machine-readable response code, when provided."},"meta":{"additionalProperties":true,"type":"object","title":"Meta","description":"Additional metadata","default":{}},"errors":{"items":{"$ref":"#/components/schemas/StackAIAPIError"},"type":"array","title":"Errors","description":"List of errors"},"detail":{"items":{"type":"string"},"type":"array","title":"Detail","description":"Human-readable error messages. Use the HTTP status and error metadata to decide how to handle the failure.","readOnly":true}},"type":"object","required":["detail"],"title":"StackAIAPIErrorResponse","description":"Error response model with status code and error list."},"StackAIAPIError":{"properties":{"message":{"type":"string","title":"Message","description":"Message describing the error"}},"type":"object","required":["message"],"title":"StackAIAPIError","description":"Error detail model."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/runs/{run_id}":{"get":{"tags":["endpoint-getRunV2"],"summary":"Get Run","description":"Get one of the organization's runs with its full payload.\n\n**How to use**\n\nPoll this after creation and inspect data.status. A 200 response can describe a failed run. The input/output may be null, and logging controls can block detail reads. pending_input is only exposed when the caller can both read and resume the run.\n\n**Authentication and permissions**\n\nRequired permissions: `analytics.read`. Resource and owner access checks also apply.","operationId":"getRunV2","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StackAIAPIDataResponse_RunResponseV2_"}}}},"400":{"description":"Invalid run ID.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StackAIAPIErrorResponse"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StackAIAPIErrorResponse"}}}},"403":{"description":"Analytics read permission required or run logging disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StackAIAPIErrorResponse"}}}},"404":{"description":"Run not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StackAIAPIErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/stackai-api/rest-api-v2/runs/get-v2-runs-run_id.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
