> For the complete documentation index, see [llms.txt](https://docs.pletor.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pletor.ai/documentation/api-reference/apps/app-runs-v1-deprecated.md).

# App runs v1 (deprecated)

Deprecated: v2 runs apps at \`POST /api/public/v2/apps/{app}/runs\`, with inputs, settings and outputs keyed by slug. These endpoints keep working unchanged. App runs are executions of apps. The workflow mirrors runs: discover an app, inspect its required inputs, upload any necessary assets, create a run with matching inputs, poll its status, and retrieve the app's curated outputs once complete.

Create, monitor, and cancel app executions.

## List App Runs

> List app execution runs with filtering options.\
> \
> This endpoint returns a paginated list of app execution runs with their current\
> status and basic metadata, newest first. It covers every app run in the caller's\
> organization, whoever started it. Flow runs are listed separately via\
> \`GET /runs\`.\
> \
> \*\*Filtering Options:\*\*\
> \- \`status\`: Filter by execution status (in\_progress, completed, failed, canceled)\
> \- \`external\_id\`: Filter to runs you tagged with this reference id at creation.\
> &#x20; Use this to check whether you already started a run for a given item before\
> &#x20; starting another.\
> \
> \*\*Pagination Parameters:\*\*\
> \- \`limit\`: Maximum number of items to return (default: 20, max: 100)\
> \- \`cursor\`: Cursor for pagination (optional)\
> \
> \*\*Response:\*\*\
> \- \`data\`: List of app-run summaries with basic information. Summaries carry no\
> &#x20; \`inputs\`, \`results\` or \`pending\_reviews\` — fetch \`GET /app-runs/{run\_id}\`\
> \- \`has\_more\`: Indicates if there are more results available\
> \- \`next\_cursor\`: Cursor for the next page of results\
> \
> \*\*Error Codes:\*\*\
> \- \`401\`: Missing or invalid API key or Bearer token\
> \- \`403\`: The API key is bound to a different organization than \`X-Organization-Id\`\
> \- \`422\`: Invalid \`status\` value, or \`limit\` outside 1–100\
> \- \`429\`: Rate limit exceeded — retry after the \`Retry-After\` header

```json
{"openapi":"3.1.0","info":{"title":"Pletor - Public API","version":"2.0.0"},"tags":[{"name":"app-runs","description":"Create, monitor, and cancel app executions."}],"servers":[{"url":"/api/public"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"API key for authentication"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Cognito JWT Bearer token"}},"schemas":{"FlowRunStatus":{"type":"string","enum":["in_progress","completed","failed","canceled"],"title":"FlowRunStatus","description":"Execution status of a workflow run."},"CursorPaginatedResponse_AppRunSummary_":{"properties":{"data":{"items":{"$ref":"#/components/schemas/AppRunSummary"},"type":"array","title":"Data"},"has_more":{"type":"boolean","title":"Has More"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["data","has_more"],"title":"CursorPaginatedResponse[AppRunSummary]"},"AppRunSummary":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Unique run identifier"},"app_id":{"type":"string","format":"uuid","title":"App Id","description":"Stable ID of the app that was executed"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"Client-supplied reference id provided at creation, if any"},"status":{"$ref":"#/components/schemas/FlowRunStatus","description":"Current execution state: in_progress, completed, failed, or canceled"},"progress":{"type":"number","maximum":1,"minimum":0,"title":"Progress","description":"Fraction of the run's node executions that have completed, from 0.0 to 1.0. 1.0 once completed; 0.0 once failed or canceled","default":0},"awaiting_human_review":{"type":"boolean","title":"Awaiting Human Review","description":"True when the run has paused on one or more human review nodes. Fetch GET /app-runs/{run_id} to inspect pending reviews.","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the run was created"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"When execution started"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"When execution finished (completed, failed or canceled). Null while in_progress"},"cost":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cost","description":"Credits consumed by this run so far, summed over its node executions. Null before any node has run"}},"type":"object","required":["id","app_id","status","created_at"],"title":"AppRunSummary","description":"Lightweight app-run summary for list views."},"ApiErrorResponse":{"description":"Standard error response envelope. All API errors follow this format.","properties":{"error":{"$ref":"#/components/schemas/ApiErrorDetail","description":"Error details"}},"required":["error"],"title":"ApiErrorResponse","type":"object"},"ApiErrorDetail":{"description":"Structured details for an API error.","properties":{"code":{"$ref":"#/components/schemas/ApiErrorCode","description":"Machine-readable error code; branch on this, not on `message`"},"message":{"description":"Human-readable error description","title":"Message","type":"string"},"status":{"description":"HTTP status code of this response","title":"Status","type":"integer"},"details":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"items":{"type":"string"},"type":"array"},{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}]},"description":"Additional context. Always holds `request_id` (the response's `X-Request-Id`); `validation_error` from request validation adds `errors`, a list of `location: message` strings, and `rate_limit_exceeded` adds `retry_after`, the seconds to wait.","title":"Details","type":"object"}},"required":["code","message","status","details"],"title":"ApiErrorDetail","type":"object"},"ApiErrorCode":{"description":"Machine-readable error code, with its usual HTTP status: `invalid_input`\n400, `authentication_required` 401, `forbidden` 403, `not_found` 404,\n`conflict` 409, `validation_error` 422, `rate_limit_exceeded` 429,\n`internal_error` 500, `run_failed` 502, `service_unavailable` 503, `timeout`\n504. A 4xx status without a code of its own is sent as `invalid_input`.\n\n`plan_required`, `credit_usage_exceeded`, `user_quota_exceeded`,\n`spend_limit_exceeded`, `brain_flow_impact`, `stale_definition`,\n`flow_not_shared` and `asset_not_ready` have no status of their own and are\nsent only in the `X-Pletor-Error-Code` response header, never as `code`.","enum":["invalid_input","authentication_required","forbidden","not_found","conflict","validation_error","rate_limit_exceeded","internal_error","run_failed","service_unavailable","timeout","plan_required","credit_usage_exceeded","user_quota_exceeded","spend_limit_exceeded","brain_flow_impact","stale_definition","flow_not_shared","asset_not_ready"],"title":"ApiErrorCode","type":"string"}}},"paths":{"/v1/app-runs/":{"get":{"tags":["app-runs"],"summary":"List App Runs","description":"List app execution runs with filtering options.\n\nThis endpoint returns a paginated list of app execution runs with their current\nstatus and basic metadata, newest first. It covers every app run in the caller's\norganization, whoever started it. Flow runs are listed separately via\n`GET /runs`.\n\n**Filtering Options:**\n- `status`: Filter by execution status (in_progress, completed, failed, canceled)\n- `external_id`: Filter to runs you tagged with this reference id at creation.\n  Use this to check whether you already started a run for a given item before\n  starting another.\n\n**Pagination Parameters:**\n- `limit`: Maximum number of items to return (default: 20, max: 100)\n- `cursor`: Cursor for pagination (optional)\n\n**Response:**\n- `data`: List of app-run summaries with basic information. Summaries carry no\n  `inputs`, `results` or `pending_reviews` — fetch `GET /app-runs/{run_id}`\n- `has_more`: Indicates if there are more results available\n- `next_cursor`: Cursor for the next page of results\n\n**Error Codes:**\n- `401`: Missing or invalid API key or Bearer token\n- `403`: The API key is bound to a different organization than `X-Organization-Id`\n- `422`: Invalid `status` value, or `limit` outside 1–100\n- `429`: Rate limit exceeded — retry after the `Retry-After` header","operationId":"v1_list_app_runs_app_runs__get","deprecated":true,"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/FlowRunStatus"},{"type":"null"}],"description":"Only return runs in this status","title":"Status"},"description":"Only return runs in this status"},{"name":"external_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Only return the run created with this external_id","title":"External Id"},"description":"Only return the run created with this external_id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of items to return","default":20,"title":"Limit"},"description":"Maximum number of items to return"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination (from next_cursor)","title":"Cursor"},"description":"Cursor for pagination (from next_cursor)"},{"name":"X-Organization-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Active organization ID for multi-org support","title":"X-Organization-Id"},"description":"Active organization ID for multi-org support"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorPaginatedResponse_AppRunSummary_"}}}},"422":{"description":"Validation error (`validation_error`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}}}
```

## Create App Run

> Create and start a new app execution run.\
> \
> This endpoint launches the execution of an app with the provided inputs. The\
> execution runs asynchronously, allowing you to monitor progress and retrieve\
> results when complete. The run executes the flow version pinned by the app's\
> latest version and starts with \`status\` \`in\_progress\`.\
> \
> \*\*Idempotency with \`external\_id\`:\*\* Optionally pass an \`external\_id\` (e.g. your\
> own order or job id). It is \*\*unique per organization\*\*: the first request with\
> a given key starts the run; any later write reusing that key — including a\
> dropped-response retry — is rejected with \*\*\`409 conflict\`\*\* instead of starting\
> (and charging) a duplicate. To fetch the run a key already created, use\
> \`GET /app-runs?external\_id=...\`. The id is echoed on every app-run response.\
> \
> \- Scope: per organization, across \*\*all\*\* runs (flow and app share the key\
> &#x20; space) and \*\*all\*\* statuses — a key, once used, stays used.\
> \- On \`409\`, do \*\*not\*\* keep retrying the create; \`GET /app-runs?external\_id=\` to\
> &#x20; retrieve the existing run. To start a genuinely new run, use a new \`external\_id\`.\
> \
> \*\*How to Build Inputs:\*\*\
> \
> 1\. \*\*First, get app details\*\*: Call \`GET /apps/{app\_id}\` to retrieve the app\
> &#x20;  configuration.\
> 2\. \*\*Examine the \`inputs\` array\*\*: Each object defines what input the app expects:\
> &#x20;  \- \`id\`: Use this as the \`id\` in your input object\
> &#x20;  \- \`type\`: text, image, video, audio, or file\
> &#x20;  \- \`required\`: whether the input is mandatory\
> &#x20;  \- \`options\` / \`min\_selections\` / \`max\_selections\`: constraints for fixed-set inputs\
> \
> \*\*Text Inputs:\*\* a string, or a list of strings (each string counts as one\
> selection against \`min\_selections\` / \`max\_selections\`; with \`options\`, each\
> must be one of the listed labels).\
> \`\`\`json\
> {"id": "text\_input\_node\_id", "value": "Your text content here"}\
> \`\`\`\
> \
> \*\*Asset Inputs\*\* (image / video / audio / file): an object with \`asset\_ids\`\
> (a bare list of asset IDs is also accepted). With \`options\`, each ID must be\
> one of the listed asset IDs.\
> \`\`\`json\
> {"id": "image\_input\_node\_id", "value": {"asset\_ids": \["uuid1", "uuid2"]}}\
> \`\`\`\
> Upload assets first via \`POST /assets/upload\` to get the UUIDs.\
> \
> A brand used by the app's flow is not an input: it is fixed on the flow and\
> cannot be passed per run.\
> \
> \*\*Example:\*\*\
> \`\`\`json\
> {\
> &#x20;   "app\_id": "550e8400-e29b-41d4-a716-446655440000",\
> &#x20;   "inputs": \[\
> &#x20;       {"id": "uuid-1", "value": "Create a marketing banner for a tech startup"}\
> &#x20;   ]\
> }\
> \`\`\`\
> \
> \*\*Curated contract:\*\* only the inputs advertised by \`GET /apps/{app\_id}\` are\
> accepted. Unknown input ids, missing required inputs, and values that violate an\
> input's \`options\` / \`min\_selections\` / \`max\_selections\` are rejected with \`400\`.\
> The run's \`results\` contain only the app's curated outputs — never the\
> underlying flow's internal nodes.\
> \
> \*\*Credits:\*\* the balance is not checked when the run is created. A run that\
> exhausts the organization's credits or the user's quota fails with\
> \`failure\_reason\` \`insufficient\_credits\`.\
> \
> \*\*Response:\*\*\
> \- AppRun object with execution details and initial status\
> \- Use \`id\` to monitor progress via \`GET /app-runs/{run\_id}\`\
> \
> \*\*Error Codes:\*\*\
> \- \`400\`: Invalid input format, unknown input id, missing required inputs, values\
> &#x20; outside constraints, or an app whose flow has validation errors or no flow\
> &#x20; definition\
> \- \`401\`: Missing or invalid API key or Bearer token\
> \- \`403\`: The API key is bound to a different organization than \`X-Organization-Id\`\
> \- \`404\`: App not found or not accessible\
> \- \`409\`: \`external\_id\` already used by another run in this organization\
> \- \`422\`: Malformed request body (e.g. \`external\_id\` over 255 characters), or\
> &#x20; inputs that a node of the flow would reject before running\
> \- \`429\`: Rate limit exceeded — retry after the \`Retry-After\` header

````json
{"openapi":"3.1.0","info":{"title":"Pletor - Public API","version":"2.0.0"},"tags":[{"name":"app-runs","description":"Create, monitor, and cancel app executions."}],"servers":[{"url":"/api/public"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"API key for authentication"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Cognito JWT Bearer token"}},"schemas":{"AppRunCreateRequest":{"properties":{"app_id":{"type":"string","format":"uuid","title":"App Id","description":"Stable ID of the app to execute"},"inputs":{"items":{"$ref":"#/components/schemas/RunInput"},"type":"array","title":"Inputs","description":"Inputs for the app, keyed by the `id`s listed in GET /apps/{id}. Every required input must be present; unknown ids are rejected with 400"},"settings":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"},{"type":"integer"},{"type":"number"}]},"type":"object","title":"Settings","description":"Setting values keyed by the setting `id`s listed in GET /apps/{id}. Omitted settings use their default; unknown ids and values outside `allowed` are rejected with 400"},"outputs":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Outputs","description":"Output ids to produce, from the `outputs` listed in GET /apps/{id}. Omitted produces every output. Required outputs are always produced; leaving an optional one out skips the steps only it needs, and their cost. Unknown ids are rejected with 400"},"external_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"External Id","description":"Optional client-supplied reference id (e.g. your order or job id, max 255 chars). Unique per organization: reusing one returns 409 conflict — so a dropped-response retry never creates a duplicate. Echoed on every app run and filterable via GET /app-runs?external_id= to fetch it. Use a new id per run."}},"type":"object","required":["app_id"],"title":"AppRunCreateRequest","description":"Request to create and start a new app execution run."},"RunInput":{"properties":{"id":{"type":"string","title":"Id","description":"ID of the input this value fills, as listed in the `inputs` of the flow or app"},"value":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"}],"title":"Value","description":"Input value. Text inputs take a string, or a list of strings. Image, video, audio and file inputs take {\"asset_ids\": [\"uuid\", ...]} (a bare list of asset IDs is also accepted). Upload files first via POST /assets/upload. When read back from a stored run, text values come back as a list of strings and asset values as {\"asset_ids\": [...]}."}},"type":"object","required":["id","value"],"title":"RunInput","description":"Represents an input provided to a run.\n\nShared by runs and app runs: both pipelines accept the same wire shape."},"AppRun":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Unique run identifier"},"app_id":{"type":"string","format":"uuid","title":"App Id","description":"Stable ID of the app being executed"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"Client-supplied reference id provided at creation, if any"},"status":{"$ref":"#/components/schemas/FlowRunStatus","description":"Current execution state: in_progress, completed, failed, or canceled. A run starts in_progress and ends in exactly one of the others"},"progress":{"type":"number","maximum":1,"minimum":0,"title":"Progress","description":"Fraction of the run's node executions that have completed, from 0.0 to 1.0. 1.0 once completed; 0.0 once failed or canceled","default":0},"current_node":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Node","description":"Type of the node currently executing (e.g. image_generation, llm). Only present while status is in_progress"},"awaiting_human_review":{"type":"boolean","title":"Awaiting Human Review","description":"True when the run has paused on one or more human review nodes and is waiting for a decision via POST /app-runs/{run_id}/reviews/{review_id}. While true, `status` remains `in_progress`. A review left without a decision for 1 week cancels the run (`failure_reason: timeout`).","default":false},"pending_reviews":{"items":{"$ref":"#/components/schemas/PendingReview"},"type":"array","title":"Pending Reviews","description":"Human review steps currently waiting for a decision. Empty unless `awaiting_human_review` is true."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the run was created"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"When execution started"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"When execution finished (completed, failed or canceled). Null while in_progress"},"inputs":{"items":{"$ref":"#/components/schemas/RunInput"},"type":"array","title":"Inputs","description":"Inputs provided for this run. The create response echoes them as sent; later reads return them as stored — text values as a list of strings, asset values as {\"asset_ids\": [...]}"},"results":{"items":{"$ref":"#/components/schemas/RunResult"},"type":"array","title":"Results","description":"Outputs of the app's curated output nodes — never the flow's internal nodes. Each entry appears once its node has produced output, so the list fills in while in_progress and is complete once status is completed. After a human review `retry`, only the latest attempt is kept"},"cost":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cost","description":"Credits consumed by this run so far, summed over its node executions. Null before any node has run"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if the run failed or was canceled"},"failure_reason":{"anyOf":[{"$ref":"#/components/schemas/FailureReason"},{"type":"null"}],"description":"Categorized failure reason (timeout, content_policy, insufficient_credits, invalid_input, provider_error, provider_auth_required, canceled, unknown). Present when status is failed or canceled."}},"type":"object","required":["id","app_id","status","created_at"],"title":"AppRun","description":"Complete representation of an app execution run."},"FlowRunStatus":{"type":"string","enum":["in_progress","completed","failed","canceled"],"title":"FlowRunStatus","description":"Execution status of a workflow run."},"PendingReview":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Identifier of the pending review. Use this as `review_id` when calling POST /runs/{run_id}/reviews/{review_id} — or POST /app-runs/{run_id}/reviews/{review_id} for an app run — to resume execution. A `retry` keeps the same id: the review stays listed while the upstream output regenerates."},"node_id":{"type":"string","title":"Node Id","description":"ID of the human review node inside the flow definition"},"reviewed_node_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed Node Type","description":"Type of the upstream node whose output is being reviewed (e.g. image_generation, llm). Null when that node has no execution record — input nodes (text/image/video/audio/file inputs) never do."},"reviewed_output_type":{"anyOf":[{"$ref":"#/components/schemas/DataType"},{"type":"null"}],"description":"Kind of output under review (text, images, videos, audio, data). Null when `reviewed_node_type` is null or has no public output mapping."},"proposed_output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"string"},{"type":"null"}],"title":"Proposed Output","description":"Output of the reviewed upstream node (the first one, when the review covers several), in that node's own shape — e.g. {\"asset_ids\": [...]} for media. Submit it back (optionally edited) as `output` when approving. To discard items, submit only the ones you want to keep — omitted items are dropped. At least one item must be kept. Null when there is nothing to show: the review covers only input nodes, or the upstream node is still regenerating after a `retry`."},"can_edit_outputs":{"type":"boolean","title":"Can Edit Outputs","description":"Always true: every review step lets reviewers edit the proposed output.","default":true},"can_generate_more":{"type":"boolean","title":"Can Generate More","description":"Whether the review step offers regenerating the upstream output (decision `retry`). Always false when the review only covers input nodes. Informational: the API does not enforce it.","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the review was opened"}},"type":"object","required":["id","node_id","created_at"],"title":"PendingReview","description":"A human review step that is currently waiting for a decision.\n\nShared by runs and app runs: both pause on human review nodes the same way."},"DataType":{"type":"string","enum":["text","images","videos","files","audio","data"],"title":"DataType","description":"Kind of content an output, run result or review carries. In run results,\n`text` values are text, `images` / `videos` / `audio` values are asset IDs\nto download, and `data` values are structured JSON."},"RunResult":{"properties":{"id":{"type":"string","title":"Id","description":"ID of the node that produced this result. Match it against the `id` of an entry in the flow's or app's `outputs`."},"type":{"$ref":"#/components/schemas/DataType","description":"Kind of result: `text`, `images`, `videos`, `audio`, or `data` (structured output, and any node type without a more specific mapping)"},"value":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Value","description":"Result content. `text`: a string, or a list of strings when the node produced several. `images` / `videos` / `audio`: a list of asset IDs — resolve each via GET /assets/{id}. `data`: the node's raw output object."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Generic label for the result kind (e.g. \"Generated images\")"}},"type":"object","required":["id","type"],"title":"RunResult","description":"Represents a result produced by a run.\n\nShared by runs and app runs: both pipelines emit the same wire shape."},"FailureReason":{"type":"string","enum":["timeout","content_policy","insufficient_credits","invalid_input","provider_error","provider_auth_required","canceled","unknown"],"title":"FailureReason","description":"Stable category for why a run failed: `timeout` (a step ran out of time),\n`content_policy` (blocked by content moderation), `insufficient_credits`\n(credit or quota exhausted), `invalid_input` (an input, or an uploaded file,\ncould not be used), `provider_error` (an upstream AI provider failed),\n`provider_auth_required` (a connected provider account is missing or expired\nand must be reconnected), `canceled` (the run was canceled), `unknown` (any\ncause without a category of its own)."},"ApiErrorResponse":{"description":"Standard error response envelope. All API errors follow this format.","properties":{"error":{"$ref":"#/components/schemas/ApiErrorDetail","description":"Error details"}},"required":["error"],"title":"ApiErrorResponse","type":"object"},"ApiErrorDetail":{"description":"Structured details for an API error.","properties":{"code":{"$ref":"#/components/schemas/ApiErrorCode","description":"Machine-readable error code; branch on this, not on `message`"},"message":{"description":"Human-readable error description","title":"Message","type":"string"},"status":{"description":"HTTP status code of this response","title":"Status","type":"integer"},"details":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"items":{"type":"string"},"type":"array"},{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}]},"description":"Additional context. Always holds `request_id` (the response's `X-Request-Id`); `validation_error` from request validation adds `errors`, a list of `location: message` strings, and `rate_limit_exceeded` adds `retry_after`, the seconds to wait.","title":"Details","type":"object"}},"required":["code","message","status","details"],"title":"ApiErrorDetail","type":"object"},"ApiErrorCode":{"description":"Machine-readable error code, with its usual HTTP status: `invalid_input`\n400, `authentication_required` 401, `forbidden` 403, `not_found` 404,\n`conflict` 409, `validation_error` 422, `rate_limit_exceeded` 429,\n`internal_error` 500, `run_failed` 502, `service_unavailable` 503, `timeout`\n504. A 4xx status without a code of its own is sent as `invalid_input`.\n\n`plan_required`, `credit_usage_exceeded`, `user_quota_exceeded`,\n`spend_limit_exceeded`, `brain_flow_impact`, `stale_definition`,\n`flow_not_shared` and `asset_not_ready` have no status of their own and are\nsent only in the `X-Pletor-Error-Code` response header, never as `code`.","enum":["invalid_input","authentication_required","forbidden","not_found","conflict","validation_error","rate_limit_exceeded","internal_error","run_failed","service_unavailable","timeout","plan_required","credit_usage_exceeded","user_quota_exceeded","spend_limit_exceeded","brain_flow_impact","stale_definition","flow_not_shared","asset_not_ready"],"title":"ApiErrorCode","type":"string"}}},"paths":{"/v1/app-runs/":{"post":{"tags":["app-runs"],"summary":"Create App Run","description":"Create and start a new app execution run.\n\nThis endpoint launches the execution of an app with the provided inputs. The\nexecution runs asynchronously, allowing you to monitor progress and retrieve\nresults when complete. The run executes the flow version pinned by the app's\nlatest version and starts with `status` `in_progress`.\n\n**Idempotency with `external_id`:** Optionally pass an `external_id` (e.g. your\nown order or job id). It is **unique per organization**: the first request with\na given key starts the run; any later write reusing that key — including a\ndropped-response retry — is rejected with **`409 conflict`** instead of starting\n(and charging) a duplicate. To fetch the run a key already created, use\n`GET /app-runs?external_id=...`. The id is echoed on every app-run response.\n\n- Scope: per organization, across **all** runs (flow and app share the key\n  space) and **all** statuses — a key, once used, stays used.\n- On `409`, do **not** keep retrying the create; `GET /app-runs?external_id=` to\n  retrieve the existing run. To start a genuinely new run, use a new `external_id`.\n\n**How to Build Inputs:**\n\n1. **First, get app details**: Call `GET /apps/{app_id}` to retrieve the app\n   configuration.\n2. **Examine the `inputs` array**: Each object defines what input the app expects:\n   - `id`: Use this as the `id` in your input object\n   - `type`: text, image, video, audio, or file\n   - `required`: whether the input is mandatory\n   - `options` / `min_selections` / `max_selections`: constraints for fixed-set inputs\n\n**Text Inputs:** a string, or a list of strings (each string counts as one\nselection against `min_selections` / `max_selections`; with `options`, each\nmust be one of the listed labels).\n```json\n{\"id\": \"text_input_node_id\", \"value\": \"Your text content here\"}\n```\n\n**Asset Inputs** (image / video / audio / file): an object with `asset_ids`\n(a bare list of asset IDs is also accepted). With `options`, each ID must be\none of the listed asset IDs.\n```json\n{\"id\": \"image_input_node_id\", \"value\": {\"asset_ids\": [\"uuid1\", \"uuid2\"]}}\n```\nUpload assets first via `POST /assets/upload` to get the UUIDs.\n\nA brand used by the app's flow is not an input: it is fixed on the flow and\ncannot be passed per run.\n\n**Example:**\n```json\n{\n    \"app_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"inputs\": [\n        {\"id\": \"uuid-1\", \"value\": \"Create a marketing banner for a tech startup\"}\n    ]\n}\n```\n\n**Curated contract:** only the inputs advertised by `GET /apps/{app_id}` are\naccepted. Unknown input ids, missing required inputs, and values that violate an\ninput's `options` / `min_selections` / `max_selections` are rejected with `400`.\nThe run's `results` contain only the app's curated outputs — never the\nunderlying flow's internal nodes.\n\n**Credits:** the balance is not checked when the run is created. A run that\nexhausts the organization's credits or the user's quota fails with\n`failure_reason` `insufficient_credits`.\n\n**Response:**\n- AppRun object with execution details and initial status\n- Use `id` to monitor progress via `GET /app-runs/{run_id}`\n\n**Error Codes:**\n- `400`: Invalid input format, unknown input id, missing required inputs, values\n  outside constraints, or an app whose flow has validation errors or no flow\n  definition\n- `401`: Missing or invalid API key or Bearer token\n- `403`: The API key is bound to a different organization than `X-Organization-Id`\n- `404`: App not found or not accessible\n- `409`: `external_id` already used by another run in this organization\n- `422`: Malformed request body (e.g. `external_id` over 255 characters), or\n  inputs that a node of the flow would reject before running\n- `429`: Rate limit exceeded — retry after the `Retry-After` header","operationId":"v1_create_app_run_app_runs__post","deprecated":true,"parameters":[{"name":"X-Organization-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Active organization ID for multi-org support","title":"X-Organization-Id"},"description":"Active organization ID for multi-org support"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppRunCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppRun"}}}},"422":{"description":"Validation error (`validation_error`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}}}
````

## Get App Run

> Get detailed information about a specific app execution run.\
> \
> This endpoint retrieves comprehensive information about an app run, including\
> real-time status, progress, inputs, and curated results when available.\
> \
> \*\*Monitoring Workflow:\*\*\
> 1\. Create run via \`POST /app-runs\`\
> 2\. Poll this endpoint to monitor progress\
> 3\. If \`awaiting\_human\_review\` becomes \`true\`, inspect \`pending\_reviews\`\
> &#x20;  and resolve each via \`POST /app-runs/{run\_id}/reviews/{review\_id}\` to\
> &#x20;  resume execution (within 1 week, or the run fails)\
> 4\. Stop polling when status becomes "completed", "failed", or "canceled"\
> 5\. Extract results from the \`results\` array when status is "completed"\
> \
> \*\*Progress Tracking:\*\*\
> \- \`status\`: \`in\_progress\` until the run ends as \`completed\`, \`failed\` or\
> &#x20; \`canceled\`\
> \- \`progress\`: Fraction of node executions completed (0.0 to 1.0)\
> \- \`current\_node\`: Type of the node executing now, while \`in\_progress\`\
> \- \`awaiting\_human\_review\`: \`true\` when the run is paused on a human review\
> &#x20; node; \`status\` stays \`in\_progress\` in this case\
> \- \`pending\_reviews\`: List of review steps awaiting a decision\
> \
> \*\*How to Retrieve Results:\*\*\
> Call \`GET /apps/{app\_id}\` and examine the \`outputs\` array, then match results to\
> outputs by \`id\`. Results appear as each output node finishes, so \`results\` can\
> be partial while the run is \`in\_progress\` or after it fails.\
> \
> \- \*\*Text results\*\*: \`value\` is a string, or a list of strings.\
> \- \*\*Asset results\*\* (images/videos/audio): \`value\` is an array of asset UUIDs —\
> &#x20; resolve each via \`GET /assets/{id}\` and fetch the \`url\` field.\
> \- \*\*Data results\*\*: \`value\` is the node's raw output object.\
> \
> \*\*Cost Information:\*\*\
> \- \`cost\`: Credits consumed so far (\`null\` before any node has run)\
> \
> \*\*Error Handling:\*\*\
> \- \`error\`: Error message if the run failed or was canceled\
> \- \`failure\_reason\`: Categorized cause, set when \`status\` is \`failed\` or\
> &#x20; \`canceled\`\
> \
> \*\*Error Codes:\*\*\
> \- \`401\`: Missing or invalid API key or Bearer token\
> \- \`403\`: The API key is bound to a different organization than \`X-Organization-Id\`\
> \- \`404\`: Run not found in the caller's organization, or it is a flow run\
> &#x20; (use \`GET /runs/{run\_id}\`)\
> \- \`422\`: \`run\_id\` is not a UUID\
> \- \`429\`: Rate limit exceeded — retry after the \`Retry-After\` header

```json
{"openapi":"3.1.0","info":{"title":"Pletor - Public API","version":"2.0.0"},"tags":[{"name":"app-runs","description":"Create, monitor, and cancel app executions."}],"servers":[{"url":"/api/public"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"API key for authentication"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Cognito JWT Bearer token"}},"schemas":{"AppRun":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Unique run identifier"},"app_id":{"type":"string","format":"uuid","title":"App Id","description":"Stable ID of the app being executed"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"Client-supplied reference id provided at creation, if any"},"status":{"$ref":"#/components/schemas/FlowRunStatus","description":"Current execution state: in_progress, completed, failed, or canceled. A run starts in_progress and ends in exactly one of the others"},"progress":{"type":"number","maximum":1,"minimum":0,"title":"Progress","description":"Fraction of the run's node executions that have completed, from 0.0 to 1.0. 1.0 once completed; 0.0 once failed or canceled","default":0},"current_node":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Node","description":"Type of the node currently executing (e.g. image_generation, llm). Only present while status is in_progress"},"awaiting_human_review":{"type":"boolean","title":"Awaiting Human Review","description":"True when the run has paused on one or more human review nodes and is waiting for a decision via POST /app-runs/{run_id}/reviews/{review_id}. While true, `status` remains `in_progress`. A review left without a decision for 1 week cancels the run (`failure_reason: timeout`).","default":false},"pending_reviews":{"items":{"$ref":"#/components/schemas/PendingReview"},"type":"array","title":"Pending Reviews","description":"Human review steps currently waiting for a decision. Empty unless `awaiting_human_review` is true."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the run was created"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"When execution started"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"When execution finished (completed, failed or canceled). Null while in_progress"},"inputs":{"items":{"$ref":"#/components/schemas/RunInput"},"type":"array","title":"Inputs","description":"Inputs provided for this run. The create response echoes them as sent; later reads return them as stored — text values as a list of strings, asset values as {\"asset_ids\": [...]}"},"results":{"items":{"$ref":"#/components/schemas/RunResult"},"type":"array","title":"Results","description":"Outputs of the app's curated output nodes — never the flow's internal nodes. Each entry appears once its node has produced output, so the list fills in while in_progress and is complete once status is completed. After a human review `retry`, only the latest attempt is kept"},"cost":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cost","description":"Credits consumed by this run so far, summed over its node executions. Null before any node has run"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if the run failed or was canceled"},"failure_reason":{"anyOf":[{"$ref":"#/components/schemas/FailureReason"},{"type":"null"}],"description":"Categorized failure reason (timeout, content_policy, insufficient_credits, invalid_input, provider_error, provider_auth_required, canceled, unknown). Present when status is failed or canceled."}},"type":"object","required":["id","app_id","status","created_at"],"title":"AppRun","description":"Complete representation of an app execution run."},"FlowRunStatus":{"type":"string","enum":["in_progress","completed","failed","canceled"],"title":"FlowRunStatus","description":"Execution status of a workflow run."},"PendingReview":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Identifier of the pending review. Use this as `review_id` when calling POST /runs/{run_id}/reviews/{review_id} — or POST /app-runs/{run_id}/reviews/{review_id} for an app run — to resume execution. A `retry` keeps the same id: the review stays listed while the upstream output regenerates."},"node_id":{"type":"string","title":"Node Id","description":"ID of the human review node inside the flow definition"},"reviewed_node_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed Node Type","description":"Type of the upstream node whose output is being reviewed (e.g. image_generation, llm). Null when that node has no execution record — input nodes (text/image/video/audio/file inputs) never do."},"reviewed_output_type":{"anyOf":[{"$ref":"#/components/schemas/DataType"},{"type":"null"}],"description":"Kind of output under review (text, images, videos, audio, data). Null when `reviewed_node_type` is null or has no public output mapping."},"proposed_output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"string"},{"type":"null"}],"title":"Proposed Output","description":"Output of the reviewed upstream node (the first one, when the review covers several), in that node's own shape — e.g. {\"asset_ids\": [...]} for media. Submit it back (optionally edited) as `output` when approving. To discard items, submit only the ones you want to keep — omitted items are dropped. At least one item must be kept. Null when there is nothing to show: the review covers only input nodes, or the upstream node is still regenerating after a `retry`."},"can_edit_outputs":{"type":"boolean","title":"Can Edit Outputs","description":"Always true: every review step lets reviewers edit the proposed output.","default":true},"can_generate_more":{"type":"boolean","title":"Can Generate More","description":"Whether the review step offers regenerating the upstream output (decision `retry`). Always false when the review only covers input nodes. Informational: the API does not enforce it.","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the review was opened"}},"type":"object","required":["id","node_id","created_at"],"title":"PendingReview","description":"A human review step that is currently waiting for a decision.\n\nShared by runs and app runs: both pause on human review nodes the same way."},"DataType":{"type":"string","enum":["text","images","videos","files","audio","data"],"title":"DataType","description":"Kind of content an output, run result or review carries. In run results,\n`text` values are text, `images` / `videos` / `audio` values are asset IDs\nto download, and `data` values are structured JSON."},"RunInput":{"properties":{"id":{"type":"string","title":"Id","description":"ID of the input this value fills, as listed in the `inputs` of the flow or app"},"value":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"}],"title":"Value","description":"Input value. Text inputs take a string, or a list of strings. Image, video, audio and file inputs take {\"asset_ids\": [\"uuid\", ...]} (a bare list of asset IDs is also accepted). Upload files first via POST /assets/upload. When read back from a stored run, text values come back as a list of strings and asset values as {\"asset_ids\": [...]}."}},"type":"object","required":["id","value"],"title":"RunInput","description":"Represents an input provided to a run.\n\nShared by runs and app runs: both pipelines accept the same wire shape."},"RunResult":{"properties":{"id":{"type":"string","title":"Id","description":"ID of the node that produced this result. Match it against the `id` of an entry in the flow's or app's `outputs`."},"type":{"$ref":"#/components/schemas/DataType","description":"Kind of result: `text`, `images`, `videos`, `audio`, or `data` (structured output, and any node type without a more specific mapping)"},"value":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Value","description":"Result content. `text`: a string, or a list of strings when the node produced several. `images` / `videos` / `audio`: a list of asset IDs — resolve each via GET /assets/{id}. `data`: the node's raw output object."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Generic label for the result kind (e.g. \"Generated images\")"}},"type":"object","required":["id","type"],"title":"RunResult","description":"Represents a result produced by a run.\n\nShared by runs and app runs: both pipelines emit the same wire shape."},"FailureReason":{"type":"string","enum":["timeout","content_policy","insufficient_credits","invalid_input","provider_error","provider_auth_required","canceled","unknown"],"title":"FailureReason","description":"Stable category for why a run failed: `timeout` (a step ran out of time),\n`content_policy` (blocked by content moderation), `insufficient_credits`\n(credit or quota exhausted), `invalid_input` (an input, or an uploaded file,\ncould not be used), `provider_error` (an upstream AI provider failed),\n`provider_auth_required` (a connected provider account is missing or expired\nand must be reconnected), `canceled` (the run was canceled), `unknown` (any\ncause without a category of its own)."},"ApiErrorResponse":{"description":"Standard error response envelope. All API errors follow this format.","properties":{"error":{"$ref":"#/components/schemas/ApiErrorDetail","description":"Error details"}},"required":["error"],"title":"ApiErrorResponse","type":"object"},"ApiErrorDetail":{"description":"Structured details for an API error.","properties":{"code":{"$ref":"#/components/schemas/ApiErrorCode","description":"Machine-readable error code; branch on this, not on `message`"},"message":{"description":"Human-readable error description","title":"Message","type":"string"},"status":{"description":"HTTP status code of this response","title":"Status","type":"integer"},"details":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"items":{"type":"string"},"type":"array"},{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}]},"description":"Additional context. Always holds `request_id` (the response's `X-Request-Id`); `validation_error` from request validation adds `errors`, a list of `location: message` strings, and `rate_limit_exceeded` adds `retry_after`, the seconds to wait.","title":"Details","type":"object"}},"required":["code","message","status","details"],"title":"ApiErrorDetail","type":"object"},"ApiErrorCode":{"description":"Machine-readable error code, with its usual HTTP status: `invalid_input`\n400, `authentication_required` 401, `forbidden` 403, `not_found` 404,\n`conflict` 409, `validation_error` 422, `rate_limit_exceeded` 429,\n`internal_error` 500, `run_failed` 502, `service_unavailable` 503, `timeout`\n504. A 4xx status without a code of its own is sent as `invalid_input`.\n\n`plan_required`, `credit_usage_exceeded`, `user_quota_exceeded`,\n`spend_limit_exceeded`, `brain_flow_impact`, `stale_definition`,\n`flow_not_shared` and `asset_not_ready` have no status of their own and are\nsent only in the `X-Pletor-Error-Code` response header, never as `code`.","enum":["invalid_input","authentication_required","forbidden","not_found","conflict","validation_error","rate_limit_exceeded","internal_error","run_failed","service_unavailable","timeout","plan_required","credit_usage_exceeded","user_quota_exceeded","spend_limit_exceeded","brain_flow_impact","stale_definition","flow_not_shared","asset_not_ready"],"title":"ApiErrorCode","type":"string"}}},"paths":{"/v1/app-runs/{run_id}":{"get":{"tags":["app-runs"],"summary":"Get App Run","description":"Get detailed information about a specific app execution run.\n\nThis endpoint retrieves comprehensive information about an app run, including\nreal-time status, progress, inputs, and curated results when available.\n\n**Monitoring Workflow:**\n1. Create run via `POST /app-runs`\n2. Poll this endpoint to monitor progress\n3. If `awaiting_human_review` becomes `true`, inspect `pending_reviews`\n   and resolve each via `POST /app-runs/{run_id}/reviews/{review_id}` to\n   resume execution (within 1 week, or the run fails)\n4. Stop polling when status becomes \"completed\", \"failed\", or \"canceled\"\n5. Extract results from the `results` array when status is \"completed\"\n\n**Progress Tracking:**\n- `status`: `in_progress` until the run ends as `completed`, `failed` or\n  `canceled`\n- `progress`: Fraction of node executions completed (0.0 to 1.0)\n- `current_node`: Type of the node executing now, while `in_progress`\n- `awaiting_human_review`: `true` when the run is paused on a human review\n  node; `status` stays `in_progress` in this case\n- `pending_reviews`: List of review steps awaiting a decision\n\n**How to Retrieve Results:**\nCall `GET /apps/{app_id}` and examine the `outputs` array, then match results to\noutputs by `id`. Results appear as each output node finishes, so `results` can\nbe partial while the run is `in_progress` or after it fails.\n\n- **Text results**: `value` is a string, or a list of strings.\n- **Asset results** (images/videos/audio): `value` is an array of asset UUIDs —\n  resolve each via `GET /assets/{id}` and fetch the `url` field.\n- **Data results**: `value` is the node's raw output object.\n\n**Cost Information:**\n- `cost`: Credits consumed so far (`null` before any node has run)\n\n**Error Handling:**\n- `error`: Error message if the run failed or was canceled\n- `failure_reason`: Categorized cause, set when `status` is `failed` or\n  `canceled`\n\n**Error Codes:**\n- `401`: Missing or invalid API key or Bearer token\n- `403`: The API key is bound to a different organization than `X-Organization-Id`\n- `404`: Run not found in the caller's organization, or it is a flow run\n  (use `GET /runs/{run_id}`)\n- `422`: `run_id` is not a UUID\n- `429`: Rate limit exceeded — retry after the `Retry-After` header","operationId":"v1_get_app_run_app_runs__run_id__get","deprecated":true,"parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"ID of the app run","title":"Run Id"},"description":"ID of the app run"},{"name":"X-Organization-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Active organization ID for multi-org support","title":"X-Organization-Id"},"description":"Active organization ID for multi-org support"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppRun"}}}},"422":{"description":"Validation error (`validation_error`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}}}
```

## Cancel App Run

> Cancel an ongoing app execution run.\
> \
> This endpoint allows you to cancel an execution whose \`status\` is\
> \`in\_progress\`, including one paused on a human review. Once cancelled, the\
> execution cannot be resumed.\
> \
> \*\*Behavior:\*\*\
> \- The \`204\` confirms the cancellation was requested; it takes effect\
> &#x20; asynchronously, usually within a few seconds\
> \- Once it lands, \`GET /app-runs/{run\_id}\` shows \`status\` \`canceled\` and\
> &#x20; \`failure\_reason\` \`canceled\`\
> \- A run that is already \`completed\`, \`failed\` or \`canceled\` cannot be\
> &#x20; cancelled and answers \`404\`\
> \
> \*\*Error Codes:\*\*\
> \- \`401\`: Missing or invalid API key or Bearer token\
> \- \`403\`: The API key is bound to a different organization than \`X-Organization-Id\`\
> \- \`404\`: Run not found in the caller's organization, it is a flow run, or it\
> &#x20; is no longer \`in\_progress\`\
> \- \`422\`: \`run\_id\` is not a UUID\
> \- \`429\`: Rate limit exceeded — retry after the \`Retry-After\` header

```json
{"openapi":"3.1.0","info":{"title":"Pletor - Public API","version":"2.0.0"},"tags":[{"name":"app-runs","description":"Create, monitor, and cancel app executions."}],"servers":[{"url":"/api/public"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"API key for authentication"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Cognito JWT Bearer token"}},"schemas":{"ApiErrorResponse":{"description":"Standard error response envelope. All API errors follow this format.","properties":{"error":{"$ref":"#/components/schemas/ApiErrorDetail","description":"Error details"}},"required":["error"],"title":"ApiErrorResponse","type":"object"},"ApiErrorDetail":{"description":"Structured details for an API error.","properties":{"code":{"$ref":"#/components/schemas/ApiErrorCode","description":"Machine-readable error code; branch on this, not on `message`"},"message":{"description":"Human-readable error description","title":"Message","type":"string"},"status":{"description":"HTTP status code of this response","title":"Status","type":"integer"},"details":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"items":{"type":"string"},"type":"array"},{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}]},"description":"Additional context. Always holds `request_id` (the response's `X-Request-Id`); `validation_error` from request validation adds `errors`, a list of `location: message` strings, and `rate_limit_exceeded` adds `retry_after`, the seconds to wait.","title":"Details","type":"object"}},"required":["code","message","status","details"],"title":"ApiErrorDetail","type":"object"},"ApiErrorCode":{"description":"Machine-readable error code, with its usual HTTP status: `invalid_input`\n400, `authentication_required` 401, `forbidden` 403, `not_found` 404,\n`conflict` 409, `validation_error` 422, `rate_limit_exceeded` 429,\n`internal_error` 500, `run_failed` 502, `service_unavailable` 503, `timeout`\n504. A 4xx status without a code of its own is sent as `invalid_input`.\n\n`plan_required`, `credit_usage_exceeded`, `user_quota_exceeded`,\n`spend_limit_exceeded`, `brain_flow_impact`, `stale_definition`,\n`flow_not_shared` and `asset_not_ready` have no status of their own and are\nsent only in the `X-Pletor-Error-Code` response header, never as `code`.","enum":["invalid_input","authentication_required","forbidden","not_found","conflict","validation_error","rate_limit_exceeded","internal_error","run_failed","service_unavailable","timeout","plan_required","credit_usage_exceeded","user_quota_exceeded","spend_limit_exceeded","brain_flow_impact","stale_definition","flow_not_shared","asset_not_ready"],"title":"ApiErrorCode","type":"string"}}},"paths":{"/v1/app-runs/{run_id}":{"delete":{"tags":["app-runs"],"summary":"Cancel App Run","description":"Cancel an ongoing app execution run.\n\nThis endpoint allows you to cancel an execution whose `status` is\n`in_progress`, including one paused on a human review. Once cancelled, the\nexecution cannot be resumed.\n\n**Behavior:**\n- The `204` confirms the cancellation was requested; it takes effect\n  asynchronously, usually within a few seconds\n- Once it lands, `GET /app-runs/{run_id}` shows `status` `canceled` and\n  `failure_reason` `canceled`\n- A run that is already `completed`, `failed` or `canceled` cannot be\n  cancelled and answers `404`\n\n**Error Codes:**\n- `401`: Missing or invalid API key or Bearer token\n- `403`: The API key is bound to a different organization than `X-Organization-Id`\n- `404`: Run not found in the caller's organization, it is a flow run, or it\n  is no longer `in_progress`\n- `422`: `run_id` is not a UUID\n- `429`: Rate limit exceeded — retry after the `Retry-After` header","operationId":"v1_cancel_app_run_app_runs__run_id__delete","deprecated":true,"parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"ID of the app run","title":"Run Id"},"description":"ID of the app run"},{"name":"X-Organization-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Active organization ID for multi-org support","title":"X-Organization-Id"},"description":"Active organization ID for multi-org support"}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation error (`validation_error`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}}}
```

## Submit App Run Review

> Resolve a pending human review and resume an app execution.\
> \
> When the app's underlying flow includes a human review step, the run pauses\
> on that node and \`awaiting\_human\_review\` becomes \`true\` on\
> \`GET /app-runs/{run\_id}\`. Each waiting step is listed in the run's\
> \`pending\_reviews\` array. Submit a decision here to resume. A review left\
> without a decision for 1 week cancels the run (\`failure\_reason: timeout\`).\
> \
> App runs are resolved only here: \`POST /runs/{run\_id}/reviews/{review\_id}\`\
> answers \`404\` for an app run.\
> \
> \*\*Discovering pending reviews\*\*\
> \
> 1\. Poll \`GET /app-runs/{run\_id}\` until \`awaiting\_human\_review\` is \`true\`.\
> 2\. Inspect the \`pending\_reviews\` array. Use a review's \`id\` as\
> &#x20;  \`review\_id\` in this endpoint's path.\
> 3\. The \`proposed\_output\` field of each review is what the upstream node\
> &#x20;  generated. Submit it back as \`output\` (optionally edited) to approve.\
> \
> \*\*Decisions\*\*\
> \
> \- \`approve\`: continue execution. The \`output\` body field is required and\
> &#x20; must match the shape of \`proposed\_output\`:\
> &#x20; \- Image / video / audio reviews: \`{"asset\_ids": \["..."]}\`.\
> &#x20; \- Text-prompt reviews: \`{"prompts": \["..."]}\`.\
> &#x20; To discard items, approve with only the ones you want to keep — omitted\
> &#x20; items are dropped. At least one item must be kept (an empty \`output\` is\
> &#x20; rejected with \`400\`), and an \`output\` whose shape does not match the\
> &#x20; reviewed node is rejected with \`400\`.\
> \- \`retry\`: re-run the upstream node(s) to produce a new candidate output.\
> &#x20; \`output\` is ignored. The same review (same \`id\`) stays in\
> &#x20; \`pending\_reviews\` and \`awaiting\_human\_review\` stays \`true\` while the\
> &#x20; upstream regenerates; its \`proposed\_output\` is refreshed when that\
> &#x20; finishes. Wait for the new \`proposed\_output\` before deciding again — a\
> &#x20; decision sent earlier is applied as soon as regeneration ends.\
> \
> \*\*Examples\*\*\
> \
> Approve an image review using the proposed assets:\
> \`\`\`json\
> {\
> &#x20;   "decision": "approve",\
> &#x20;   "output": {\
> &#x20;       "asset\_ids": \[\
> &#x20;           "asset-uuid-001",\
> &#x20;           "asset-uuid-002"\
> &#x20;       ]\
> &#x20;   }\
> }\
> \`\`\`\
> \
> Retry to regenerate the upstream output:\
> \`\`\`json\
> {"decision": "retry"}\
> \`\`\`\
> \
> \*\*Error Codes:\*\*\
> \- \`400\`: Missing \`output\`, an empty \`output\` (nothing kept), or an \`output\`\
> &#x20; that does not match the reviewed node's shape, when decision is \`approve\`.\
> \- \`401\`: Missing or invalid API key or Bearer token\
> \- \`403\`: The API key is bound to a different organization than \`X-Organization-Id\`\
> \- \`404\`: Run not found in the caller's organization, it is a flow run, the\
> &#x20; caller can no longer read the app, or no human review with that ID on\
> &#x20; this run.\
> \- \`409\`: The review is no longer waiting (already submitted, or the run\
> &#x20; finished/failed/was canceled).\
> \- \`422\`: Malformed body (e.g. \`decision\` not \`approve\` or \`retry\`) or a\
> &#x20; path ID that is not a UUID\
> \- \`429\`: Rate limit exceeded — retry after the \`Retry-After\` header

````json
{"openapi":"3.1.0","info":{"title":"Pletor - Public API","version":"2.0.0"},"tags":[{"name":"app-runs","description":"Create, monitor, and cancel app executions."}],"servers":[{"url":"/api/public"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"API key for authentication"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Cognito JWT Bearer token"}},"schemas":{"SubmitReviewRequest":{"properties":{"decision":{"$ref":"#/components/schemas/ReviewDecision","description":"`approve` resumes execution using the (optionally edited) output. `retry` re-runs the upstream node(s) to produce a new candidate output, then waits for another decision on the same review."},"output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"string"},{"type":"null"}],"title":"Output","description":"Output to use when continuing execution. Required when decision is `approve` (missing → 400). Ignored when decision is `retry`. Must be an object matching the shape of `proposed_output` ({\"asset_ids\": [...]} for image/video/audio reviews, {\"prompts\": [...]} for text reviews — a text node's own key such as `texts` is also accepted); a mismatched shape is rejected with 400. To discard items, submit only the ones you want to keep; the rest are dropped. At least one item is required — an empty output is rejected with 400."}},"type":"object","required":["decision"],"title":"SubmitReviewRequest","description":"Request to resolve a pending human review."},"ReviewDecision":{"type":"string","enum":["approve","retry"],"title":"ReviewDecision","description":"Possible decisions when responding to a pending human review.\n\n`approve` resumes the run with the submitted output; `retry` re-runs the\nreviewed upstream node(s) and waits for a new decision on the same review."},"ApiErrorResponse":{"description":"Standard error response envelope. All API errors follow this format.","properties":{"error":{"$ref":"#/components/schemas/ApiErrorDetail","description":"Error details"}},"required":["error"],"title":"ApiErrorResponse","type":"object"},"ApiErrorDetail":{"description":"Structured details for an API error.","properties":{"code":{"$ref":"#/components/schemas/ApiErrorCode","description":"Machine-readable error code; branch on this, not on `message`"},"message":{"description":"Human-readable error description","title":"Message","type":"string"},"status":{"description":"HTTP status code of this response","title":"Status","type":"integer"},"details":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"items":{"type":"string"},"type":"array"},{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}]},"description":"Additional context. Always holds `request_id` (the response's `X-Request-Id`); `validation_error` from request validation adds `errors`, a list of `location: message` strings, and `rate_limit_exceeded` adds `retry_after`, the seconds to wait.","title":"Details","type":"object"}},"required":["code","message","status","details"],"title":"ApiErrorDetail","type":"object"},"ApiErrorCode":{"description":"Machine-readable error code, with its usual HTTP status: `invalid_input`\n400, `authentication_required` 401, `forbidden` 403, `not_found` 404,\n`conflict` 409, `validation_error` 422, `rate_limit_exceeded` 429,\n`internal_error` 500, `run_failed` 502, `service_unavailable` 503, `timeout`\n504. A 4xx status without a code of its own is sent as `invalid_input`.\n\n`plan_required`, `credit_usage_exceeded`, `user_quota_exceeded`,\n`spend_limit_exceeded`, `brain_flow_impact`, `stale_definition`,\n`flow_not_shared` and `asset_not_ready` have no status of their own and are\nsent only in the `X-Pletor-Error-Code` response header, never as `code`.","enum":["invalid_input","authentication_required","forbidden","not_found","conflict","validation_error","rate_limit_exceeded","internal_error","run_failed","service_unavailable","timeout","plan_required","credit_usage_exceeded","user_quota_exceeded","spend_limit_exceeded","brain_flow_impact","stale_definition","flow_not_shared","asset_not_ready"],"title":"ApiErrorCode","type":"string"}}},"paths":{"/v1/app-runs/{run_id}/reviews/{review_id}":{"post":{"tags":["app-runs"],"summary":"Submit App Run Review","description":"Resolve a pending human review and resume an app execution.\n\nWhen the app's underlying flow includes a human review step, the run pauses\non that node and `awaiting_human_review` becomes `true` on\n`GET /app-runs/{run_id}`. Each waiting step is listed in the run's\n`pending_reviews` array. Submit a decision here to resume. A review left\nwithout a decision for 1 week cancels the run (`failure_reason: timeout`).\n\nApp runs are resolved only here: `POST /runs/{run_id}/reviews/{review_id}`\nanswers `404` for an app run.\n\n**Discovering pending reviews**\n\n1. Poll `GET /app-runs/{run_id}` until `awaiting_human_review` is `true`.\n2. Inspect the `pending_reviews` array. Use a review's `id` as\n   `review_id` in this endpoint's path.\n3. The `proposed_output` field of each review is what the upstream node\n   generated. Submit it back as `output` (optionally edited) to approve.\n\n**Decisions**\n\n- `approve`: continue execution. The `output` body field is required and\n  must match the shape of `proposed_output`:\n  - Image / video / audio reviews: `{\"asset_ids\": [\"...\"]}`.\n  - Text-prompt reviews: `{\"prompts\": [\"...\"]}`.\n  To discard items, approve with only the ones you want to keep — omitted\n  items are dropped. At least one item must be kept (an empty `output` is\n  rejected with `400`), and an `output` whose shape does not match the\n  reviewed node is rejected with `400`.\n- `retry`: re-run the upstream node(s) to produce a new candidate output.\n  `output` is ignored. The same review (same `id`) stays in\n  `pending_reviews` and `awaiting_human_review` stays `true` while the\n  upstream regenerates; its `proposed_output` is refreshed when that\n  finishes. Wait for the new `proposed_output` before deciding again — a\n  decision sent earlier is applied as soon as regeneration ends.\n\n**Examples**\n\nApprove an image review using the proposed assets:\n```json\n{\n    \"decision\": \"approve\",\n    \"output\": {\n        \"asset_ids\": [\n            \"asset-uuid-001\",\n            \"asset-uuid-002\"\n        ]\n    }\n}\n```\n\nRetry to regenerate the upstream output:\n```json\n{\"decision\": \"retry\"}\n```\n\n**Error Codes:**\n- `400`: Missing `output`, an empty `output` (nothing kept), or an `output`\n  that does not match the reviewed node's shape, when decision is `approve`.\n- `401`: Missing or invalid API key or Bearer token\n- `403`: The API key is bound to a different organization than `X-Organization-Id`\n- `404`: Run not found in the caller's organization, it is a flow run, the\n  caller can no longer read the app, or no human review with that ID on\n  this run.\n- `409`: The review is no longer waiting (already submitted, or the run\n  finished/failed/was canceled).\n- `422`: Malformed body (e.g. `decision` not `approve` or `retry`) or a\n  path ID that is not a UUID\n- `429`: Rate limit exceeded — retry after the `Retry-After` header","operationId":"v1_submit_app_run_review_app_runs__run_id__reviews__review_id__post","deprecated":true,"parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"ID of the app run","title":"Run Id"},"description":"ID of the app run"},{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"`id` of an entry in the run's `pending_reviews`","title":"Review Id"},"description":"`id` of an entry in the run's `pending_reviews`"},{"name":"X-Organization-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Active organization ID for multi-org support","title":"X-Organization-Id"},"description":"Active organization ID for multi-org support"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitReviewRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation error (`validation_error`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}}}
````
