---
title: "Import files attached in an assistant's conversation"
method: POST
path: "/uploads/import"
tags: ["Uploads"]
---

# Import files attached in an assistant's conversation

`POST /uploads/import`

## Request

- Base URL: `https://api.invoicedataextraction.com/v1`
- URL: `https://api.invoicedataextraction.com/v1/uploads/import`
- Auth: HTTP bearer

In place of creating a session, uploading parts and completing each file, when the
files are attached in a conversation with an assistant that gives your app a download
link for each one, as ChatGPT does: creates the session, uploads every file (1 to 100)
from its link and completes it, in one call. The session's limits apply, and every
file needs one available credit. The links expire a few minutes after the assistant
gives them. When any link cannot be read, nothing is created and nothing is charged.

Files are independent: one that cannot be uploaded carries its `error` and is listed
in `failed_file_ids`, and the completed files can be submitted. A retry with the same
`upload_session_id` and files continues the session, and a file already completed is
not uploaded again.

Rate limit: 20 requests per minute per API key.

## Request body

- object
  - `upload_session_id` string, required: Your identifier for the session; a retry with the same one and the same files continues it.
  - `files` object[], required
    - `file_id` string, required
    - `file_name` string, required: The file name, ending in .pdf, .jpg, .jpeg or .png.
    - `url` string, uri, required: The download link the assistant gave for the attached file. Links from ChatGPT are accepted.

## Response `200`

The session, with each file's outcome.

- object
  - `success` boolean, required
  - `upload_session_id` string, required
  - `files` object[], required
    - `file_id` string, required
    - `file_name` string, required
    - `success` boolean, required
    - `error` object: Present when the file could not be uploaded.
      - `code` string
      - `message` string
      - `retryable` boolean
      - `details` object, nullable
  - `completed_file_ids` string[], required
  - `failed_file_ids` string[], required

## Other responses

- `400`: `INVALID_INPUT` (a link that is not an assistant's download link for an attached file among them), or the session's own refusals (`DUPLICATE_FILE_NAME`, `DUPLICATE_FILE_ID`, `FILE_TOO_LARGE`, `TOTAL_UPLOAD_SIZE_LIMIT_EXCEEDED`).
- `401`: `UNAUTHENTICATED`, `API_KEY_EXPIRED` or `API_KEY_REVOKED`.
- `402`: `INSUFFICIENT_CREDITS`: fewer available credits than files.
- `409`: `SESSION_ALREADY_INITIALIZED`: this `upload_session_id` is in use.
- `422`: `FILE_LINK_UNREADABLE`: a link could not be read, most often because it expired; `details.file_names` names the files. Attach them again and import with the new links.
- `429`: `RATE_LIMITED`: wait `details.retry_after_seconds` (also the `Retry-After` header), then retry.
- `500`: `INTERNAL_ERROR`: retry after a short delay.

---

[API](https://skmtc.dev/invoicedataextraction/apis/invoice-data-extraction-api.md) · [All operations](https://skmtc.dev/invoicedataextraction/apis/invoice-data-extraction-api/llms.txt) · [OpenAPI document](https://skmtc.dev/invoicedataextraction/apis/invoice-data-extraction-api/revisions/16d920350483?raw)
