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
AuthorizationstringRequiredBearer <API_KEY>of the user who owns the task.
Path parameters
task_idstringRequiredThe
task_idreturned byPOST /v1/images/tasks.
Returns
HTTP 200.
task_idstringOptionalTask ID.
platformstringOptionalimage-generationfor image tasks.statusstringOptionalTask status; use it to decide completion.
Supported values
QUEUEDWaitingIN_PROGRESSGenerating or savingSUCCESSDone; call the artifacts endpointFAILUREFailed; seefail_reason
phasestringOptionalFiner stage, image tasks only.
Supported values
queuedgeneratingsavingGenerated, being savedcompletedfailed
progressstringOptionalProgress as a percentage string such as
"90%", for display only.fail_reasonstringOptionalFailure reason; an empty string otherwise.
created_atintegerOptionalCreation time in Unix seconds.
finished_atintegerOptionalFinish time in Unix seconds; 0 while running.
Errors
| HTTP | code | Cause and action |
|---|---|---|
| 404 | artifact_not_found / invalid_request_error | The task does not exist or belongs to another user. |
| 401 | — | The API key is invalid, expired or disabled. |
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()){
"task_id": "task_xxxxxxxxxxxxxxxx",
"platform": "image-generation",
"status": "SUCCESS",
"progress": "100%",
"fail_reason": "",
"created_at": 1795660800,
"finished_at": 1795660860,
"phase": "completed"
}Related
API reference overview
Authentication, media URLs, idempotency and errors.
Integration guide
The full flow from API key to downloaded result.