Skip to main content
GET
/
v1
/
task
/
{taskId}
Get async task status
curl --request GET \
  --url https://api.cloro.dev/v1/task/{taskId} \
  --header 'Authorization: Bearer <token>'
{
  "task": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "taskType": "<string>",
    "status": "QUEUED",
    "createdAt": "2023-11-07T05:31:56Z",
    "idempotencyKey": "<string>"
  },
  "credits": {
    "creditsToCharge": 123,
    "creditsCharged": 123
  },
  "response": {}
}

Overview

You can poll this endpoint to check the status of an asynchronous task. The status field can have one of the following values:
  • QUEUED: The task has been received and is waiting to be processed.
  • ENQUEUED: The task has been passed to the processing queue.
  • PROCESSING: The task is actively being processed.
  • COMPLETED: The task has finished successfully. The response object will contain the full result.
  • FAILED: The task failed to complete. The response object may contain error details.
When a task is in a QUEUED, ENQUEUED, or PROCESSING state, the response will only contain the current status. Once the task is COMPLETED or FAILED, the response will include a response object containing the full result.

Example usage

Check a pending task

curl -X GET "https://api.cloro.dev/v1/task/b27a21e1-7c39-4aa2-a347-23e828c426f9" \
  -H "Authorization: Bearer sk_live_1234567890abcdef1234567890abcdef"

Fetch a completed task

curl -X GET "https://api.cloro.dev/v1/task/b27a21e1-7c39-4aa2-a347-23e828c426f9" \
  -H "Authorization: Bearer sk_live_1234567890abcdef1234567890abcdef"

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

taskId
string<uuid>
required

The ID of the task to fetch.

Response

Successful response with the task status and result if completed.

task
object
credits
object
response
object

The full response object, present only when the task is COMPLETED or FAILED.