---
title: Tasks | Runware Docs
url: https://runware.ai/docs/serverless/api-tasks
description: Invoke an endpoint synchronously or asynchronously, then read the task back.
relatedDocuments:
  - https://runware.ai/docs/serverless/api
  - https://runware.ai/docs/serverless/invoking
  - https://runware.ai/docs/serverless/errors
---
## Introduction

Two routes start a task and **they differ only in how the wait happens, not in whether you get a result**. The synchronous route holds the connection open and responds with the finished task, or with `202` when the platform's wait window expires first. The asynchronous route accepts and returns immediately.

Both take the same body: a `taskId` you generate and a `payload` shaped by the endpoint you are calling. **Sending the same id again returns the task it already names** rather than starting a second run, which is what makes a retry after a lost response safe.

> [!NOTE]
> A `202` is not a failure. Poll the task with `getTask` under the `appId` the response names. See [Invoking an app](https://runware.ai/docs/serverless/invoking.md).

## Start a sync task

POSTapi.serverless.runware.ai/v1/apps/{appId}/invoke-sync/{endpointPath}

Starts a new sync task on `appId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`). Resubmitting a confirmed task id waits on the task it already names. The `200` carries that task's result and may name a different `appId`. Poll it under the one returned. While broker acceptance is uncertain, the retry can return `503`. An unstarted task with a recorded uncertain publish can fail at the dispatch deadline if the deployment's workers record when a task starts. A task that outlives the wait window is **not** a failure: the task is still queued or running, and the response is `202` carrying that task with `status: pending`. It names the owning `appId` on a resubmission just as the `200` does. When the broker could be read, that `202` also carries `queueDepth`, the messages still waiting on the app's queue. A missing `queueDepth` was not read, and is not an empty queue. A retry sends the same task id. A new id starts another task. Poll `GET /v1/apps/{appId}/tasks/{taskId}` for its result. A request whose acceptance the platform cannot confirm may fail while the task is still in flight. Apps in `initializing`, `active`, or `stopping` accept invocation, with two exceptions: an `initializing` app whose first rollout has not produced a version returns `409 Conflict`, and an `active` app the platform has observed to have no workload able to serve returns `503 Service Unavailable` with no task minted, including a resubmit of an id that already names a task. The 503 is typed `capacity-unavailable` and carries `Retry-After` when the app is short of workers; for a workload that failed to start, is missing or is terminating it is typed `service-unavailable` and carries no `Retry-After`. See the `503` response for which to retry. When the task service cannot be reached, the response is `502 Bad Gateway`. The request may already have been accepted, so retry with the same `taskId`. A sync request still waiting when the API instance serving it shuts down gets that `502` too: the task carries on, so retry with the same `taskId`. An internal failure's `detail` names the task service instead of repeating the title. `stopped`, `deleting`, and `failed` return `409 Conflict`. An app in an environment its budget pauses returns `429 Too Many Requests` typed `environment-paused`, whatever its status. Unknown or deleted apps return `404 Not Found`. An organization whose serverless tenancy is revoked, or has no tenancy receipt at all, returns `403 Forbidden`, distinguishing that from an app that does not exist. An organization whose tenancy is still being provisioned returns `503 Service Unavailable` instead. That state is retryable, not a revocation, and clears once provisioning finishes. Endpoint membership is checked against the active version's endpoint set before the task is accepted: an endpoint the app does not declare returns `404` whose `endpointPath` extension member carries the rejected path, distinguishing it from an unknown app, and the task never enters the queue. If the task has finished but its output cannot be read right now, the response is `503 Service Unavailable`: retry with the same `taskId`, or read `GET /v1/apps/{appId}/tasks/{taskId}`.

### [Request](https://runware.ai/docs/serverless/api-tasks#start-sync-task-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#start-sync-task-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#start-sync-task-path-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to, as returned by `listEndpoints`: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#start-sync-task-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

Body

### [taskId](https://runware.ai/docs/serverless/api-tasks#start-sync-task-body-taskid)

- **Type**: `string (uuid)`
- **Required**: true
- **Format**: `UUID v4`
- **Min**: `36`
- **Max**: `36`

Client-generated task identifier, canonical lowercase UUID. Retry with the same id to recover an existing task without starting a second one. The retry can return `503` while broker acceptance is uncertain. Use a unique id for each new request.

### [payload](https://runware.ai/docs/serverless/api-tasks#start-sync-task-body-payload)

- **Type**: `object`
- **Required**: true

The body the endpoint's handler receives, validated against the endpoint's declared input schema. An endpoint that declares none takes it unvalidated.

### [Response](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response)

### [id](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-id)

- **Type**: `string`
- **Required**: true

Task identifier, supplied by the caller when the task was submitted.

### [status](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-status)

- **Type**: `string`
- **Required**: true

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Possible values**: `pending` `completed` `failed` `canceled`

### [queueDepth](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-queuedepth)

- **Type**: `integer`
- **Format**: `int64`
- **Min**: `0`

Messages still waiting on this app's inference queue, present only on the `202` from `invoke-sync` when the wait window expired and the broker could be read. It is the broker's ready count at that moment, and it leaves out work a worker has already taken. Zero means the queue was empty, including an app whose queue has not been declared. Omitted on every other task response, and omitted when the count could not be read: a missing field is not an empty queue. `runtime.queueDepth` on the app is a different reading, the last stored sample of ready and unacknowledged messages.

### [appId](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier. Unique among the authenticated organization's live apps in one environment: it cannot be changed after creation, it becomes available again once the app it named reaches `deleted`, and the same id may run once in each environment as a separate copy.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

### [endpointId](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-endpointid)

- **Type**: `string (uuid)`
- **Format**: `UUID v4`

Allocated endpoint row, the same UUID as `Endpoint.id`. Present when the live row at `endpointPath` was created at or before this task. Omitted when that path has no live row, when this task has no creation time, and when this task predates the live row: a path removed and added again is a different endpoint, and this id must not name it. Read from a cache, so it is best effort: also omitted when the cached endpoint rows are older than this task and could not be read again (a later read returns it), and a removed endpoint's id can still be returned for a short while after the removal. Metrics filters take this id, not `endpointPath`.

### [output](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-output)

- **Type**: `any`

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null. For a code app this is the value the handler returned, or the value `encode_response` returned when the app defines one: it is not wrapped, and a single request's value is that return rather than a one-element list of it. For a container app this is the response body the container returned. Absent on a listed task whose `outputOmitted` is `true`.

### [outputOmitted](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-outputomitted)

- **Type**: `boolean`

`true` on an entry of `GET /v1/apps/{appId}/tasks` whose `status` is `completed` but whose `output` is absent because the listing omitted it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Read it with `GET /v1/apps/{appId}/tasks/{taskId}`. Absent everywhere else.

### [error](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-error)

- **Type**: `string (nullable)`

Unstructured error message when `status` is `failed`. Null otherwise. It reports a task the platform accepted and that then failed. Its wording is not part of this contract: it carries no stable code or retry signal, so do not parse it to classify a failure.

### [createdAt](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-createdat)

- **Type**: `string (date-time)`
- **Required**: true
- **Format**: `date-time`

### [completedAt](https://runware.ai/docs/serverless/api-tasks#start-sync-task-response-completedat)

- **Type**: `string (date-time) (nullable)`
- **Format**: `date-time`

### [Errors](https://runware.ai/docs/serverless/api-tasks#start-sync-task-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">400</code></td><td data-rw-cid-pz7tphoj="true">The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns <code class="component-Code">422</code> instead.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">403</code></td><td data-rw-cid-pz7tphoj="true">Authenticated but not permitted to access this resource</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">The app does not exist, or it exists and does not declare the endpoint path. An undeclared endpoint carries <code class="component-Code">endpointPath</code> with the rejected path. Its absence means the app itself was not found.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">409</code></td><td data-rw-cid-pz7tphoj="true">Resource already exists or the request conflicts with its current state</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">413</code></td><td data-rw-cid-pz7tphoj="true">The request body exceeds its size limit: 10 MiB on <code class="component-Code">invoke-sync</code> and <code class="component-Code">invoke-async</code>, whose body carries the endpoint's payload, and 1 MiB on the other operations that answer with this response. <code class="component-Code">detail</code> names the limit in bytes.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">415</code></td><td data-rw-cid-pz7tphoj="true">The request body arrived with a Content-Type this operation does not accept. The body was not decoded, so this is not a schema failure. A body of <code class="component-Code">application/json</code> that cannot be parsed returns <code class="component-Code">400</code>. One that parses and breaks the schema returns <code class="component-Code">422</code>. A body sent with no Content-Type is the same refusal.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">429</code></td><td data-rw-cid-pz7tphoj="true"><code class="component-Code">environment-paused</code> means the app's environment is paused: its spend this UTC month has reached its monthly budget with <code class="component-Code">pauseAtBudget</code> on. No task is started. The pause holds until the budget is raised past the spend or the month turns, so there is no <code class="component-Code">Retry-After</code>; resume the app once it ends.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">The invocation was refused, broker acceptance is uncertain, or a completed task's output is temporarily unavailable. The problem <code class="component-Code">type</code> identifies the reason. <code class="component-Code">capacity-unavailable</code> means the app is deployed and correct, and the platform has no workload able to serve it: the app is short of the workers it asks for, or it has work waiting and nothing running it. No task was minted. The request is unchanged by the refusal and succeeds as sent once capacity returns, so retry it rather than correct it, after <code class="component-Code">Retry-After</code> where that header is present. Read <code class="component-Code">health.reason</code> on the app to tell the two capacity conditions apart. <code class="component-Code">detail</code> is <code class="component-Code">app has no workload able to serve this invocation</code>. When the current unavailable spell recorded the runtime's quoted line, that sentence follows it. A capacity shortfall does not carry a line from an earlier spell. Clients switch on <code class="component-Code">type</code>, never on <code class="component-Code">detail</code>. <code class="component-Code">service-unavailable</code> means something this route depends on is temporarily unreachable, or the organization's serverless tenancy is still being provisioned. It also covers an unconfirmed broker publish. RabbitMQ may already hold the task in that case. Retry with the same <code class="component-Code">taskId</code> to avoid starting a second task. It is also the type for an unavailable app whose <code class="component-Code">health.reason</code> is not a capacity shortfall, such as a workload that failed to start, is missing or is terminating. A missing or terminating workload does not recover on retry, and a failed start usually does not: read <code class="component-Code">health.reason</code>, then correct or redeploy the app. For this refusal, <code class="component-Code">detail</code> is the same sentence as for a capacity refusal, followed by the runtime's quoted line when one was recorded in the current unavailable spell or the two minutes before it, as in the <code class="component-Code">application-line</code> example. An exception to "a failed start usually does not recover" is <code class="component-Code">start_failed</code> while the platform holds stops because many apps fail to start at once, which it treats as its own fault: the app stays <code class="component-Code">active</code> and its workers keep retrying, so it recovers on its own if a worker becomes ready. The hold lasts only while that burst does: an app still failing to start when it clears is stopped like any other, and its invocations then get <code class="component-Code">409</code> with its own <code class="component-Code">detail</code>. The response does not show whether the hold applies, and it is not the only case where a <code class="component-Code">start_failed</code> app stays <code class="component-Code">active</code> for a while, so do not rely on a retry succeeding. A queued invocation can also return this type when a finished task's output cannot be read yet. Retry with the same <code class="component-Code">taskId</code> within the recovery window so the work is not queued again, or read the existing task with <code class="component-Code">GET /v1/apps/{appId}/tasks/{taskId}</code>.</td></tr></tbody></table>

## Start an async task

POSTapi.serverless.runware.ai/v1/apps/{appId}/invoke-async/{endpointPath}

Starts a new async task on `appId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`. Poll `GET /v1/apps/{appId}/tasks/{taskId}` for completion. Resubmitting a confirmed task id returns the task it already names. The `202` can carry a task that has already finished, and it may name a different `appId`. While broker acceptance is uncertain, the retry can return `503`. An unstarted task with a recorded uncertain publish can fail at the dispatch deadline if the deployment's workers record when a task starts. Apps in `initializing`, `active`, or `stopping` accept invocation, with two exceptions: an `initializing` app whose first rollout has not produced a version returns `409 Conflict`, and an `active` app the platform has observed to have no workload able to serve returns `503 Service Unavailable` with no task minted, including a resubmit of an id that already names a task. The 503 is typed `capacity-unavailable` and carries `Retry-After` when the app is short of workers; for a workload that failed to start, is missing or is terminating it is typed `service-unavailable` and carries no `Retry-After`. See the `503` response for which to retry. When the task service cannot be reached, the response is `502 Bad Gateway`. The request may already have been accepted, so retry with the same `taskId`. An internal failure's `detail` names the task service instead of repeating the title. `stopped`, `deleting`, and `failed` return `409 Conflict`. An app in an environment its budget pauses returns `429 Too Many Requests` typed `environment-paused`, whatever its status. Unknown or deleted apps return `404 Not Found`. An organization whose serverless tenancy is revoked, or has no tenancy receipt at all, returns `403 Forbidden`, distinguishing that from an app that does not exist. An organization whose tenancy is still being provisioned returns `503 Service Unavailable` instead. That state is retryable, not a revocation, and clears once provisioning finishes. Endpoint membership is checked against the active version's endpoint set before the task is accepted: an endpoint the app does not declare returns `404` whose `endpointPath` extension member carries the rejected path, distinguishing it from an unknown app, and the task never enters the queue. If the task has finished but its output cannot be read right now, the response is `503 Service Unavailable`: retry with the same `taskId`, or read `GET /v1/apps/{appId}/tasks/{taskId}`.

### [Request](https://runware.ai/docs/serverless/api-tasks#start-async-task-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#start-async-task-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#start-async-task-path-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to, as returned by `listEndpoints`: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#start-async-task-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

Body

### [taskId](https://runware.ai/docs/serverless/api-tasks#start-async-task-body-taskid)

- **Type**: `string (uuid)`
- **Required**: true
- **Format**: `UUID v4`
- **Min**: `36`
- **Max**: `36`

Client-generated task identifier, canonical lowercase UUID. Retry with the same id to recover an existing task without starting a second one. The retry can return `503` while broker acceptance is uncertain. Use a unique id for each new request.

### [payload](https://runware.ai/docs/serverless/api-tasks#start-async-task-body-payload)

- **Type**: `object`
- **Required**: true

The body the endpoint's handler receives, validated against the endpoint's declared input schema. An endpoint that declares none takes it unvalidated.

### [Response](https://runware.ai/docs/serverless/api-tasks#start-async-task-response)

### [id](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-id)

- **Type**: `string`
- **Required**: true

Task identifier, supplied by the caller when the task was submitted.

### [status](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-status)

- **Type**: `string`
- **Required**: true

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Possible values**: `pending` `completed` `failed` `canceled`

### [queueDepth](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-queuedepth)

- **Type**: `integer`
- **Format**: `int64`
- **Min**: `0`

Messages still waiting on this app's inference queue, present only on the `202` from `invoke-sync` when the wait window expired and the broker could be read. It is the broker's ready count at that moment, and it leaves out work a worker has already taken. Zero means the queue was empty, including an app whose queue has not been declared. Omitted on every other task response, and omitted when the count could not be read: a missing field is not an empty queue. `runtime.queueDepth` on the app is a different reading, the last stored sample of ready and unacknowledged messages.

### [appId](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier. Unique among the authenticated organization's live apps in one environment: it cannot be changed after creation, it becomes available again once the app it named reaches `deleted`, and the same id may run once in each environment as a separate copy.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

### [endpointId](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-endpointid)

- **Type**: `string (uuid)`
- **Format**: `UUID v4`

Allocated endpoint row, the same UUID as `Endpoint.id`. Present when the live row at `endpointPath` was created at or before this task. Omitted when that path has no live row, when this task has no creation time, and when this task predates the live row: a path removed and added again is a different endpoint, and this id must not name it. Read from a cache, so it is best effort: also omitted when the cached endpoint rows are older than this task and could not be read again (a later read returns it), and a removed endpoint's id can still be returned for a short while after the removal. Metrics filters take this id, not `endpointPath`.

### [output](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-output)

- **Type**: `any`

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null. For a code app this is the value the handler returned, or the value `encode_response` returned when the app defines one: it is not wrapped, and a single request's value is that return rather than a one-element list of it. For a container app this is the response body the container returned. Absent on a listed task whose `outputOmitted` is `true`.

### [outputOmitted](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-outputomitted)

- **Type**: `boolean`

`true` on an entry of `GET /v1/apps/{appId}/tasks` whose `status` is `completed` but whose `output` is absent because the listing omitted it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Read it with `GET /v1/apps/{appId}/tasks/{taskId}`. Absent everywhere else.

### [error](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-error)

- **Type**: `string (nullable)`

Unstructured error message when `status` is `failed`. Null otherwise. It reports a task the platform accepted and that then failed. Its wording is not part of this contract: it carries no stable code or retry signal, so do not parse it to classify a failure.

### [createdAt](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-createdat)

- **Type**: `string (date-time)`
- **Required**: true
- **Format**: `date-time`

### [completedAt](https://runware.ai/docs/serverless/api-tasks#start-async-task-response-completedat)

- **Type**: `string (date-time) (nullable)`
- **Format**: `date-time`

### [Errors](https://runware.ai/docs/serverless/api-tasks#start-async-task-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">400</code></td><td data-rw-cid-pz7tphoj="true">The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns <code class="component-Code">422</code> instead.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">403</code></td><td data-rw-cid-pz7tphoj="true">Authenticated but not permitted to access this resource</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">The app does not exist, or it exists and does not declare the endpoint path. An undeclared endpoint carries <code class="component-Code">endpointPath</code> with the rejected path. Its absence means the app itself was not found.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">409</code></td><td data-rw-cid-pz7tphoj="true">Resource already exists or the request conflicts with its current state</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">413</code></td><td data-rw-cid-pz7tphoj="true">The request body exceeds its size limit: 10 MiB on <code class="component-Code">invoke-sync</code> and <code class="component-Code">invoke-async</code>, whose body carries the endpoint's payload, and 1 MiB on the other operations that answer with this response. <code class="component-Code">detail</code> names the limit in bytes.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">415</code></td><td data-rw-cid-pz7tphoj="true">The request body arrived with a Content-Type this operation does not accept. The body was not decoded, so this is not a schema failure. A body of <code class="component-Code">application/json</code> that cannot be parsed returns <code class="component-Code">400</code>. One that parses and breaks the schema returns <code class="component-Code">422</code>. A body sent with no Content-Type is the same refusal.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">429</code></td><td data-rw-cid-pz7tphoj="true"><code class="component-Code">environment-paused</code> means the app's environment is paused: its spend this UTC month has reached its monthly budget with <code class="component-Code">pauseAtBudget</code> on. No task is started. The pause holds until the budget is raised past the spend or the month turns, so there is no <code class="component-Code">Retry-After</code>; resume the app once it ends.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">The invocation was refused, broker acceptance is uncertain, or a completed task's output is temporarily unavailable. The problem <code class="component-Code">type</code> identifies the reason. <code class="component-Code">capacity-unavailable</code> means the app is deployed and correct, and the platform has no workload able to serve it: the app is short of the workers it asks for, or it has work waiting and nothing running it. No task was minted. The request is unchanged by the refusal and succeeds as sent once capacity returns, so retry it rather than correct it, after <code class="component-Code">Retry-After</code> where that header is present. Read <code class="component-Code">health.reason</code> on the app to tell the two capacity conditions apart. <code class="component-Code">detail</code> is <code class="component-Code">app has no workload able to serve this invocation</code>. When the current unavailable spell recorded the runtime's quoted line, that sentence follows it. A capacity shortfall does not carry a line from an earlier spell. Clients switch on <code class="component-Code">type</code>, never on <code class="component-Code">detail</code>. <code class="component-Code">service-unavailable</code> means something this route depends on is temporarily unreachable, or the organization's serverless tenancy is still being provisioned. It also covers an unconfirmed broker publish. RabbitMQ may already hold the task in that case. Retry with the same <code class="component-Code">taskId</code> to avoid starting a second task. It is also the type for an unavailable app whose <code class="component-Code">health.reason</code> is not a capacity shortfall, such as a workload that failed to start, is missing or is terminating. A missing or terminating workload does not recover on retry, and a failed start usually does not: read <code class="component-Code">health.reason</code>, then correct or redeploy the app. For this refusal, <code class="component-Code">detail</code> is the same sentence as for a capacity refusal, followed by the runtime's quoted line when one was recorded in the current unavailable spell or the two minutes before it, as in the <code class="component-Code">application-line</code> example. An exception to "a failed start usually does not recover" is <code class="component-Code">start_failed</code> while the platform holds stops because many apps fail to start at once, which it treats as its own fault: the app stays <code class="component-Code">active</code> and its workers keep retrying, so it recovers on its own if a worker becomes ready. The hold lasts only while that burst does: an app still failing to start when it clears is stopped like any other, and its invocations then get <code class="component-Code">409</code> with its own <code class="component-Code">detail</code>. The response does not show whether the hold applies, and it is not the only case where a <code class="component-Code">start_failed</code> app stays <code class="component-Code">active</code> for a while, so do not rely on a retry succeeding. A queued invocation can also return this type when a finished task's output cannot be read yet. Retry with the same <code class="component-Code">taskId</code> within the recovery window so the work is not queued again, or read the existing task with <code class="component-Code">GET /v1/apps/{appId}/tasks/{taskId}</code>.</td></tr></tbody></table>

## Start a sync task on the default endpoint

POSTapi.serverless.runware.ai/v1/apps/{appId}/invoke-sync

Starts a new sync task on `appId`, routing the request body payload to the app's default endpoint: the one it marks as its default, or its only endpoint when it has exactly one. The request body, responses, and task semantics match `POST /v1/apps/{appId}/invoke-sync/{endpointPath}`. An app with more than one endpoint that marks none of them as its default returns `404` with no `endpointPath` member and a detail naming the requirement. An unknown or deleted app returns the same status with a detail that does not name a missing default. When the task service cannot be reached, the response is `502 Bad Gateway`. The request may already have been accepted, so retry with the same `taskId`. A sync request still waiting when the API instance serving it shuts down gets that `502` too: the task carries on, so retry with the same `taskId`. An internal failure's `detail` names the task service instead of repeating the title.

### [Request](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

Body

### [taskId](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-body-taskid)

- **Type**: `string (uuid)`
- **Required**: true
- **Format**: `UUID v4`
- **Min**: `36`
- **Max**: `36`

Client-generated task identifier, canonical lowercase UUID. Retry with the same id to recover an existing task without starting a second one. The retry can return `503` while broker acceptance is uncertain. Use a unique id for each new request.

### [payload](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-body-payload)

- **Type**: `object`
- **Required**: true

The body the endpoint's handler receives, validated against the endpoint's declared input schema. An endpoint that declares none takes it unvalidated.

### [Response](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response)

### [id](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-id)

- **Type**: `string`
- **Required**: true

Task identifier, supplied by the caller when the task was submitted.

### [status](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-status)

- **Type**: `string`
- **Required**: true

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Possible values**: `pending` `completed` `failed` `canceled`

### [queueDepth](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-queuedepth)

- **Type**: `integer`
- **Format**: `int64`
- **Min**: `0`

Messages still waiting on this app's inference queue, present only on the `202` from `invoke-sync` when the wait window expired and the broker could be read. It is the broker's ready count at that moment, and it leaves out work a worker has already taken. Zero means the queue was empty, including an app whose queue has not been declared. Omitted on every other task response, and omitted when the count could not be read: a missing field is not an empty queue. `runtime.queueDepth` on the app is a different reading, the last stored sample of ready and unacknowledged messages.

### [appId](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier. Unique among the authenticated organization's live apps in one environment: it cannot be changed after creation, it becomes available again once the app it named reaches `deleted`, and the same id may run once in each environment as a separate copy.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

### [endpointId](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-endpointid)

- **Type**: `string (uuid)`
- **Format**: `UUID v4`

Allocated endpoint row, the same UUID as `Endpoint.id`. Present when the live row at `endpointPath` was created at or before this task. Omitted when that path has no live row, when this task has no creation time, and when this task predates the live row: a path removed and added again is a different endpoint, and this id must not name it. Read from a cache, so it is best effort: also omitted when the cached endpoint rows are older than this task and could not be read again (a later read returns it), and a removed endpoint's id can still be returned for a short while after the removal. Metrics filters take this id, not `endpointPath`.

### [output](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-output)

- **Type**: `any`

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null. For a code app this is the value the handler returned, or the value `encode_response` returned when the app defines one: it is not wrapped, and a single request's value is that return rather than a one-element list of it. For a container app this is the response body the container returned. Absent on a listed task whose `outputOmitted` is `true`.

### [outputOmitted](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-outputomitted)

- **Type**: `boolean`

`true` on an entry of `GET /v1/apps/{appId}/tasks` whose `status` is `completed` but whose `output` is absent because the listing omitted it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Read it with `GET /v1/apps/{appId}/tasks/{taskId}`. Absent everywhere else.

### [error](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-error)

- **Type**: `string (nullable)`

Unstructured error message when `status` is `failed`. Null otherwise. It reports a task the platform accepted and that then failed. Its wording is not part of this contract: it carries no stable code or retry signal, so do not parse it to classify a failure.

### [createdAt](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-createdat)

- **Type**: `string (date-time)`
- **Required**: true
- **Format**: `date-time`

### [completedAt](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-response-completedat)

- **Type**: `string (date-time) (nullable)`
- **Format**: `date-time`

### [Errors](https://runware.ai/docs/serverless/api-tasks#start-default-sync-task-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">400</code></td><td data-rw-cid-pz7tphoj="true">The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns <code class="component-Code">422</code> instead.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">403</code></td><td data-rw-cid-pz7tphoj="true">Authenticated but not permitted to access this resource</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">The app does not exist, or it exists and does not declare the endpoint path. An undeclared endpoint carries <code class="component-Code">endpointPath</code> with the rejected path. Its absence means the app itself was not found.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">409</code></td><td data-rw-cid-pz7tphoj="true">Resource already exists or the request conflicts with its current state</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">413</code></td><td data-rw-cid-pz7tphoj="true">The request body exceeds its size limit: 10 MiB on <code class="component-Code">invoke-sync</code> and <code class="component-Code">invoke-async</code>, whose body carries the endpoint's payload, and 1 MiB on the other operations that answer with this response. <code class="component-Code">detail</code> names the limit in bytes.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">415</code></td><td data-rw-cid-pz7tphoj="true">The request body arrived with a Content-Type this operation does not accept. The body was not decoded, so this is not a schema failure. A body of <code class="component-Code">application/json</code> that cannot be parsed returns <code class="component-Code">400</code>. One that parses and breaks the schema returns <code class="component-Code">422</code>. A body sent with no Content-Type is the same refusal.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">429</code></td><td data-rw-cid-pz7tphoj="true"><code class="component-Code">environment-paused</code> means the app's environment is paused: its spend this UTC month has reached its monthly budget with <code class="component-Code">pauseAtBudget</code> on. No task is started. The pause holds until the budget is raised past the spend or the month turns, so there is no <code class="component-Code">Retry-After</code>; resume the app once it ends.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">The invocation was refused, broker acceptance is uncertain, or a completed task's output is temporarily unavailable. The problem <code class="component-Code">type</code> identifies the reason. <code class="component-Code">capacity-unavailable</code> means the app is deployed and correct, and the platform has no workload able to serve it: the app is short of the workers it asks for, or it has work waiting and nothing running it. No task was minted. The request is unchanged by the refusal and succeeds as sent once capacity returns, so retry it rather than correct it, after <code class="component-Code">Retry-After</code> where that header is present. Read <code class="component-Code">health.reason</code> on the app to tell the two capacity conditions apart. <code class="component-Code">detail</code> is <code class="component-Code">app has no workload able to serve this invocation</code>. When the current unavailable spell recorded the runtime's quoted line, that sentence follows it. A capacity shortfall does not carry a line from an earlier spell. Clients switch on <code class="component-Code">type</code>, never on <code class="component-Code">detail</code>. <code class="component-Code">service-unavailable</code> means something this route depends on is temporarily unreachable, or the organization's serverless tenancy is still being provisioned. It also covers an unconfirmed broker publish. RabbitMQ may already hold the task in that case. Retry with the same <code class="component-Code">taskId</code> to avoid starting a second task. It is also the type for an unavailable app whose <code class="component-Code">health.reason</code> is not a capacity shortfall, such as a workload that failed to start, is missing or is terminating. A missing or terminating workload does not recover on retry, and a failed start usually does not: read <code class="component-Code">health.reason</code>, then correct or redeploy the app. For this refusal, <code class="component-Code">detail</code> is the same sentence as for a capacity refusal, followed by the runtime's quoted line when one was recorded in the current unavailable spell or the two minutes before it, as in the <code class="component-Code">application-line</code> example. An exception to "a failed start usually does not recover" is <code class="component-Code">start_failed</code> while the platform holds stops because many apps fail to start at once, which it treats as its own fault: the app stays <code class="component-Code">active</code> and its workers keep retrying, so it recovers on its own if a worker becomes ready. The hold lasts only while that burst does: an app still failing to start when it clears is stopped like any other, and its invocations then get <code class="component-Code">409</code> with its own <code class="component-Code">detail</code>. The response does not show whether the hold applies, and it is not the only case where a <code class="component-Code">start_failed</code> app stays <code class="component-Code">active</code> for a while, so do not rely on a retry succeeding. A queued invocation can also return this type when a finished task's output cannot be read yet. Retry with the same <code class="component-Code">taskId</code> within the recovery window so the work is not queued again, or read the existing task with <code class="component-Code">GET /v1/apps/{appId}/tasks/{taskId}</code>.</td></tr></tbody></table>

## Start an async task on the default endpoint

POSTapi.serverless.runware.ai/v1/apps/{appId}/invoke-async

Starts a new async task on `appId`, routing the request body payload to the app's default endpoint: the one it marks as its default, or its only endpoint when it has exactly one. The request body, responses, and task semantics match `POST /v1/apps/{appId}/invoke-async/{endpointPath}`. An app with more than one endpoint that marks none of them as its default returns `404` with no `endpointPath` member and a detail naming the requirement. An unknown or deleted app returns the same status with a detail that does not name a missing default. When the task service cannot be reached, the response is `502 Bad Gateway`. The request may already have been accepted, so retry with the same `taskId`. An internal failure's `detail` names the task service instead of repeating the title.

### [Request](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

Body

### [taskId](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-body-taskid)

- **Type**: `string (uuid)`
- **Required**: true
- **Format**: `UUID v4`
- **Min**: `36`
- **Max**: `36`

Client-generated task identifier, canonical lowercase UUID. Retry with the same id to recover an existing task without starting a second one. The retry can return `503` while broker acceptance is uncertain. Use a unique id for each new request.

### [payload](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-body-payload)

- **Type**: `object`
- **Required**: true

The body the endpoint's handler receives, validated against the endpoint's declared input schema. An endpoint that declares none takes it unvalidated.

### [Response](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response)

### [id](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-id)

- **Type**: `string`
- **Required**: true

Task identifier, supplied by the caller when the task was submitted.

### [status](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-status)

- **Type**: `string`
- **Required**: true

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Possible values**: `pending` `completed` `failed` `canceled`

### [queueDepth](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-queuedepth)

- **Type**: `integer`
- **Format**: `int64`
- **Min**: `0`

Messages still waiting on this app's inference queue, present only on the `202` from `invoke-sync` when the wait window expired and the broker could be read. It is the broker's ready count at that moment, and it leaves out work a worker has already taken. Zero means the queue was empty, including an app whose queue has not been declared. Omitted on every other task response, and omitted when the count could not be read: a missing field is not an empty queue. `runtime.queueDepth` on the app is a different reading, the last stored sample of ready and unacknowledged messages.

### [appId](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier. Unique among the authenticated organization's live apps in one environment: it cannot be changed after creation, it becomes available again once the app it named reaches `deleted`, and the same id may run once in each environment as a separate copy.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

### [endpointId](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-endpointid)

- **Type**: `string (uuid)`
- **Format**: `UUID v4`

Allocated endpoint row, the same UUID as `Endpoint.id`. Present when the live row at `endpointPath` was created at or before this task. Omitted when that path has no live row, when this task has no creation time, and when this task predates the live row: a path removed and added again is a different endpoint, and this id must not name it. Read from a cache, so it is best effort: also omitted when the cached endpoint rows are older than this task and could not be read again (a later read returns it), and a removed endpoint's id can still be returned for a short while after the removal. Metrics filters take this id, not `endpointPath`.

### [output](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-output)

- **Type**: `any`

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null. For a code app this is the value the handler returned, or the value `encode_response` returned when the app defines one: it is not wrapped, and a single request's value is that return rather than a one-element list of it. For a container app this is the response body the container returned. Absent on a listed task whose `outputOmitted` is `true`.

### [outputOmitted](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-outputomitted)

- **Type**: `boolean`

`true` on an entry of `GET /v1/apps/{appId}/tasks` whose `status` is `completed` but whose `output` is absent because the listing omitted it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Read it with `GET /v1/apps/{appId}/tasks/{taskId}`. Absent everywhere else.

### [error](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-error)

- **Type**: `string (nullable)`

Unstructured error message when `status` is `failed`. Null otherwise. It reports a task the platform accepted and that then failed. Its wording is not part of this contract: it carries no stable code or retry signal, so do not parse it to classify a failure.

### [createdAt](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-createdat)

- **Type**: `string (date-time)`
- **Required**: true
- **Format**: `date-time`

### [completedAt](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-response-completedat)

- **Type**: `string (date-time) (nullable)`
- **Format**: `date-time`

### [Errors](https://runware.ai/docs/serverless/api-tasks#start-default-async-task-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">400</code></td><td data-rw-cid-pz7tphoj="true">The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns <code class="component-Code">422</code> instead.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">403</code></td><td data-rw-cid-pz7tphoj="true">Authenticated but not permitted to access this resource</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">The app does not exist, or it exists and does not declare the endpoint path. An undeclared endpoint carries <code class="component-Code">endpointPath</code> with the rejected path. Its absence means the app itself was not found.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">409</code></td><td data-rw-cid-pz7tphoj="true">Resource already exists or the request conflicts with its current state</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">413</code></td><td data-rw-cid-pz7tphoj="true">The request body exceeds its size limit: 10 MiB on <code class="component-Code">invoke-sync</code> and <code class="component-Code">invoke-async</code>, whose body carries the endpoint's payload, and 1 MiB on the other operations that answer with this response. <code class="component-Code">detail</code> names the limit in bytes.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">415</code></td><td data-rw-cid-pz7tphoj="true">The request body arrived with a Content-Type this operation does not accept. The body was not decoded, so this is not a schema failure. A body of <code class="component-Code">application/json</code> that cannot be parsed returns <code class="component-Code">400</code>. One that parses and breaks the schema returns <code class="component-Code">422</code>. A body sent with no Content-Type is the same refusal.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">429</code></td><td data-rw-cid-pz7tphoj="true"><code class="component-Code">environment-paused</code> means the app's environment is paused: its spend this UTC month has reached its monthly budget with <code class="component-Code">pauseAtBudget</code> on. No task is started. The pause holds until the budget is raised past the spend or the month turns, so there is no <code class="component-Code">Retry-After</code>; resume the app once it ends.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">The invocation was refused, broker acceptance is uncertain, or a completed task's output is temporarily unavailable. The problem <code class="component-Code">type</code> identifies the reason. <code class="component-Code">capacity-unavailable</code> means the app is deployed and correct, and the platform has no workload able to serve it: the app is short of the workers it asks for, or it has work waiting and nothing running it. No task was minted. The request is unchanged by the refusal and succeeds as sent once capacity returns, so retry it rather than correct it, after <code class="component-Code">Retry-After</code> where that header is present. Read <code class="component-Code">health.reason</code> on the app to tell the two capacity conditions apart. <code class="component-Code">detail</code> is <code class="component-Code">app has no workload able to serve this invocation</code>. When the current unavailable spell recorded the runtime's quoted line, that sentence follows it. A capacity shortfall does not carry a line from an earlier spell. Clients switch on <code class="component-Code">type</code>, never on <code class="component-Code">detail</code>. <code class="component-Code">service-unavailable</code> means something this route depends on is temporarily unreachable, or the organization's serverless tenancy is still being provisioned. It also covers an unconfirmed broker publish. RabbitMQ may already hold the task in that case. Retry with the same <code class="component-Code">taskId</code> to avoid starting a second task. It is also the type for an unavailable app whose <code class="component-Code">health.reason</code> is not a capacity shortfall, such as a workload that failed to start, is missing or is terminating. A missing or terminating workload does not recover on retry, and a failed start usually does not: read <code class="component-Code">health.reason</code>, then correct or redeploy the app. For this refusal, <code class="component-Code">detail</code> is the same sentence as for a capacity refusal, followed by the runtime's quoted line when one was recorded in the current unavailable spell or the two minutes before it, as in the <code class="component-Code">application-line</code> example. An exception to "a failed start usually does not recover" is <code class="component-Code">start_failed</code> while the platform holds stops because many apps fail to start at once, which it treats as its own fault: the app stays <code class="component-Code">active</code> and its workers keep retrying, so it recovers on its own if a worker becomes ready. The hold lasts only while that burst does: an app still failing to start when it clears is stopped like any other, and its invocations then get <code class="component-Code">409</code> with its own <code class="component-Code">detail</code>. The response does not show whether the hold applies, and it is not the only case where a <code class="component-Code">start_failed</code> app stays <code class="component-Code">active</code> for a while, so do not rely on a retry succeeding. A queued invocation can also return this type when a finished task's output cannot be read yet. Retry with the same <code class="component-Code">taskId</code> within the recovery window so the work is not queued again, or read the existing task with <code class="component-Code">GET /v1/apps/{appId}/tasks/{taskId}</code>.</td></tr></tbody></table>

## Get a task

GETapi.serverless.runware.ai/v1/apps/{appId}/tasks/{taskId}

Returns the task's current status, read through the inference transport layer from the shared result store. When `completed`, includes the result `output` and `completedAt`. When `failed`, includes `error`. When `canceled`, includes `completedAt`, the time it was canceled. When `pending`, neither is set. If the app is `stopped`, `deleting`, or `failed`, accepted task results stay readable. A `404 Not Found` means the task cannot currently be verified for this app. Because enqueue-time ownership tracking is best effort, a recently returned task ID can temporarily return `404`. Retry it within the normal polling window. Unknown or deleted apps also return `404 Not Found`. When the task service cannot be reached, the response is `502 Bad Gateway`, and the read can be retried. When the task or its output is temporarily unavailable, for example while the task service is being updated, the response is `503 Service Unavailable`, and the read can be retried.

### [Request](https://runware.ai/docs/serverless/api-tasks#get-task-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#get-task-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

### [taskId](https://runware.ai/docs/serverless/api-tasks#get-task-path-taskid)

- **Type**: `string (uuid)`
- **Required**: true
- **Format**: `UUID v4`
- **Min**: `36`
- **Max**: `36`

Task identifier, supplied by the caller when the task was submitted.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#get-task-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

### [Response](https://runware.ai/docs/serverless/api-tasks#get-task-response)

### [id](https://runware.ai/docs/serverless/api-tasks#get-task-response-id)

- **Type**: `string`
- **Required**: true

Task identifier, supplied by the caller when the task was submitted.

### [status](https://runware.ai/docs/serverless/api-tasks#get-task-response-status)

- **Type**: `string`
- **Required**: true

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Possible values**: `pending` `completed` `failed` `canceled`

### [queueDepth](https://runware.ai/docs/serverless/api-tasks#get-task-response-queuedepth)

- **Type**: `integer`
- **Format**: `int64`
- **Min**: `0`

Messages still waiting on this app's inference queue, present only on the `202` from `invoke-sync` when the wait window expired and the broker could be read. It is the broker's ready count at that moment, and it leaves out work a worker has already taken. Zero means the queue was empty, including an app whose queue has not been declared. Omitted on every other task response, and omitted when the count could not be read: a missing field is not an empty queue. `runtime.queueDepth` on the app is a different reading, the last stored sample of ready and unacknowledged messages.

### [appId](https://runware.ai/docs/serverless/api-tasks#get-task-response-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier. Unique among the authenticated organization's live apps in one environment: it cannot be changed after creation, it becomes available again once the app it named reaches `deleted`, and the same id may run once in each environment as a separate copy.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#get-task-response-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

### [endpointId](https://runware.ai/docs/serverless/api-tasks#get-task-response-endpointid)

- **Type**: `string (uuid)`
- **Format**: `UUID v4`

Allocated endpoint row, the same UUID as `Endpoint.id`. Present when the live row at `endpointPath` was created at or before this task. Omitted when that path has no live row, when this task has no creation time, and when this task predates the live row: a path removed and added again is a different endpoint, and this id must not name it. Read from a cache, so it is best effort: also omitted when the cached endpoint rows are older than this task and could not be read again (a later read returns it), and a removed endpoint's id can still be returned for a short while after the removal. Metrics filters take this id, not `endpointPath`.

### [output](https://runware.ai/docs/serverless/api-tasks#get-task-response-output)

- **Type**: `any`

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null. For a code app this is the value the handler returned, or the value `encode_response` returned when the app defines one: it is not wrapped, and a single request's value is that return rather than a one-element list of it. For a container app this is the response body the container returned. Absent on a listed task whose `outputOmitted` is `true`.

### [outputOmitted](https://runware.ai/docs/serverless/api-tasks#get-task-response-outputomitted)

- **Type**: `boolean`

`true` on an entry of `GET /v1/apps/{appId}/tasks` whose `status` is `completed` but whose `output` is absent because the listing omitted it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Read it with `GET /v1/apps/{appId}/tasks/{taskId}`. Absent everywhere else.

### [error](https://runware.ai/docs/serverless/api-tasks#get-task-response-error)

- **Type**: `string (nullable)`

Unstructured error message when `status` is `failed`. Null otherwise. It reports a task the platform accepted and that then failed. Its wording is not part of this contract: it carries no stable code or retry signal, so do not parse it to classify a failure.

### [createdAt](https://runware.ai/docs/serverless/api-tasks#get-task-response-createdat)

- **Type**: `string (date-time)`
- **Required**: true
- **Format**: `date-time`

### [completedAt](https://runware.ai/docs/serverless/api-tasks#get-task-response-completedat)

- **Type**: `string (date-time) (nullable)`
- **Format**: `date-time`

### [Errors](https://runware.ai/docs/serverless/api-tasks#get-task-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">Resource not found</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">A required service is temporarily unavailable</td></tr></tbody></table>

## List tasks

GETapi.serverless.runware.ai/v1/apps/{appId}/tasks

Lists TTL-bounded task metadata for this app, sync and async, so a client can recover task ids after an interrupted long-poll or CLI session. Pending includes queued, running and retrying work. Tasks appear only within the configured recovery window. A page can be empty and still have `nextCursor`. Continue until it is null. Pending entries are best effort and may disappear if the recovery store restarts. Tracked tasks reappear on completion. A `completed` task carries the same `output` that `GET /v1/apps/{appId}/tasks/{taskId}` returns for it, unless the listing omits it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Such a task has no `output` and carries `outputOmitted: true`; read it with `GET /v1/apps/{appId}/tasks/{taskId}`. A page carries at most 1 MiB of stored outputs, so it can hold fewer than `limit` tasks; continue with `nextCursor`. A task whose output cannot be read yet is listed as `pending`, as that read would report it, and is left out of a page filtered on `completed`. This is not persisted task history. A task id names one task, so resubmitting one does not add a second entry here. If the app is `stopped`, `deleting`, or `failed`, recovery stays available. Unknown or deleted apps return `404 Not Found`. When the task service cannot be reached, the response is `502 Bad Gateway`, and the list can be retried.

### [Request](https://runware.ai/docs/serverless/api-tasks#list-tasks-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#list-tasks-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#list-tasks-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

### [limit](https://runware.ai/docs/serverless/api-tasks#list-tasks-query-limit)

- **Type**: `integer`
- **Format**: `int32`
- **Min**: `1`
- **Max**: `100`
- **Default**: `20`

Maximum number of items to return.

### [cursor](https://runware.ai/docs/serverless/api-tasks#list-tasks-query-cursor)

- **Type**: `string`

Opaque pagination cursor returned by a previous call, as `nextCursor` or, on the operations that offer one, `prevCursor`.

### [status](https://runware.ai/docs/serverless/api-tasks#list-tasks-query-status)

- **Type**: `string`

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Allowed values**: `pending` `completed` `failed` `canceled`

### [Response](https://runware.ai/docs/serverless/api-tasks#list-tasks-response)

### [nextCursor](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-nextcursor)

- **Type**: `string (nullable)`

Cursor for the next page. Null when there are no more items.

### [data](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data)

- **Type**: `object[] (11 properties)`

#### [id](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-id)

- **Type**: `string`
- **Required**: true

Task identifier, supplied by the caller when the task was submitted.

#### [status](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-status)

- **Type**: `string`
- **Required**: true

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Possible values**: `pending` `completed` `failed` `canceled`

#### [queueDepth](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-queuedepth)

- **Type**: `integer`
- **Format**: `int64`
- **Min**: `0`

Messages still waiting on this app's inference queue, present only on the `202` from `invoke-sync` when the wait window expired and the broker could be read. It is the broker's ready count at that moment, and it leaves out work a worker has already taken. Zero means the queue was empty, including an app whose queue has not been declared. Omitted on every other task response, and omitted when the count could not be read: a missing field is not an empty queue. `runtime.queueDepth` on the app is a different reading, the last stored sample of ready and unacknowledged messages.

#### [appId](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier. Unique among the authenticated organization's live apps in one environment: it cannot be changed after creation, it becomes available again once the app it named reaches `deleted`, and the same id may run once in each environment as a separate copy.

#### [endpointPath](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

#### [endpointId](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-endpointid)

- **Type**: `string (uuid)`
- **Format**: `UUID v4`

Allocated endpoint row, the same UUID as `Endpoint.id`. Present when the live row at `endpointPath` was created at or before this task. Omitted when that path has no live row, when this task has no creation time, and when this task predates the live row: a path removed and added again is a different endpoint, and this id must not name it. Read from a cache, so it is best effort: also omitted when the cached endpoint rows are older than this task and could not be read again (a later read returns it), and a removed endpoint's id can still be returned for a short while after the removal. Metrics filters take this id, not `endpointPath`.

#### [output](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-output)

- **Type**: `any`

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null. For a code app this is the value the handler returned, or the value `encode_response` returned when the app defines one: it is not wrapped, and a single request's value is that return rather than a one-element list of it. For a container app this is the response body the container returned. Absent on a listed task whose `outputOmitted` is `true`.

#### [outputOmitted](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-outputomitted)

- **Type**: `boolean`

`true` on an entry of `GET /v1/apps/{appId}/tasks` whose `status` is `completed` but whose `output` is absent because the listing omitted it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Read it with `GET /v1/apps/{appId}/tasks/{taskId}`. Absent everywhere else.

#### [error](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-error)

- **Type**: `string (nullable)`

Unstructured error message when `status` is `failed`. Null otherwise. It reports a task the platform accepted and that then failed. Its wording is not part of this contract: it carries no stable code or retry signal, so do not parse it to classify a failure.

#### [createdAt](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-createdat)

- **Type**: `string (date-time)`
- **Required**: true
- **Format**: `date-time`

#### [completedAt](https://runware.ai/docs/serverless/api-tasks#list-tasks-response-data-completedat)

- **Type**: `string (date-time) (nullable)`
- **Format**: `date-time`

### [Errors](https://runware.ai/docs/serverless/api-tasks#list-tasks-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">400</code></td><td data-rw-cid-pz7tphoj="true">The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns <code class="component-Code">422</code> instead.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">Resource not found</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">A required service is temporarily unavailable</td></tr></tbody></table>

## Cancel a queued task

POSTapi.serverless.runware.ai/v1/apps/{appId}/tasks/{taskId}/cancel

Cancels a task that no worker has started. Its status becomes `canceled`, a caller waiting on it with `invoke-sync` gets it back as `canceled`, and it does not run while its record exists. The task's queued message stays in the queue until a worker takes it and skips it, so a queue that holds only canceled tasks can still start a worker, which is billed for the time it runs. An app resumed after the record has expired, 24 hours by default, can run the task. To clear the queue too, cancel all queued tasks with `POST /v1/apps/{appId}/tasks/cancel`. Canceling a canceled task returns it again. A queued task is found by id for an hour after it was submitted, by default. After that the call returns `404`, and canceling all queued tasks is the way to clear it. A task that is already running, completed or failed returns `409` typed `task-not-cancelable` and is not changed. A task no worker has started, on an app whose workers cannot yet be shown to skip a canceled task, returns `409` typed `task-cancel-unsupported` and is not changed; cancel all queued tasks for that app instead. A task already canceled, and an unknown task, are answered the same on every app. Works on a stopped app.

### [Request](https://runware.ai/docs/serverless/api-tasks#cancel-task-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#cancel-task-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

### [taskId](https://runware.ai/docs/serverless/api-tasks#cancel-task-path-taskid)

- **Type**: `string (uuid)`
- **Required**: true
- **Format**: `UUID v4`
- **Min**: `36`
- **Max**: `36`

Task identifier, supplied by the caller when the task was submitted.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#cancel-task-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

### [Response](https://runware.ai/docs/serverless/api-tasks#cancel-task-response)

### [id](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-id)

- **Type**: `string`
- **Required**: true

Task identifier, supplied by the caller when the task was submitted.

### [status](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-status)

- **Type**: `string`
- **Required**: true

`canceled` is a task canceled before any worker started it. It never ran, and it has no `output` or `error`.

**Possible values**: `pending` `completed` `failed` `canceled`

### [queueDepth](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-queuedepth)

- **Type**: `integer`
- **Format**: `int64`
- **Min**: `0`

Messages still waiting on this app's inference queue, present only on the `202` from `invoke-sync` when the wait window expired and the broker could be read. It is the broker's ready count at that moment, and it leaves out work a worker has already taken. Zero means the queue was empty, including an app whose queue has not been declared. Omitted on every other task response, and omitted when the count could not be read: a missing field is not an empty queue. `runtime.queueDepth` on the app is a different reading, the last stored sample of ready and unacknowledged messages.

### [appId](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier. Unique among the authenticated organization's live apps in one environment: it cannot be changed after creation, it becomes available again once the app it named reaches `deleted`, and the same id may run once in each environment as a separate copy.

### [endpointPath](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-endpointpath)

- **Type**: `string`
- **Required**: true
- **Min**: `1`
- **Max**: `255`

Path of the endpoint to route the task to: one or more bare lowercase segments joined by slashes, such as `generate` or `v1/chat/completions`, with no leading or trailing slash. Send those slashes unencoded. A generated client that escapes `/` as `%2F` is rejected with `422`.

### [endpointId](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-endpointid)

- **Type**: `string (uuid)`
- **Format**: `UUID v4`

Allocated endpoint row, the same UUID as `Endpoint.id`. Present when the live row at `endpointPath` was created at or before this task. Omitted when that path has no live row, when this task has no creation time, and when this task predates the live row: a path removed and added again is a different endpoint, and this id must not name it. Read from a cache, so it is best effort: also omitted when the cached endpoint rows are older than this task and could not be read again (a later read returns it), and a removed endpoint's id can still be returned for a short while after the removal. Metrics filters take this id, not `endpointPath`.

### [output](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-output)

- **Type**: `any`

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null. For a code app this is the value the handler returned, or the value `encode_response` returned when the app defines one: it is not wrapped, and a single request's value is that return rather than a one-element list of it. For a container app this is the response body the container returned. Absent on a listed task whose `outputOmitted` is `true`.

### [outputOmitted](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-outputomitted)

- **Type**: `boolean`

`true` on an entry of `GET /v1/apps/{appId}/tasks` whose `status` is `completed` but whose `output` is absent because the listing omitted it. The listing omits an output if its stored JSON exceeds 128 KiB or is larger than the page's output budget. A deeply nested output is also omitted. An output can also be omitted if it grows after its size is measured. Read it with `GET /v1/apps/{appId}/tasks/{taskId}`. Absent everywhere else.

### [error](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-error)

- **Type**: `string (nullable)`

Unstructured error message when `status` is `failed`. Null otherwise. It reports a task the platform accepted and that then failed. Its wording is not part of this contract: it carries no stable code or retry signal, so do not parse it to classify a failure.

### [createdAt](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-createdat)

- **Type**: `string (date-time)`
- **Required**: true
- **Format**: `date-time`

### [completedAt](https://runware.ai/docs/serverless/api-tasks#cancel-task-response-completedat)

- **Type**: `string (date-time) (nullable)`
- **Format**: `date-time`

### [Errors](https://runware.ai/docs/serverless/api-tasks#cancel-task-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">Resource not found</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">409</code></td><td data-rw-cid-pz7tphoj="true"><code class="component-Code">task-not-cancelable</code> means the task is already running, completed or failed, so it cannot be canceled. <code class="component-Code">task-cancel-unsupported</code> means the task has not started but the app's workers cannot be shown to skip a canceled task, so it cannot be canceled on its own. Cancel all queued tasks with <code class="component-Code">POST /v1/apps/{appId}/tasks/cancel</code> to clear that app's queue. Nothing is changed. Read the task with <code class="component-Code">GET /v1/apps/{appId}/tasks/{taskId}</code> for its status.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">A required service is temporarily unavailable</td></tr></tbody></table>

## Cancel every queued task

POSTapi.serverless.runware.ai/v1/apps/{appId}/tasks/cancel

Removes ready messages from the app's queue, then cancels the pending task records it can find with no recorded start. Resuming a stopped app starts no worker for the messages it removed. Workers continue any work already in progress. A task whose submission did not finish recording can lose its message here and stay `pending` until its dispatch deadline fails it or its record expires. A task whose worker died mid-run and whose message was requeued can lose it too, and stays `pending` until its record expires, since the dispatch deadline never fails a started task. A task submitted while the call runs can be canceled and still leave its message in the queue, which can start a billed worker. A message delivered before the purge can also survive it. A worker that checks the task record before recording its start skips a task it finds canceled. A worker that predates start recording can still execute a task whose cancellation was counted, and that execution can be billed. A task queued for more than an hour has no record to cancel: its message is removed, but it is not counted. Returns how many tasks this call canceled, not how many messages it removed, so `0` can follow an emptied queue. A `503` can leave some tasks canceled and others still queued, and can follow a queue the broker has already emptied. The call can be retried. Works on a stopped app.

### [Request](https://runware.ai/docs/serverless/api-tasks#cancel-queued-tasks-request)

Path

### [appId](https://runware.ai/docs/serverless/api-tasks#cancel-queued-tasks-path-appid)

- **Type**: `string`
- **Required**: true
- **Min**: `6`
- **Max**: `30`

Immutable app identifier, unique among the authenticated organization's live apps in one environment. The `environment` query parameter selects which copy the request addresses.

Query

### [environment](https://runware.ai/docs/serverless/api-tasks#cancel-queued-tasks-query-environment)

- **Type**: `string`
- **Min**: `1`
- **Max**: `63`

The environment the request addresses. An app id names one copy per environment, so this parameter completes the app's address: `appId` together with `environment` selects the copy. The app list and the app summary are limited to the environment, and an app, build, endpoint, worker, event, usage or attached-secret cursor is valid only in the environment it came from. A metric query that names no app covers the whole organization, and a log query covers this environment; a metric query expanded by app returns only the apps live in this environment. Omitted means `production`. A name the organization has no live environment under returns `404`.

### [Response](https://runware.ai/docs/serverless/api-tasks#cancel-queued-tasks-response)

### [canceled](https://runware.ai/docs/serverless/api-tasks#cancel-queued-tasks-response-canceled)

- **Type**: `integer`
- **Required**: true
- **Format**: `int64`
- **Min**: `0`

Tasks this call canceled, not counting any canceled earlier and not counting queued messages it removed that had no record.

### [Errors](https://runware.ai/docs/serverless/api-tasks#cancel-queued-tasks-errors)

<table><tbody><tr><td data-rw-cid-pz7tphoj="true">Status</td><td data-rw-cid-pz7tphoj="true">When</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">401</code></td><td data-rw-cid-pz7tphoj="true">Missing or invalid credentials</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">404</code></td><td data-rw-cid-pz7tphoj="true">Resource not found</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">422</code></td><td data-rw-cid-pz7tphoj="true">The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns <code class="component-Code">400</code>. The <code class="component-Code">errors</code> array carries one entry per offending field.</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">500</code></td><td data-rw-cid-pz7tphoj="true">Unexpected server error</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">502</code></td><td data-rw-cid-pz7tphoj="true">An upstream service was unreachable or refused the request, or the API instance shut down while the request waited</td></tr><tr><td data-rw-cid-pz7tphoj="true"><code data-rw-cid-pz7tphoj="">503</code></td><td data-rw-cid-pz7tphoj="true">A required service is temporarily unavailable</td></tr></tbody></table>