Skip to main content

Trash API

If you're a Nexus Repository administrator, you can use the following APIs to list, restore, and permanently purge deleted entities. Use these endpoints to browse Trash, recover deleted entities during the retention period, and purge entities you no longer need. For more details on example responses, refer to the Nexus Repository API Reference documentation.

Trash supports the following entity types:

  • repository

  • component

  • asset

Browse All Deleted Entities

The following endpoint retrieves a paginated list of all entities in Trash across supported entity types. You can use filters such as entityType, format, repositoryId, and q, along with pagination controls such as offset and limit, to narrow results and manage large Trash inventories.

GET /service/rest/v1/trash/browse-all

Query Parameters:

  • offset: Number of items to skip for pagination.

  • limit: Maximum number of items to return.

  • sort: Field and direction to sort results, such as name:asc.

  • entityType: Filter by entity type.

  • format: Filter by repository format.

  • repositoryId: Filter by repository ID.

  • q: Search deleted entities by name.

  • deletedBy: Filter by the user who deleted the entity

Browse Deleted Entities By Type

The following endpoint retrieves a paginated list of entities in Trash for the specified entity type.

GET /service/rest/v1/trash/{entityType}

Path Parameters:

  • entityType: Entity type to browse. Supported values are repository, component and asset.

Count Deleted Entities By Type

The following endpoint returns the number of entities in Trash for the specified entity type.

GET /service/rest/v1/trash/{entityType}/count

Path Parameters:

  • entityType: Entity type to count. Supported values are repository, component and asset.

Restore Deleted Entity

The following endpoint restores the specified entity from Trash.

POST /service/rest/v1/trash/{entityType}/{id}/restore

Path Parameters:

  • entityType: Entity type to restore. Supported values are repository, component and asset.

  • id: Identifier of the entity.

Purge Deleted Entity

Permanently deletes the specified entity from Trash. After purge, the entity cannot be restored from Trash.

DELETE /service/rest/v1/trash/{entityType}/{id}/purge

Path Parameters:

  • entityType: Entity type to purge. Supported values are repository, component and asset.

  • id: Identifier of the entity.

Bulk Restore Deleted Entities

The following endpoint restores multiple entities from Trash in one request. Bulk restore supports up to 250 items per request.

POST /service/rest/v1/trash/bulk-restore

Body Parameters:

  • items: List of entities to restore.

  • items[].entityType: Entity type to restore. Supported values are repository, component and asset.

  • items[].identifier: Identifier of the entity.

Bulk Purge Deleted Entities

The following endpoint permanently deletes multiple entities from Trash in one request. Bulk purge supports up to 250 items per request.

POST /service/rest/v1/trash/bulk-purge

Body Parameters:

  • items: List of entities to purge.

  • items[].entityType: Entity type to purge. Supported values are repository, component and asset.

  • items[].identifier: Identifier of the entity.

Standard Delete API Behaviour

When Trash is enabled for hosted repositories, the standard component and asset delete endpoints route eligible delete operations to Trash instead of permanently deleting the entity immediately.

DELETE /service/rest/v1/components/{id}

Path Parameters:

  • id: Identifier of the component to delete.

DELETE /service/rest/v1/assets/{id}

Path Parameters:

  • id: Identifier of the asset to delete.

Proxy and group repositories are not recoverable from Trash.