---
title: "Remove a document"
method: DELETE
path: "/_fabric/{fabric}/_api/document/{collection}/{key}"
tags: ["Documents"]
---

# Remove a document

`DELETE /_fabric/{fabric}/_api/document/{collection}/{key}`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_fabric/:fabric/_api/document/:collection/:key/delete.ts> (a function with typed inputs; its response is checked against the schema)

If *silent* is set to *false*, the body of the response contains a JSON object with the information about the handle and the revision.

 - *_id* contains the known *key* of the removed document.
 - *_key* contains the key which uniquely identifies a document.
 - *_rev* contains the document revision.

If the query parameter *returnOld* is *true*, the previous revision of the document is returned under the *old* attribute in the result.

## Path parameters

- `fabric` string, string, required
- `collection` string, string, required
- `key` string, string, required

## Query parameters

- `returnOld` boolean
- `silent` boolean
- `waitForSync` boolean

## Headers

- `If-Match` string

## Response `200`

Successfully removed document when *waitForSync* is enabled.

- ExamplesIdKeyRev
  - `_id` string: ID of the collection.
  - `_key` string: _key details of collection.
  - `_rev` string: _rev details of collection.

## Other responses

- `202`: Successfully removed document when *waitForSync* is disabled.
- `404`: Failed to find specified collection or document.
- `412`: Failed to remove document due to different version if a *If-Match* header or *rev* is given. The response contains the found document's current revision in the *_rev* attribute. Additionally, the attributes *_id* and *_key* are returned.

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
