---
title: "Import files"
method: POST
path: "/connections/{connection_id}/imports"
tags: ["imports"]
---

# Import files

`POST /connections/{connection_id}/imports`

This method imports one or more files from the connected provider account into the platform as assets. Video files can be up to 10 GB, audio files up to 4 GB, and images up to 32 MB. For each newly imported file, the platform creates an asset in the `processing` status and fetches the file asynchronously. If you import a file that was already imported through this account, the platform returns the existing asset with its current status, without fetching the file again. If the earlier fetch had failed, the platform fetches the file again. The response contains one entry per requested file, in request order. Use the `action` field of each entry to identify which files were newly imported and which were already imported.

## Path parameters

- `connection_id` string, required

## Headers

- `x-api-key` string, required

## Request body

- object
  - `items` ConnectionsConnectionIdImportsPostRequestBodyContentApplicationJsonSchemaItemsItems[], required — The files to import. Provide an array of one item for a single import, or multiple items for a batch import. A maximum of 100 items can be imported per request. The `source_id` field of each item must be unique within a request.
    - `source_id` string, required — The identifier of the file at the provider. For Google Drive, this is the identifier Google Drive assigns to the file.

## Response `202`

The import request has been accepted. The response contains one item per requested file, in request order. Use the `action` field of each item to identify which files were newly imported and which were already imported. An accepted item includes the identifier and status of its asset. A rejected item includes an `error` object instead, and omits both. The `has_failures` field is `true` when at least one item was rejected. A rejected item does not fail the request; the response is `202` even when no item is accepted.

- ImportResult — The result of an import request, returned by the Import files endpoint.
  - `_id` string — The unique identifier of the import created for this request.
  - `has_failures` boolean — Whether at least one item was rejected before an asset was created. When `true`, inspect the `error` object of each item to identify the rejected ones. An item the platform skipped as a duplicate is not a failure.
  - `items` ImportItem[] — One entry per requested file, in request order, with its `action` value and the current status of its asset.
    - `source_id` string — The identifier of the file at the provider. For Google Drive, this is the identifier Google Drive assigns to the file.
    - `action` 'created' | 'skipped' | 'retried' | 'rejected' — The action taken for this file: created, skipped, retried, or rejected. The platform sets this value while processing the request, and the value does not change afterward. The [Import files](/v1.3/api-reference/data-connectors/imports/import-files) endpoint always returns this field. The [Retrieve an import](/v1.3/api-reference/data-connectors/imports/retrieve-an-import) endpoint omits it for imports from before this field existed. Treat an absent value as unknown rather than as a specific action. The `skipped` and `retried` values both mean the file was already imported through this account: for the `skipped` action, the platform returns the existing asset; for the `retried` action, the earlier fetch had failed, so the platform fetches the file again. See [The import object](/v1.3/api-reference/data-connectors/imports/the-import-object#item-actions) for the meaning of each value.
    - `asset_id` string — The unique identifier of the asset for this file. When the `action` field is `created`, this identifies a new asset; when it is `skipped` or `retried`, this identifies the asset from the earlier import of the same file. Absent when the item was rejected before an asset was created.
    - `status` 'processing' | 'ready' | 'failed' — The status of the asset. See [The import object](/v1.3/api-reference/data-connectors/imports/the-import-object#item-statuses) for the possible values. Absent when the item was rejected before an asset was created, in which case an `error` object is present.
    - `error` ImportItemError — Details of the rejection. Present when the item was rejected before an asset was created, in which case the `status` field is absent.
      - `code` string — A string representing the code associated with the error. For the possible values, see the [Error codes](/v1.3/api-reference/error-codes#the-connections-endpoints) page.
      - `message` string — A human-readable string describing the error, intended to be suitable for display in a user interface.

## Other responses

- `400` — The request has failed.
- `404` — The specified connection does not exist.
- `409` — The connection is not in an active state.

---

[API](https://skmtc.net/twelvelabs/apis/twelvelabs-api.md) · [All operations](https://skmtc.net/twelvelabs/apis/twelvelabs-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/twelvelabs/twelvelabs-api/revisions/fd9d80e384a8/schema)
