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

# Delete files from the data release collection.

`DELETE /datacatalog/api/data-release/{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/data-release/{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.

This endpoint takes a JSON payload containing a non-empty `files_to_delete`
list naming the files to delete from the data release directory.

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 -- including component directories -- cannot be
deleted through this endpoint; delete a component with
`DELETE /component/{id}` instead.

.. 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 data release's search index and distribution metadata are not
updated by this endpoint. Reindex with
`POST /item/{item_id}/upload/index-files` once the delete task has
succeeded.

:param id: The ID of the data release.
: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 data release does not exist (404).
:raises ForbiddenException: If the user lacks write access to the data
    release (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)
