# GET Request

Poll a submitted coding task by its `id` until the state is `Completed`.

## Endpoint

| Field | Value |
| --- | --- |
| Endpoint | `https://services.hank.ai/autocoding/v1/tasks/<id>` |
| Method | `GET` |
| API key header | `x-api-key` |

## Task states

| State | Meaning |
| --- | --- |
| `In-Progress` | The task is still coding. Poll again after a short delay. |
| `Completed` | The result is ready in `response.result`. |
| `Error` | The task failed. Inspect the `error` field and contact support if it persists. |

Poll at a modest interval, for example every 5 to 15 seconds. A typical case completes within a few minutes.

## Response

```json
{
  "id": "<id>",
  "response": {
    "result": {
      "job_id": "<your internal id from the POST, if supplied>",
      "entities": [
        {
          "entity": {
            "id": "<unique-within-request id>",
            "provider": "<provider name>",
            "entityValue": [
              {
                "id": "<unique-within-request id>",
                "code": 20610,
                "confidence": 0.98,
                "noteType": "SurgeonProcedureNote",
                "noteId": 25
              }
            ],
            "order": 1,
            "Line_item_number": 1,
            "type": "SurgCPT"
          }
        }
      ]
    }
  },
  "state": "Completed",
  "status": null,
  "metadata": {
    "apiKey": "<your-api-key>",
    "timeStamp": "timestamp",
    "processStartTime": "time",
    "processEndTime": "time"
  },
  "error": null
}
```

### entities

Each entry in `entities` is one coded line item:

| Field | Notes |
| --- | --- |
| `entityValue[]` | The codes of this line item's type, in order. Each carries the `code`, its `confidence` (0 to 1), and the `noteType` + `noteId` of the source document. |
| `type` | The line-item code type: `SurgCPT`, `AnesCPT`, `ICD10`, `Modifier`, or `Practitioner`. |
| `order` | The position of this line item within its type. |
| `Line_item_number` | The claim line number. |
| `provider` | The provider the line item belongs to. |

Use `confidence` to route low-confidence codes into your own review workflow. Match results back to your system with `job_id` (from your POST) and the `noteId` references.
