> 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/legacy-inference-and-analytics/inference-v0/post-inference-v0-run-org_id-flow_id.md).

# POST /inference/v0/run/{org\_id}/{flow\_id}

## Run Deployed Flow

> Run a flow and get the result.\
> \
> \*\*How to use\*\*\
> \
> Send the workflow input map as the entire JSON body. The flow must be published. Omit \`execution\_mode\` for inline JSON or SSE; request \`remote\` without SSE for a 202 background handle. Do not resend after a timeout without checking whether execution started.\
> \
> \*\*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.\
> \
> \`\`\`json\
> {\
> &#x20; "in-0": "Summarize our refund policy"\
> }\
> \`\`\`

````json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"tags":[{"name":"endpoint-runDeployedFlow"}],"servers":[{"url":"https://api.stack-ai.com","description":"Hosted API. Use your deployment-specific origin for private installations."}],"security":[{"LegacyAPIKeyBearer":[]}],"components":{"securitySchemes":{"LegacyAPIKeyBearer":{"type":"http","scheme":"bearer","description":"Personal API key or the endpoint-specific legacy organization API key. Legacy inference uses the public organization key; legacy analytics uses the private organization key. This is not a password-grant login flow."}},"schemas":{"ExecutionMode":{"type":"string","enum":["in-memory","remote"],"title":"ExecutionMode","description":"Workflow execution modes.\n\nThese are implementation-agnostic names exposed to clients."},"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":{"/inference/v0/run/{org_id}/{flow_id}":{"post":{"tags":["endpoint-runDeployedFlow"],"summary":"Run Deployed Flow","description":"Run a flow and get the result.\n\n**How to use**\n\nSend the workflow input map as the entire JSON body. The flow must be published. Omit `execution_mode` for inline JSON or SSE; request `remote` without SSE for a 202 background handle. Do not resend after a timeout without checking whether execution started.\n\n**Authentication and permissions**\n\nRequired permissions: `projects.run`. Resource and owner access checks also apply.\n\n**Prepare request.json**\n\nSave 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.\n\n```json\n{\n  \"in-0\": \"Summarize our refund policy\"\n}\n```","operationId":"runDeployedFlow","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","description":"The flow ID. [Learn how to get it](/docs/api-reference/how-to-get-flow-id).","title":"Flow Id"},"description":"The flow ID. [Learn how to get it](/docs/api-reference/how-to-get-flow-id)."},{"name":"version","in":"query","required":false,"schema":{"type":"integer","description":"Version of the flow","default":-1,"title":"Version"},"description":"Version of the flow"},{"name":"verbose","in":"query","required":false,"schema":{"type":"boolean","description":"Return the full model","default":true,"title":"Verbose"},"description":"Return the full model"},{"name":"delta","in":"query","required":false,"schema":{"type":"boolean","description":"Stream deltas instead of full output. Only applies when streaming (Accept: text/event-stream).","default":true,"title":"Delta"},"description":"Stream deltas instead of full output. Only applies when streaming (Accept: text/event-stream)."},{"name":"prefix","in":"query","required":false,"schema":{"type":"boolean","description":"Add a prefix to the output. Only applies when streaming (Accept: text/event-stream).","default":false,"title":"Prefix"},"description":"Add a prefix to the output. Only applies when streaming (Accept: text/event-stream)."},{"name":"execution_mode","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ExecutionMode"},{"type":"null"}],"description":"Set to 'remote' to run durably in the background and receive a 202 with a WebSocket handle. Omit for inline execution (JSON, or SSE when the request sends Accept: text/event-stream).","title":"Execution Mode"},"description":"Set to 'remote' to run durably in the background and receive a 202 with a WebSocket handle. Omit for inline execution (JSON, or SSE when the request sends Accept: text/event-stream)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Input parameters for the flow","title":"Inputs"}}}},"responses":{"200":{"description":"The run-result envelope (same InferenceResponse shape as resume): a terminal state + outputs, or state=PAUSED with the pause payload when the run pauses on a human-in-the-loop step. With Accept: text/event-stream the run streams back as SSE InferenceResponse frames instead.","content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"202":{"description":"Returned with execution_mode=remote and no Accept: text/event-stream: the run executes durably in the background; the body carries the run_id and a WebSocket handle to stream updates. Poll GET /runs/{org_id}/{run_id} for the terminal state."},"403":{"description":"Project is not published"},"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/legacy-inference-and-analytics/inference-v0/post-inference-v0-run-org_id-flow_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.
