Claim Next Agent Job
GET/api/automation/runner/jobs/next
Claim the next queued job for one of the templates this runner advertised (see Send Agent Runner Heartbeat). The claim is atomic - two runners never receive the same job - and starts a 60-second lease that progress reports renew. If the lease lapses the job goes back to the queue; after 3 attempts it fails.
Called by your own agent or script with the token SKU issued for this runner or callback, sent as Authorization: Bearer <token> — not with a Personal Access Token or a session.
Authenticate with the runner token as Authorization: Bearer <runner token> (not a Personal Access Token).
Query parameters
wait(optional, integer 0-25) - long-poll: hold the request up to this many seconds waiting for a job. Default 0 (return immediately).
Responses
- 200 -
job:id(use it in the progress / complete / fail calls),template,data(the values the Agent task step passed),execution_url(the run's page in the app),attempt(1 on the first try). - 204 - no job available (empty body).
- 401 invalid or revoked token, 422
waitout of range, 429 above 240 requests a minute per token.
Request
Responses
- 200
- 204
- 401
- 403
- 422
- 429
OK
Response Headers
No Content
Unauthorized
Response Headers
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.