# Delete (https://s3.dimah.dev/docs/react/custom-backend/delete)



`delete` removes one object. Unlike upload and download, this is a direct
mutation — not a presigned client-to-S3 call.

The payload is a single object: `route` and `key`.

<AutoTypeTable path="packages/core/src/types/requests.ts" name="DeletePayload" />

<AutoTypeTable path="packages/core/src/types/responses.ts" name="DeleteResponse" />

```ts
import type { DeletePayload, DeleteResponse } from "@dimah-s3/core";
```

## Example [#example]

Add this to the [`defineApi`](https://s3.dimah.dev/docs/react/custom-backend) skeleton.
[`@dimah-s3/server`](https://s3.dimah.dev/docs/server) uses `DELETE /api/s3/delete?route=…&key=…`.

```ts
async delete(payload) {
  const params = new URLSearchParams({
    route: payload.route,
    key: payload.key,
  });

  const res = await fetch(`/api/files/delete?${params}`, { method: "DELETE" });
  if (!res.ok) throw new Error(await res.text());
  return res.json();
}
```
