# POST Requests

The AutoCoder API is **asynchronous**. You submit a coding task with a `POST`, which returns a task `id`; you then [poll for the result](./get-request) with a `GET`.

## Endpoint

| Field | Value |
| --- | --- |
| Endpoint | `https://services.hank.ai/autocoding/v1/tasks/` |
| Method | `POST` |
| API Key header | `x-api-key` |
| API Key value | to be provided |

## Request body

The request carries the document(s) to code under `request.job.input.entities`, plus optional patient, provider, and scheduling context.

```json
{
  "Name": "some_blank_name",
  "request": {
    "service": "<reference to service>",
    "job": {
      "id": "value",
      "input": {
        "entities": [
          {
            "inputType": "text",
            "lastModifiedTime": "Mon Nov 02 12:56:49 EST 2020",
            "noteType": "SurgeonProcedureNote",
            "content": "Content representing type specified in inputType"
          }
        ]
      },
      "schedule": {
        "surgeon": "name",
        "surgeonNPI": "NPI Number"
      },
      "meta": {
        "squash_icd": false,
        "note_classification": true
      }
    }
  }
}
```

### noteType

Each entity declares the kind of clinical note it carries via `noteType`. The accepted values are:

- `SurgeonProcedureNote`
- `AnesthesiaProcedureNote`
- `AnesthesiaPreoperativeNote`
- `DiagnosisDescription`
- `SurgeryDescription`
- `AnesthesiaProcedureNote_AirwayPlacement`
- `AnesthesiaProcedureNote_LaborEpidural`
- `AnesthesiaProcedureNote_ArterialLine`
- `AnesthesiaProcedureNote_NerveBlock`
- `AnesthesiaProcedureNote_EpiduralCatheterNonOB`
- `AnesthesiaProcedureNote_CentralLine`

### schedule.surgeonNPI (optional)

In the `schedule` section there is an optional `surgeonNPI` field. If provided, it can further enhance the system’s ability to predict the correct codes.

### meta.squash_icd

When `squash_icd` is `true`, the API returns the **minimal** set of ICD codes (used for billing claims, for example). When omitted or set to the default of `false`, the behavior is to return the **maximal** set of valid ICD codes (useful for audits, or anywhere the client wants them all available).

`patient_info` (guarantor, insurance, and patient demographics/addresses) and `provider` may also be supplied on the job. See the full schema in the embedded API reference on the [Authentication](./authentication) page.

## Response

A successful submission returns `200 OK` with the task `id` to poll:

```json
{
  "id": "<id>",
  "metadata": {
    "apiVersion": "1.0",
    "timeStamp": "timestamp",
    "apiKey": "apiKeyValue"
  }
}
```

Take the `id` and poll it via the [GET Request](./get-request).
