---
title: "Delete files from the data release component collection."
method: DELETE
path: "/datacatalog/api/component/{id}/files"
tags: ["Data Release"]
---

# Delete files from the data release component collection.

`DELETE /datacatalog/api/component/{id}/files`

## Request

- Base URL: `https://data.usgs.gov` (the document declares no server; this is the origin it was published from)
- URL: `https://data.usgs.gov/datacatalog/api/component/{id}/files`
- Auth: OAuth 2
  - Authorization code: `https://auth.globus.org/v2/oauth2/authorize?scope=openid`
  - Token URL: `https://data.usgs.gov/datacatalog/api/auth/login`

Delete files from the Globus collection directory for a data release
component.

This endpoint takes a JSON payload containing a non-empty `files_to_delete`
list naming the files to delete from the component directory, i.e. from
`<release_id>/<component_name>/`.

Each entry must be a plain file name, not a path. Entries containing `/` or
`\`, and the entries `""`, `"."` and `".."`, are rejected. Deletes are not
recursive, so directories cannot be deleted through this endpoint.

.. code-block::

    {
        "files_to_delete": [
            "example.xml",
            "data.csv"
        ]
    }

The delete is submitted to Globus as an asynchronous task. The response
`data` includes its `task_id`; poll the task's status with
`GET /data-release/files/task/{task_id}` to confirm the files were removed.

Note that the component's search index and distribution metadata are not
updated by this endpoint.

:param id: The ID of the data release component.
:param params: The JSON payload containing the `files_to_delete` list.
:param token: A valid bearer token for the user.
:returns: A success :class:`HorizonAPIResponse` whose `data` contains the
    Globus delete `task_id`.
:raises NotFoundException: If the component does not exist (404).
:raises ForbiddenException: If the user lacks write access to the component
    (403).
:raises DeleteFilesException: If any entry in `files_to_delete` is not a
    plain file name (400).

## Path parameters

- `id` string, required

## Request body

- HorizonDeleteFilesParams
  - `files_to_delete` string[], required: The names of the files to delete from the data release or component directory. Each entry must be a plain file name, not a path; entries containing a path separator are rejected. Deletes are not recursive, so directories cannot be deleted.

## Response `200`

Successful Response

- unknown

## Other responses

- `404`: Not found
- `422`: Validation Error

---

[API](https://skmtc.dev/usgs/apis/usgs-science-data-catalog-api-documentation.md) - [All operations](https://skmtc.dev/usgs/apis/usgs-science-data-catalog-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/usgs/apis/usgs-science-data-catalog-api-documentation/revisions/f5f6a07ba13f?raw)
