Skip to main content
Documentation
GET /api/v1/tasks/:task_id

Get Task

Retrieve a single task by its ID. Use this to poll for task completion.

Request

curl https://your-instance/api/v1/tasks/a1b2c3d4-... \
  -H "Authorization: Bearer htk_..."

Response (Pending)

{
	"task_id": "a1b2c3d4-...",
	"title": "Approve deployment",
	"status": "pending",
	"created_at": "2026-02-24T12:00:00Z",
	"completed_at": null,
	"org_id": "org_abc",
	"corr_id": "deploy-42"
}

Response (Completed)

When a task is completed, the data field contains the operator's submitted form values:

{
	"task_id": "a1b2c3d4-...",
	"title": "Approve deployment",
	"status": "completed",
	"data": {
		"decision": "Approve",
		"comments": "Looks good!"
	},
	"created_at": "2026-02-24T12:00:00Z",
	"completed_at": "2026-02-24T12:05:00Z"
}

Response (Cancelled / Failed)

{
	"task_id": "a1b2c3d4-...",
	"status": "cancelled",
	"cancel_reason": "Deployment rolled back",
	"cancelled_at": "2026-02-24T12:03:00Z"
}

Errors

StatusMeaning
401Missing or invalid token
404Task not found or belongs to a different organization

Polling Pattern

import time
import requests

while True:
    resp = requests.get(
        f"{base_url}/api/v1/tasks/{task_id}",
        headers={"Authorization": f"Bearer {token}"}
    )
    task = resp.json()

    if task["status"] != "pending":
        print(f"Task {task['status']}: {task.get('data', {})}")
        break

    time.sleep(2)