Skip to content

GET /v1/runs/:runId

Summary

Retrieve the current status and outputs of a previously created run using its runId. Use this to poll for completion after creating a run, or to fetch the final outputs later.

HTTP Request

http
GET /v1/runs/:runId

Path parameters

ParameterTypeRequiredDescription
runIdstringYesIdentifier of the run.

Response

Success (200 OK)

Returns a JSON object whose status is "SUCCESS" and a data object containing:

FieldTypeDescription
runIdstringIdentifier of the run.
outputsarray of objectsList of output items. Each item has a type field ("text", "image", or "error") and a data field containing the corresponding content. See Output item types.
runStatusstringStatus of the run. Possible values include "queued", "running", "succeeded", and "failed". See Run status.
tokensintegerBetterPrompt tokens consumed. See account page for token details.

An example succeeded run:

json
{
  "status": "SUCCESS",
  "data": {
    "runId": "01234567-89ab-cdef-0123-456789abcdef",
    "outputs": [{ "type": "text", "data": "A witty caption for your image…" }],
    "runStatus": "succeeded",
    "tokens": 132
  }
}

An example in-progress run:

json
{
  "status": "SUCCESS",
  "data": {
    "runId": "01234567-89ab-cdef-0123-456789abcdef",
    "outputs": [],
    "runStatus": "running",
    "tokens": 0
  }
}

Output item types

typeShapeDescription
text{ "type": "text", "data": string }Generated text content.
image{ "type": "image", "data": string }The URL to a generated image resource. The URL is publicly accessible and expires after 24 hours.
error{ "type": "error", "data": string }Error message when a step fails during generation.

Error responses

See Error codes.

HTTP statusstatus codeDescription
404NOT_FOUND_ERRORThe specified runId does not exist or you do not have access to this run.

See also