Task 상세 조회
Endpoint: GET /v1/tasks/:id
경로 파라미터 :id는 task 생성 시 반환된 tk-hiapi- taskId입니다. 주로 폴링에 사용됩니다.
Headers
| Header | Value | Required | Notes |
|---|---|---|---|
Authorization | Bearer YOUR_API_KEY | yes | 계정 API key. 모든 요청에 필수입니다. |
task는 API key의 계정에 속해야 하며, 다른 계정 간 조회는 404를 반환합니다 — 전체 header 규칙은 Unified Async API Introduction을 참고하세요.
Path parameter
Request example — GET https://api.hiapi.ai/v1/tasks/tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR
{}
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | — | 생성 시 반환된 taskId로, tk-hiapi- 접두사가 붙습니다. 예: tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR |
Polling guidance
- task 생성 후 첫 조회 전에 2–3초 기다린 다음, 3–5초마다 폴링하세요 — 느린 생성(예: video)의 경우 5–10초면 충분합니다.
status가success/fail에 도달하면 폴링을 중단하세요: 종료 상태는 되돌릴 수 없으며taskId의 결과는 고정됩니다(task status enum 참고).success시output[].url을 즉시 다운로드하세요 —expireAt기한에 유의하세요. 출력을 장기 보관하려면 생성 시storage: "persistent"를 설정하거나 나중에 승격하세요.- 프로덕션에서는 종료 알림을 위해 callback을 선호하고 폴링은 fallback으로 유지하세요.
503시에는 지수 백오프로 나중에 재시도하세요.
Field reference
| Field | Type | Description |
|---|---|---|
taskId | string | Task ID, 고정 접두사 tk-hiapi- |
model | string | 해석된 모델 전체 이름. task가 route 파라미터로 제출된 경우 base@route(예: gpt-image-2/text-to-image@ext)이며, 그렇지 않으면 생성 시 전달된 이름입니다 |
route | string | task가 명시적 route 파라미터로 제출된 경우에만 존재하며, 제출된 값을 그대로 반환합니다 |
status | string | 상태 enum, 아래 참고 |
created | number | 생성 시간 (Unix 초) |
completed | number | 종료 시간 (Unix 초); 비종료 상태에서는 0 |
output | array | status == success일 때만 존재 |
storage | string | 출력의 실제 적용 storage tier: temp, persistent, static. 항상 존재하며 기본값은 temp입니다. storage 목록에서는 동일한 상태를 storage_tier라고 부릅니다 |
storage_downgraded | string | 요청한 persistent tier가 temp로 fallback된 경우에만 존재합니다. 값은 insufficient(잔액이 0 이하) 또는 cap_exceeded(storage 한도 초과)이며, 이때 storage는 temp를 보고합니다 |
error | object | status == fail일 때만 존재하며, 형태는 { code, message }입니다 |
Status enum
| status | Meaning | Returns output? |
|---|---|---|
queued | 대기열에 추가됨, 시작되지 않음 | No |
handling | 처리 중 | No |
archiving | 완료됨, 출력 준비 중 | No |
success | 종료: 완료, 출력 사용 가능 | Yes |
fail | 종료: 실패 | No, returns error |
output[] fields
| Field | Type | Description |
|---|---|---|
url | string | 리소스 URL, 직접 다운로드 가능 |
type | string | 출력 유형, 아래 참고 |
expireAt | number | 접근 기한 (Unix 초); 만료 전에 다운로드하거나 다시 저장하세요 |
일반적인 type 값(확장 가능): video, image, audio, first_frame, last_frame, thumbnail. output은 항상 배열이며, 하나의 task가 여러 type을 반환할 수 있습니다(예: video + first_frame).
최상위 storage 필드는 실제로 적용된 tier입니다(temp / persistent / static; static은 내장 asset을 나타냄). storage 목록은 출력별로 동일한 tier를 storage_tier로 보고합니다(temporary / persistent만 — static 출력은 여기에 나열되지 않음) — 필드 이름은 다르지만 동일한 상태입니다.
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 값은 status codes에 나열되어 있습니다.
404
task가 존재하지 않거나 현재 계정에 속하지 않습니다:
{
"code": 404,
"message": "task not found",
"data": null
}