# Remove files from a directory (folder)
Source: https://docs.file.ai/api-reference/folders/remove-files-from-a-directory-folder

> Detach files from a directory. The files themselves are not deleted: they stay in the workspace and in every other directory they belong to.

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

Detach files from a directory. The files themselves are not deleted: they stay in the workspace and in every other directory they belong to.

To delete a file, use `DELETE /v1/files`.

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

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

**Response:**
Every id you send is returned in exactly one of two arrays:
- `removed`: detached by this request
- `notAttached`: not attached to this directory when the request ran

**Notes:**
- The endpoint is safe to retry. Detaching a file that is already detached reports it as `notAttached` and is not an error.
- Directories that have a workflow are rejected with a 422, and so are their immediate subfolders. Advancing a workflow on detach is not supported yet.
- A file that is a workflow result in this directory is rejected with a 422 naming the file ids; nothing in the request is detached.
- `directoryId` is echoed back in canonical lowercase form regardless of the case you send.
