> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorylake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Import Documents

> Import files from the Library into a project as documents

```
POST /openapi/memorylake/api/v3/workspaces/{workspaceId}/projects/{projectId}/memories/documents
```

Imports one or more Library files into a project as documents. MemoryLake processes each file asynchronously -- indexing its content for semantic search and memory extraction. You can check progress with [Get Document](/features/memorylake/api-reference/v3-documents/get-document).

<Note>
  **Permission required:** `project:doc_add`
</Note>

<Note>
  Files must already exist in the Library before you can import them. Use the [Library API](/features/memorylake/api-reference/library/overview) to upload files first.
</Note>

### Path Parameters

<ParamField path="workspaceId" type="string" required>
  Workspace ID that owns the project.
</ParamField>

<ParamField path="projectId" type="string" required>
  Project to import documents into.
</ParamField>

### Body Parameters

<ParamField body="drive_item_ids" type="string[]" required>
  Array of Library item IDs to import. Each ID must reference an existing file in the Library.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://app.memorylake.ai/openapi/memorylake/api/v3/workspaces/ws-a1b2c3d4e5f6/projects/proj-7g8h9i0j1k2l/memories/documents' \
    -H 'Authorization: Bearer sk_xxxxxx' \
    -H 'Content-Type: application/json' \
    -d '{
      "drive_item_ids": [
        "sc-5c6bf0f82d624a20a6fa4696997bdd46:2a8cf1e93f634b31b7",
        "sc-5c6bf0f82d624a20a6fa4696997bdd46:9f3de2a71c844a52c1"
      ]
    }'
  ```
</RequestExample>

### Response

<ResponseField name="data" type="object">
  <Expandable title="Import result">
    <ResponseField name="success_count" type="integer">Number of files successfully imported.</ResponseField>
    <ResponseField name="failure_count" type="integer">Number of files that failed to import.</ResponseField>
    <ResponseField name="duplicate_count" type="integer">Number of files skipped because they were already imported into this project.</ResponseField>

    <ResponseField name="details" type="array">
      Per-file import results.

      <Expandable title="Import detail">
        <ResponseField name="result" type="string">Outcome for this file: `success`, `failed`, or `duplicate`.</ResponseField>
        <ResponseField name="drive_item_id" type="string">Library item ID that was processed.</ResponseField>
        <ResponseField name="document_id" type="string">Document ID assigned to the imported file. Present when `result` is `success`.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="details_truncated" type="boolean">When `true`, the `details` array has been truncated. This can happen when importing a very large batch.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "data": {
      "success_count": 1,
      "failure_count": 0,
      "duplicate_count": 1,
      "details": [
        {
          "result": "success",
          "drive_item_id": "sc-5c6bf0f82d624a20a6fa4696997bdd46:2a8cf1e93f634b31b7",
          "document_id": "doc-3m4n5o6p7q8r"
        },
        {
          "result": "duplicate",
          "drive_item_id": "sc-5c6bf0f82d624a20a6fa4696997bdd46:9f3de2a71c844a52c1",
          "document_id": "doc-4x5y6z7a8b9c"
        }
      ],
      "details_truncated": false
    }
  }
  ```
</ResponseExample>
