Notice: MAI Image 2.7 launch limited-time 20% off, covering the full text-to-image and image editing lineup, try it now
Notice: Black Friday 2026 × Cyber Monday: Get up to 30% extra on top-ups, DeepSeek free to use · View the promotion
Open navigation

Get Task Detail

Endpoint: GET /v1/tasks/:id

The path parameter :id is the tk-hiapi- taskId returned when the task was created. Commonly used for polling.

Headers

HeaderValueRequiredNotes
AuthorizationBearer YOUR_API_KEYyesAccount API key. Required on every request.

The task must belong to the API key’s account; cross-account queries return 404 — full header rules in the Unified Async API Introduction.

Path parameter

Request example — GET https://api.hiapi.ai/v1/tasks/tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR

{}
ParameterTypeRequiredDefaultDescription
idstringyes—The taskId returned at creation, prefixed tk-hiapi-. e.g. tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR

Polling guidance

  • After creating a task, wait 2–3 seconds before the first query; then poll every 3–5 seconds — for slower generations (e.g. video), 5–10 seconds is enough.
  • Stop polling once status reaches success / fail: terminal states are irreversible and a taskId’s result is fixed (see the task status enum).
  • On success, download output[].url promptly — mind the expireAt deadline; to keep outputs long-term, set storage: "persistent" at creation or promote them later.
  • For production, prefer a callback for terminal notifications and keep polling as a fallback.
  • On 503, retry later with exponential backoff.

Field reference

FieldTypeDescription
taskIdstringTask ID, fixed prefix tk-hiapi-
modelstringResolved model full name. When the task was submitted with the route parameter this is base@route (e.g. gpt-image-2/text-to-image@ext); otherwise it is the name passed at creation
routestringPresent only when the task was submitted with an explicit route parameter; echoes the submitted value
statusstringStatus enum, see below
creatednumberCreation time (Unix seconds)
completednumberTerminal time in Unix seconds; 0 while non-terminal
outputarrayPresent only when status == success
storagestringEffective storage tier of the outputs: temp, persistent, or static. Always present; defaults to temp. The storage list calls the same state storage_tier
storage_downgradedstringPresent only when a requested persistent tier fell back to temp. Value is insufficient (balance at or below zero) or cap_exceeded (over the storage cap); storage then reports temp
errorobjectPresent only when status == fail, shaped { code, message }

Status enum

statusMeaningReturns output?
queuedEnqueued, not startedNo
handlingProcessingNo
archivingDone, output being preparedNo
successTerminal: complete, output availableYes
failTerminal: failedNo, returns error

output[] fields

FieldTypeDescription
urlstringResource URL, directly downloadable
typestringOutput type, see below
expireAtnumberAccess deadline (Unix seconds); download or re-store before it expires

Common type values (extensible): video, image, audio, first_frame, last_frame, thumbnail. output is always an array, and one task may return multiple types (e.g. video + first_frame).

The top-level storage field is the tier that actually took effect (temp / persistent / static; static marks built-in assets). The storage list reports the same tier per output as storage_tier (temporary / persistent only — static outputs are not listed there) — different field name, same state.

Success response (status = success)

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
    "model": "happyhorse-1.0",
    "status": "success",
    "storage": "temp",
    "created": 1777282033,
    "completed": 1777282099,
    "output": [
      {
        "url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
        "type": "video",
        "expireAt": 1777886899
      },
      {
        "url": "https://cdn.hiapi.ai/tasks/.../first_frame.jpg",
        "type": "first_frame",
        "expireAt": 1777886899
      }
    ]
  }
}

Non-terminal response (e.g. status = archiving)

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "tk-hiapi-...",
    "model": "happyhorse-1.0",
    "status": "archiving",
    "created": 1777282033,
    "completed": 0
  }
}

Failure response (status = fail)

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "tk-hiapi-...",
    "model": "happyhorse-1.0",
    "status": "fail",
    "created": 1777282033,
    "completed": 1777282099,
    "error": {
      "code": "TASK_FAILED",
      "message": "task failed"
    }
  }
}

error.code values are listed under status codes.

404

Task does not exist or does not belong to the current account:

{
  "code": 404,
  "message": "task not found",
  "data": null
}