Skip to navigation

Claim the next ready task

Beta

Take the next ready task of a queue as the caller’s to work on now: the first open task of the workspace the caller can change that nobody is working on, that is not held for a person and that waits on no open task. The caller’s own tasks come first, then tasks assigned to nobody, each soonest due first by day; a task assigned to someone else is never taken. Narrow the queue with labels (a task must carry all of them) and a folder or project. It answers the task it claimed, or nothing_ready with how the queue stands in numbers: no task that was passed over is named. A blank label or folder id is refused, never ignored. Open to a person’s own key or token; a credential acting as an agent or an automation is refused.

Authentication

X-API-KEYstring
API Key authentication via header

Headers

X-Athena-Session-CredentialstringOptional

Request

This endpoint expects an object.
workspace_idstringRequired<=128 characters

The workspace whose tasks to take from; the caller is a member.

folder_idstring or nullOptional<=128 characters

Only tasks placed directly in this folder, or linked by this project: one the caller can open. Left out or null: every task of the workspace the caller can open. A blank id is refused (400), never ignored.

labelslist of strings or nullOptional

Only tasks that carry every one of these label names, each matched whatever its case (at most 20: a task carries no more). Left out, null or an empty list: whatever their labels. A blank name is refused (400), never ignored.

lease_minutesinteger or nullOptional1-1440

How long the claim holds, in minutes (30 when left out).

workerstring or nullOptionalformat: "^[A-Za-z0-9._-]+$"1-64 characters

Your own name for the worker that is calling (1 to 64 letters, digits, -, _ or .), for when several workers share one API key. A claim made with a name is that worker’s: another worker of the same caller is refused the task while the claim is live, and only the same name renews it or gives it back. Left out, the call is the caller’s own, as from the app. The name is yours to choose and grants nothing.

Response

The task claimed, or nothing_ready with counts.

queueobject or null

With nothing_ready: the same in numbers. No task is named.

reasonstring or null

With nothing_ready: how the queue stands, in one line.

resultenum

claimed or nothing_ready.

Allowed values:
taskobject or null

The task now claimed by the caller; null when nothing is ready.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error