---
title: "Get AI task by ID or name"
method: GET
path: "/api/v2/tasks/{user}/{task}"
tags: ["Tasks"]
---

# Get AI task by ID or name

`GET /api/v2/tasks/{user}/{task}`

## Path parameters

- `user` string, required
- `task` string, required

## Response `200`

OK

- CodersdkTask
  - `created_at` string, date-time
  - `current_state` CodersdkTaskStateEntry
    - `message` string
    - `state` 'working' | 'idle' | 'complete' | 'failed'
    - `timestamp` string, date-time
    - `uri` string
  - `display_name` string
  - `id` string, uuid
  - `initial_prompt` string
  - `name` string
  - `organization_id` string, uuid
  - `owner_avatar_url` string
  - `owner_id` string, uuid
  - `owner_name` string
  - `status` 'pending' | 'initializing' | 'active' | 'paused' | 'unknown' | 'error'
  - `template_display_name` string
  - `template_icon` string
  - `template_id` string, uuid
  - `template_name` string
  - `template_version_id` string, uuid
  - `updated_at` string, date-time
  - `workspace_agent_health` CodersdkWorkspaceAgentHealth
    - `healthy` boolean — Healthy is true if the agent is healthy.
    - `reason` string — Reason is a human-readable explanation of the agent's health. It is empty if Healthy is true.
  - `workspace_agent_id` UuidNullUUID
    - `uuid` string
    - `valid` boolean — Valid is true if UUID is not NULL
  - `workspace_agent_lifecycle` 'created' | 'starting' | 'start_timeout' | 'start_error' | 'ready' | 'shutting_down' | 'shutdown_timeout' | 'shutdown_error' | 'off'
  - `workspace_app_id` UuidNullUUID
    - `uuid` string
    - `valid` boolean — Valid is true if UUID is not NULL
  - `workspace_build_number` integer
  - `workspace_id` UuidNullUUID
    - `uuid` string
    - `valid` boolean — Valid is true if UUID is not NULL
  - `workspace_name` string
  - `workspace_status` 'pending' | 'starting' | 'running' | 'stopping' | 'stopped' | 'failed' | 'canceling' | 'canceled' | 'deleting' | 'deleted'

---

[API](https://skmtc.net/coder/apis/coder-api.md) · [All operations](https://skmtc.net/coder/apis/coder-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coder/coder-api/versions/56b6e9f08540/schema)
