v1

latestOpenAPI 3.0.2GNU AGPLv32026-07-245983524.8 KB
Misc

Get Async Task Status

Poll the status of an asynchronous task. Returns the current state of the task and, when complete, the result or error. This endpoint is generic — it works for any task enqueued by an asynchronous Sefaria API (e.g. POST /api/find-refs).

States:

  • PENDING — The task has not yet started (or the task ID is unknown).
  • STARTED — The task is currently being executed.
  • RETRY — The task failed and is being retried.
  • SUCCESS — The task completed successfully. The result field contains the task output; its shape depends on which API enqueued the task.
  • FAILURE — The task failed permanently. The error field contains the error message.

HTTP status codes:

  • 202 — Task is still running (state is PENDING, STARTED, or RETRY).
  • 200 — Task completed successfully.
  • 500 — Task failed permanently.
get/api/async/{task_id}

Path parameters

task_idstring required

The task ID returned by an asynchronous API endpoint (e.g. POST /api/find-refs).

Response

Task completed successfully. The shape of the result field depends on which API enqueued the task. For tasks started by POST /api/find-refs, result is a FindRefsAPIResponse object.

task_idstring required

The task identifier.

state'SUCCESS' required

Always SUCCESS for this response.

readyboolean required

Always true when the task has completed.

resultobject required

The task output. Its shape depends on which API enqueued the task. For POST /api/find-refs tasks, this is a FindRefsAPIResponse object.

Example response

{
  "ready": true
}