Skip to content

Retrieve task

GET/v1/tasks/{task_id}

Read an asynchronous image task’s status. Poll every 3–5 seconds until status is SUCCESS or FAILURE. For video tasks use GET /v1/videos/{video_id}.

Headers

  • AuthorizationstringRequired

    Bearer <API_KEY> of the user who owns the task.

Path parameters

  • task_idstringRequired

    The task_id returned by POST /v1/images/tasks.

Returns

HTTP 200.

  • task_idstringOptional

    Task ID.

  • platformstringOptional

    image-generation for image tasks.

  • statusstringOptional

    Task status; use it to decide completion.

    Supported values

    • QUEUEDWaiting
    • IN_PROGRESSGenerating or saving
    • SUCCESSDone; call the artifacts endpoint
    • FAILUREFailed; see fail_reason
  • phasestringOptional

    Finer stage, image tasks only.

    Supported values

    • queued
    • generating
    • savingGenerated, being saved
    • completed
    • failed
  • progressstringOptional

    Progress as a percentage string such as "90%", for display only.

  • fail_reasonstringOptional

    Failure reason; an empty string otherwise.

  • created_atintegerOptional

    Creation time in Unix seconds.

  • finished_atintegerOptional

    Finish time in Unix seconds; 0 while running.

Errors

HTTPcodeCause and action
404artifact_not_found / invalid_request_errorThe task does not exist or belongs to another user.
401—The API key is invalid, expired or disabled.
Retrieve an image task
curl https://ling-light.com/v1/tasks/task_xxxxxxxxxxxxxxxx \
  -H "Authorization: Bearer $LINGLIGHT_API_KEY"
const response = await fetch('https://ling-light.com/v1/tasks/task_xxxxxxxxxxxxxxxx', {
  headers: {
    Authorization: `Bearer ${process.env.LINGLIGHT_API_KEY}`,
  },
})
console.log(response.status, await response.json())
import os

import requests

response = requests.get(
    "https://ling-light.com/v1/tasks/task_xxxxxxxxxxxxxxxx",
    headers={
        "Authorization": f"Bearer {os.environ['LINGLIGHT_API_KEY']}",
    },
    timeout=60,
)
print(response.status_code, response.json())
Response · succeeded
{
  "task_id": "task_xxxxxxxxxxxxxxxx",
  "platform": "image-generation",
  "status": "SUCCESS",
  "progress": "100%",
  "fail_reason": "",
  "created_at": 1795660800,
  "finished_at": 1795660860,
  "phase": "completed"
}
API reference overview
Authentication, media URLs, idempotency and errors.
Integration guide
The full flow from API key to downloaded result.
Last updated