# Import rows as a job

Starts the same import as `post_definitions_key_import` but as a JOB: it writes the run, lands its first chunk of 200 rows inside this call, and answers 202 — `completed` when the file fitted in that one chunk, `running` otherwise. Reach for it over the plain import when the file is large enough that somebody is watching, or when a retry has to be safe — send the same `idempotencyKey` and a second call answers the SAME job instead of landing the file twice. Same body: `rows` already keyed by column, `columns` to ensure by label, `identity` to merge onto records that already exist, `unknownChoice` (add | blank | reject), `duplicates` (first | last | all). Still at most 5000 rows, refused whole with `too_many_rows` above it. If the answer says `running`, poll `get_definitions_key_import_jobs_jobId` about once a second — each read lands the next chunk, so 5000 rows takes about 25 reads — until state is `completed` or `failed`; the whole job is one batch, so `post_definitions_key_imports_runId_undo` rolls all of it back.

Access class: `def:read`.

## Endpoint

`POST /v1/definitions/{key}/import/jobs`

## Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| key | path | string | Yes |

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "columns": [
      {
        "config": {},
        "kind": "string",
        "label": "string",
        "options": [
          "string"
        ]
      }
    ],
    "duplicates": "string",
    "fileName": "string",
    "idempotencyKey": "string",
    "identity": [
      "string"
    ],
    "rows": [
      {
        "Business": "string",
        "Revenue": "string"
      }
    ],
    "unknownChoice": "string"
  },
  "params": {
    ":key": "string"
  },
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "actorUserId": 1.5,
    "created": 1.5,
    "done": 1.5,
    "errors": [
      "string"
    ],
    "failed": 1.5,
    "fileName": "string",
    "finishedAt": "string",
    "id": "",
    "imported": 1.5,
    "startedAt": "string",
    "state": "string",
    "total": 1.5,
    "updated": 1.5
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
