# Import a spreadsheet into a page

Records one FINISHED import in a page's history — `fileName`, `total`, `imported`, `failed`, an `error` if it went wrong, and the per-row `results`. It imports NOTHING: this is the ledger entry for an import the caller already ran itself. To actually import rows use `post_definitions_key_import`, `post_definitions_key_import_auto` (a spreadsheet mapped for you) or `post_definitions_key_import_jobs`. Counts that do not add up — imported plus failed exceeding total — are refused.

Access class: `def:read`.

## Endpoint

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

## Parameters

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

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "error": "string",
    "failed": 1,
    "fileName": "string",
    "imported": 1,
    "results": [
      {
        "error": "string",
        "id": "",
        "name": "string",
        "row": 1,
        "skipped": true
      }
    ],
    "total": 1
  },
  "params": {
    ":key": "string"
  },
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "actorUserId": 1,
    "createdAt": "string",
    "error": "string",
    "failed": 1,
    "fileName": "string",
    "finishedAt": "string",
    "id": "",
    "imported": 1,
    "keptCount": 1,
    "results": [
      {
        "error": "string",
        "id": "",
        "name": "string",
        "row": "string",
        "skipped": "string"
      }
    ],
    "standing": 1,
    "status": "string",
    "total": 1,
    "undoneAt": "string",
    "undoneBy": 1,
    "undoneCount": 1
  }
}
```

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