# Attach existing files to a directory (folder)
Source: https://docs.file.ai/api-reference/folders/attach-existing-files-to-a-directory-folder

> Attach files that already exist in the workspace to a directory, without re-uploading them.

post /prod/v1/directories/{directoryId}/documents

Attach files that already exist in the workspace to a directory, without re-uploading them.

A file can belong to many directories at once. Use this endpoint for reference data that several folders need — price lists, rate cards, holiday calendars, monthly listings. Uploading the same file once per folder creates a separate file each time and is charged a separate extraction each time; attaching reuses the single original.

**Path Parameters:**
- `directoryId` (required): The directory to attach the files to

**Request Body:**
- `fileIds` (string[], required): Ids of existing files to attach. At least 1, at most 100. Repeated ids are collapsed.

**Response:**
Every id you send is returned in exactly one of three arrays, so a partial success is never silent:
- `created`: newly attached by this request
- `conflicted`: already attached before this request
- `rejected`: not resolvable by this API key

**Notes:**
- The endpoint is safe to retry. Re-attaching a file reports it as `conflicted` and creates no duplicate.
- An id in `rejected` may be unknown, deleted, or owned by another workspace. The cases are not distinguished.
- Attaching to several directories is one call per directory, each authorised on its own.
- Directories that have a workflow are rejected with a 422, and so are their immediate subfolders — a file added to a subfolder drives the parent folder's workflow. Deeper descendants are unaffected, since a workflow further up is not driven by the attach. Advancing a workflow on attach is not supported yet, and attaching without it would leave the folder in a half-applied state.
- `directoryId` is echoed back in canonical lowercase form regardless of the case you send.
