roasOS
API referenceJobs

Wait for jobs

The long poll. Wait for 1 to 12 jobs to finish in one call. The call reads the jobs every 2 to 5 seconds. It returns when all the jobs are completed, failed or canceled, or when `timeout_seconds` is over. Each item of `jobs` is the same object that `GET /v1/jobs/{id}/status` returns, in the order of `ids`. A job ID that is not in this workspace gives `{ id, error: { code: job_not_found } }` in its place. When `all_terminal` is false, send the call again with the IDs that are not finished. This call is free.

GET
/v1/jobs/wait

The long poll. Wait for 1 to 12 jobs to finish in one call. The call reads the jobs every 2 to 5 seconds. It returns when all the jobs are completed, failed or canceled, or when timeout_seconds is over. Each item of jobs is the same object that GET /v1/jobs/{id}/status returns, in the order of ids. A job ID that is not in this workspace gives { id, error: { code: job_not_found } } in its place. When all_terminal is false, send the call again with the IDs that are not finished. This call is free.

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication. Use your API key as the bearer token: Authorization: Bearer roasos_sk_...

In: header

Query Parameters

ids*array<>

1 to 12 different job IDs, separated by commas. Repeated ids keys are also accepted.

Items1 <= items <= 12
timeout_seconds?integer

The maximum time to wait, in seconds. The call returns before this time is over.

Range1 <= value <= 55
Default50

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/jobs/wait?ids=497f6eca-6276-4993-bfeb-53cbbbba6f08"
{  "data": {    "jobs": [      {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "status": "queued",        "updated_at": "string"      }    ],    "all_terminal": true,    "waited_ms": 0  }}