# Geocode a file

`POST /jobs`

Geocodes every row of a CSV or JSONL upload. Rows are looked up while the
file uploads, and their results stream back in this response: CSV in the
order rows were sent, JSONL in the order they finish, each line with its
`row`. The results are kept at `Content-Location` for the server's
retention, 72 hours by default.

- CSV: name the columns with `address` (several, comma-separated, are
  joined), `locality`, `region` and `postcode`, or `lat` and `lon` for
  reverse. Without them, the header row's names are matched to common
  ones (`street`, `city`, `zip`, `latitude` and so on). The output is the
  input with `geocode batch`'s `geocode_*` columns added.
- JSONL: each line is a `QUERY /geocode` or `QUERY /reverse` item, and
  `endpoint` is required.

Every other query-string parameter, such as `country`, applies to every
row. Each row's answer is the one its `GET` returns. Send
`Prefer: respond-async` to be answered with the job's status once the
upload is in, instead of with the results.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `endpoint` | query | no | JobEndpoint | The lookup every row runs. Required for JSONL; for CSV, inferred from the columns. |
| `address` | query | no | string | CSV only: the column, or comma-separated columns, holding the address. |
| `locality` | query | no | string | CSV only: the town column. |
| `region` | query | no | string | CSV only: the region column. |
| `postcode` | query | no | string | CSV only: the postcode column. |
| `lat` | query | no | string | CSV only: the latitude column. |
| `lon` | query | no | string | CSV only: the longitude column. |
| `country` | query | no | string | Comma-separated ISO 3166-1 alpha-2 codes every row is limited to. |
| `Prefer` | header | no | string | `respond-async` to be answered with the job's status once the upload is in. |
| `Accept` | header | no | string | `text/csv` or `application/jsonl`. Defaults to the upload's own format. |

## Responses

- `201`: The results, streamed as rows finish.
- `202`: With `Prefer: respond-async`: the upload is in and the job runs.
- `400`: The CSV has no header row or no column to look up, or a parameter is malformed.
- `405`: Method not allowed. The route accepts `POST` only.
- `413`: The declared body is over the server's upload limit.
- `415`: The body is not `text/csv` or `application/jsonl`.
- `503`: Every slot batches and jobs share is taken, or the results kept fill the server's job store. Retry after the `Retry-After` header's seconds.
