---
title: "Delete a batch of objects with a given prefix"
method: POST
path: "/worker/objects/remove"
tags: ["worker"]
---

# Delete a batch of objects with a given prefix

`POST /worker/objects/remove`

Deletes all objects with the provided prefix from the database. The data is not removed from the network immediately. Instead, the autopilot prunes data from the contracts periodically, after that happens the host is no longer obliged to store the data and it's effectively removed from the network.

## Request body

- object
  - `bucket` string — The name of the bucket the objects belong to
  - `prefix` string — The prefix of the objects to delete

## Response `200`

Successfully removed objects

## Other responses

- `400` — Malformed request
- `404` — Object not found
- `500` — Internal server error

## Changes

- **2025-01-23** `c38282599c5a` — 2 breaking, 1 info
  - added `#/components/schemas/ObjectKey, subschema #2` to the `prefix` request property `allOf` list
  - the `prefix` request property type/format changed from `string`/`` to ``/``
  - the `prefix` request property's minLength was decreased from `1` to `0`
- **2024-12-18** `922f156353c9` — 2 breaking, 1 info
  - removed the media type `text/plain` for the response with the status `404`
  - removed the media type `text/plain` for the response with the status `500`
  - api tag `worker` added
- **2024-12-12** `be2f724d7cd4` — 1 breaking
  - removed the media type `text/plain` for the response with the status `200`
- **2024-12-12** `1a4b05c71ba9` — 1 breaking, 1 warning
  - added `#/components/schemas/BucketName` to the `bucket` request property `allOf` list
  - removed `#/components/schemas/Bucket` from the `bucket` request property `allOf` list
- **2024-12-09** `9bd8635d818c` — 2 breaking, 1 info
  - added `#/components/schemas/Bucket, subschema #2` to the `bucket` request property `allOf` list
  - the `bucket` request property type/format changed from `string`/`` to ``/``
  - removed the pattern `(?!(^xn--|.+-s3alias$))^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$` from the request property `bucket`

[Full history](https://skmtc.dev/siafoundation/apis/renterd-api/changes/worker/objects/remove/post.md)

---

[API](https://skmtc.dev/siafoundation/apis/renterd-api.md) · [All operations](https://skmtc.dev/siafoundation/apis/renterd-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/siafoundation/renterd-api/revisions/5d06f620dc2b/schema)
