# Remove document file

Source: https://docs.orbiqhq.com/docs/api/v1/documents/id/file/delete

### DELETE /api/v1/documents/{id}/file

**Remove document file**

Detach the file from a document. Without `version` or `locale` this clears the
document's own file. With `version` it clears only the file of that draft
version, even when a `locale` is also given, and leaves the live files alone.
Without `version`, a non-default `locale` leaves that language without a file
instead of falling back to the default language's file. The removed file is only
deleted once no language or version of the document still uses it.

Removing from a document that has no file succeeds with `No file to remove`.

**Authentication:** Bearer token (`Authorization: Bearer <token>`)

**Path parameters:**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | Yes | Document whose file is removed |

**Query parameters:**

| Name | Type | Required | Description |
|---|---|---|---|
| `version` | string | No | Draft document version whose file is removed. Omit it, or pass `current`, to target the document itself. |
| `locale` | enum: en \| de \| fr \| ja \| ko \| zh | No | Locale whose document file should be removed. Base locale codes are resolved to Directus language codes such as ja-JP, ko-KR, and zh-CN. |

**Responses:**

- `200` - The file was removed, or there was no file to remove
  - `success` (boolean, required)
  - `data` (object, required)
    - `message` (enum: File removed successfully | No file to remove, required)

  Example (File removed):
  
  ```json
  {
  "success": true,
  "data": {
    "message": "File removed successfully"
  }
}
  ```
- `400` - The document ID is not valid (`invalid_path_parameters`) or the locale is not enabled for the tenant (`locale_not_enabled`)
  - `error` (string, required)
  - `code` (string, required): Machine-readable error code. Known values: invalid_input, invalid_id, unauthenticated, forbidden, not_found, method_not_allowed, conflict, unsupported_media_type, unprocessable, rate_limited, service_unavailable, internal_error. The set is open: treat any code you don't recognise as a generic error.
- `401` - Unauthorized
- `403` - The version is not a draft (`version_not_editable`)
  - `error` (string, required)
  - `code` (string, required): Machine-readable error code. Known values: invalid_input, invalid_id, unauthenticated, forbidden, not_found, method_not_allowed, conflict, unsupported_media_type, unprocessable, rate_limited, service_unavailable, internal_error. The set is open: treat any code you don't recognise as a generic error.
- `404` - The document does not belong to the tenant (`document_not_found`) or the version does not belong to the document (`version_not_found`)
  - `error` (string, required)
  - `code` (string, required): Machine-readable error code. Known values: invalid_input, invalid_id, unauthenticated, forbidden, not_found, method_not_allowed, conflict, unsupported_media_type, unprocessable, rate_limited, service_unavailable, internal_error. The set is open: treat any code you don't recognise as a generic error.
- `500` - Internal server error
  - `error` (string, required)
  - `code` (string, required): Machine-readable error code. Known values: invalid_input, invalid_id, unauthenticated, forbidden, not_found, method_not_allowed, conflict, unsupported_media_type, unprocessable, rate_limited, service_unavailable, internal_error. The set is open: treat any code you don't recognise as a generic error.

**Code samples:**

cURL:

```bash
curl -X DELETE "https://app.orbiqhq.com/api/v1/documents/$DOCUMENT_ID/file" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
