---
title: "Build a table from a file attached to an AI Assistant message"
method: POST
path: "/chat-attachments/{attachment_id}/import/"
tags: ["assistant"]
---

# Build a table from a file attached to an AI Assistant message

`POST /chat-attachments/{attachment_id}/import/`

## Request

- Base URL: `https://api.getoneprofile.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.getoneprofile.ai/chat-attachments/{attachment_id}/import/`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Create a table from a file attached to a message, every column of the file becoming a column of the table with a type read off its values, and start adding the file's rows to it in the background. Takes any size of file the plan's row limit allows, so it is the way to turn a whole lead list into a table. A PDF becomes the table its pages hold, its columns named as the PDF names them. When the file's first row is a title, `header_row` names the row that holds the column names, and `row_ranges` picks rows numbered as a page of the file's rows shows them. The table exists when this returns; poll the import job to follow the rows arriving. Only your own files.

## Path parameters

- `attachment_id` string, uuid, required

## Request body

- ChatAttachmentImportRequestSchema: Build a table out of an attached file.
  - `header_row` integer: For a file whose first row is a title: the row that holds the column names, numbered as a page of the file's rows numbers them (1 is the first row under the title). The table's columns are named from it and only the rows below it are added. 0 keeps the first row as the header.
  - `name` string, required: What to call the table. Unique in the workspace.
  - `row_ranges` ImportRowRangeSchema[], nullable: Only these rows, the way a print dialog picks pages, numbered as a page of the file's rows numbers them and as `header_row` is: 1 is the row at offset 0, the first under the file's first row, and every row holding any text counts, a row of placeholders like N/A included. So with `header_row` 2 the rows under the column names start at 3. A row the table gets no value from (only placeholders, or the column names and the rows above them) is left out. At most 100 ranges once merged. Omit for every row.
    - `first` integer, required: The first row of the range, counted from 1.
    - `last` integer, required: The last row of the range; `first` for one row.

## Response `201`

Successful Response

- ChatAttachmentImportResponseSchema: The table an attached file is becoming. The table exists when this returns; its rows are still arriving, loaded in the background from the file's own rows. ``row_count`` is how many will land, which is the file's count clamped to the row ceiling, and the file's own count stands beside it so a caller can say when the two differ rather than pass the smaller number off as the whole file.
  - `column_count` integer, required
  - `file_row_count` integer, required: Rows in the file, as its attachment card counts them, less the header row named and the rows above it.
  - `import_id` string, uuid, required: The import job loading the rows, for polling.
  - `limited_by` 'plan' | 'deployment', nullable, required: Whose ceiling it was: the plan's, which a bigger plan raises, or the deployment's, which none does. Null when nothing was cut.
  - `row_count` integer, required: Rows that will be added: the rows chosen, or the file's from the top.
  - `row_limit` integer, nullable, required: The ceiling that cut the file short, or null when every row is being added.
  - `table_id` string, uuid, required
  - `table_name` string, required

## Other responses

- `401`: Unauthorized
- `402`: Plan table limit reached. Upgrade to create more tables.
- `403`: Forbidden
- `404`: File not found
- `422`: Invalid request made to the API.
- `500`: Internal server error.
- `502`: Bad gateway error.
- `503`: Service unavailable.

---

[API](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile.md) · [All operations](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/llms.txt) · [OpenAPI document](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/revisions/dc5ac3c84444?raw)
