# Import rows into a page

Imports up to 5000 rows into a pack page in one call, coercing each cell to its column's kind — amounts, dates, checkboxes, tags — and ensuring by label any column the file needs. Above 5000 rows the call is refused whole, so send it in pages. `identity` names the columns that say which record is which: a row that matches one already on the page is merged, not appended. `unknownChoice` decides a select value the column does not carry (add | blank | reject), `duplicates` decides a record the file names twice (first | last | all), and `dryRun` plans the whole thing without writing. A row that cannot be written fails on its own line and the run carries on; the run is recorded, so the whole batch can be undone.

Access class: `def:read`.

## Endpoint

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

## 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"
        ]
      }
    ],
    "dryRun": true,
    "duplicates": "string",
    "fileName": "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": {
    "columnsCreated": [
      "string"
    ],
    "counts": {
      "created": 1.5,
      "failed": 1.5,
      "skipped": 1.5,
      "updated": 1.5
    },
    "definition": {
      "access": "string",
      "columns": [
        {
          "alignEnd": true,
          "calculation": "string",
          "config": {
            "bands": [
              {
                "tone": "string",
                "upTo": 1.5
              }
            ],
            "definitionKey": "string",
            "object": "string"
          },
          "defaultEnabled": true,
          "id": "",
          "kind": "string",
          "label": "string",
          "minWidth": 1.5,
          "position": 1.5,
          "priority": 1.5,
          "source": "string",
          "starred": true
        }
      ],
      "createdAt": "string",
      "icon": "string",
      "id": "",
      "key": "string",
      "name": "string",
      "object": "string",
      "pack": "string",
      "position": 1.5,
      "recordsEnabled": true,
      "statuses": [
        {
          "groupLabel": "string",
          "id": "",
          "isActive": true,
          "isTerminal": true,
          "label": "string",
          "position": 1.5,
          "tone": "string",
          "value": "string"
        }
      ],
      "tagsEnabled": true,
      "templateKey": "string",
      "updatedAt": "string",
      "views": [
        {
          "columnIds": [
            "string"
          ],
          "filter": {},
          "id": "",
          "key": "string",
          "label": "string",
          "position": 1.5,
          "scope": "string",
          "sort": {}
        }
      ]
    },
    "optionsAdded": [
      "string"
    ],
    "results": [
      {
        "id": "",
        "outcome": "string",
        "row": 1.5
      }
    ],
    "runId": ""
  }
}
```

### 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"
}
```
