POST /{db}/_purge
This request permanently removes references to specified deleted documents from the database.
Deleting a document does not remove the document from the database. It just marks the document as deleted and creates a new revision to ensure that deleted documents can be replicated to other databases as having been deleted. This also means that you can check the status of a document and determine whether the document has been deleted by its absence.
Purging documents does not remove the space used by them on disk. To reclaim disk space, run a database compact (see /db/_compact) or compact views (see /db/_compact/design-doc) request.
Avoid using POST/db/_purge requests because they can have
unanticipated side effects.
Request
Request headers
This request does not have any required headers.
Query parameters
This request does not use query parameters.
Message body
The request message body is a JSON document that contains an object in which the key is a document identifier and the value is a list of the revision identifiers.
| Name | Type | Description |
|---|---|---|
| not applicable | object | An object that represents the document to be purged. The key is the document identifier and the value is an array that contains identifiers of the revisions to be purged. |
Response
Status codes
- 200 OK – Request completed successfully
- 400 Bad Request – Invalid database name or JSON payload
- 415 Unsupported Media Type – Bad Content-Type value
Response headers
This response uses only standard HTTP headers.
Message body
The response message body contains the following objects:
| Name | Type | Description |
|---|---|---|
purge_seq | integer | Purge sequence number |
purged | object | An object that represents the purged document. The key is the document identifier and the value is an array that contains identifiers of the purged revisions. |
Example
Request
POST /cookbook/_purge HTTP/1.1
Response