Tasks

Invoke an endpoint synchronously or asynchronously, then read the task back.

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 answers 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.

A 202 is not a failure. Poll the task with getTask under the appId the response names. See Invoking an app.

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 task id waits on the task it already names rather than starting a second one, so the 200 carries that task's result and may name a different appId. Poll it under the one returned. 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, the same shape invoke-async returns, and it names the owning appId on a resubmission just as the 200 does. Poll GET /v1/apps/{appId}/tasks/{taskId} for its result. A request the platform cannot attribute to an accepted task fails instead, with no task to poll. 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, typed capacity-unavailable and carrying Retry-After. stopped, deleting, and failed return 409 Conflict. 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.

Request

Path

appId

stringrequiredmin: 6max: 30

Immutable app identifier, unique among the authenticated organization's live apps.

endpointPath

stringrequiredmin: 1max: 255

Path of the endpoint to route the task to, as returned by listEndpoints: a bare lowercase segment such as generate, with no leading slash.

Body

taskId

string (uuid)requiredUUID v4min: 36max: 36

Client-generated task identifier, canonical lowercase UUID. One id is one task: resubmitting it is answered with the task it already names rather than starting a second, so a request whose response was lost can be sent again without paying for the work twice. Reusing an id for a different request returns the first task, so the id is the caller's to keep unique.

payload

objectrequired

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

Response

id

stringrequired

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

status

stringrequired
Possible values3 values

appId

stringrequiredmin: 6max: 30

Immutable app identifier. Unique among the authenticated organization's live apps: it cannot be changed after creation, and it becomes available again once the app it named reaches deleted.

endpointPath

stringrequiredmin: 1max: 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.

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null.

error

stringnullable

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

string (date-time)requireddate-time

completedAt

string (date-time)nullabledate-time

Errors

StatusWhen
400The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns 422 instead.
401Missing or invalid credentials
403Authenticated but not permitted to access this resource
404The app does not exist, or it exists and does not declare the endpoint path. An undeclared endpoint carries endpointPath with the rejected path. Its absence means the app itself was not found.
409Resource already exists or the request conflicts with its current state
413The request body exceeds its size limit: 10 MiB on invoke-sync and invoke-async, whose body carries the endpoint's payload, and 1 MiB on the other operations that answer with this response. detail names the limit in bytes.
422The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns 400. The errors array carries one entry per offending field.
500Unexpected server error
503The invocation could not be accepted and no task was minted. The problem type says which of two conditions applies, because the client's next move differs. capacity-unavailable 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. The request is unchanged by the refusal and succeeds as sent once capacity returns, so retry it rather than correct it, after Retry-After where that header is present. Read health.reason on the app to tell the two capacity conditions apart. service-unavailable means something this route depends on is temporarily unreachable, or the organization's serverless tenancy is still being provisioned. That is retryable too, but it says nothing about the app.

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 task id is answered with the task it already names rather than starting a second one, so the 202 can carry a task that has already finished: read its status instead of assuming pending, and note it may name a different appId. 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, typed capacity-unavailable and carrying Retry-After. stopped, deleting, and failed return 409 Conflict. 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.

Request

Path

appId

stringrequiredmin: 6max: 30

Immutable app identifier, unique among the authenticated organization's live apps.

endpointPath

stringrequiredmin: 1max: 255

Path of the endpoint to route the task to, as returned by listEndpoints: a bare lowercase segment such as generate, with no leading slash.

Body

taskId

string (uuid)requiredUUID v4min: 36max: 36

Client-generated task identifier, canonical lowercase UUID. One id is one task: resubmitting it is answered with the task it already names rather than starting a second, so a request whose response was lost can be sent again without paying for the work twice. Reusing an id for a different request returns the first task, so the id is the caller's to keep unique.

payload

objectrequired

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

Response

id

stringrequired

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

status

stringrequired
Possible values3 values

appId

stringrequiredmin: 6max: 30

Immutable app identifier. Unique among the authenticated organization's live apps: it cannot be changed after creation, and it becomes available again once the app it named reaches deleted.

endpointPath

stringrequiredmin: 1max: 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.

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null.

error

stringnullable

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

string (date-time)requireddate-time

completedAt

string (date-time)nullabledate-time

Errors

StatusWhen
400The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns 422 instead.
401Missing or invalid credentials
403Authenticated but not permitted to access this resource
404The app does not exist, or it exists and does not declare the endpoint path. An undeclared endpoint carries endpointPath with the rejected path. Its absence means the app itself was not found.
409Resource already exists or the request conflicts with its current state
413The request body exceeds its size limit: 10 MiB on invoke-sync and invoke-async, whose body carries the endpoint's payload, and 1 MiB on the other operations that answer with this response. detail names the limit in bytes.
422The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns 400. The errors array carries one entry per offending field.
500Unexpected server error
503The invocation could not be accepted and no task was minted. The problem type says which of two conditions applies, because the client's next move differs. capacity-unavailable 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. The request is unchanged by the refusal and succeeds as sent once capacity returns, so retry it rather than correct it, after Retry-After where that header is present. Read health.reason on the app to tell the two capacity conditions apart. service-unavailable means something this route depends on is temporarily unreachable, or the organization's serverless tenancy is still being provisioned. That is retryable too, but it says nothing about the app.

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 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.

Request

Path

appId

stringrequiredmin: 6max: 30

Immutable app identifier, unique among the authenticated organization's live apps.

taskId

string (uuid)requiredUUID v4min: 36max: 36

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

Response

id

stringrequired

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

status

stringrequired
Possible values3 values

appId

stringrequiredmin: 6max: 30

Immutable app identifier. Unique among the authenticated organization's live apps: it cannot be changed after creation, and it becomes available again once the app it named reaches deleted.

endpointPath

stringrequiredmin: 1max: 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.

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null.

error

stringnullable

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

string (date-time)requireddate-time

completedAt

string (date-time)nullabledate-time

Errors

StatusWhen
401Missing or invalid credentials
404Resource not found
422The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns 400. The errors array carries one entry per offending field.
500Unexpected server error
503A required service is temporarily unavailable

List tasks

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

Lists TTL-bounded asynchronous task metadata for this app 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. 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.

Request

Path

appId

stringrequiredmin: 6max: 30

Immutable app identifier, unique among the authenticated organization's live apps.

Query

limit

integerint32min: 1max: 100default: 20

Maximum number of items to return.

cursor

string

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

status

string
Allowed values3 values

Response

nextCursor

stringnullable

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

data

object[]
Array items8 properties each

id

stringrequired

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

status

stringrequired
Possible values3 values

appId

stringrequiredmin: 6max: 30

Immutable app identifier. Unique among the authenticated organization's live apps: it cannot be changed after creation, and it becomes available again once the app it named reaches deleted.

endpointPath

stringrequiredmin: 1max: 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.

Inference result payload on success. Null otherwise. May be any JSON value, including an object, array, string, number, boolean, or null.

error

stringnullable

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

string (date-time)requireddate-time

completedAt

string (date-time)nullabledate-time

Errors

StatusWhen
400The request was malformed and could not be parsed (e.g. invalid JSON). A well-formed request that fails validation returns 422 instead.
401Missing or invalid credentials
404Resource not found
422The request was well-formed but semantically invalid (e.g. a missing or out-of-range field). A request that could not be parsed returns 400. The errors array carries one entry per offending field.
500Unexpected server error
503A required service is temporarily unavailable