6.5. DELETE /db/doc

MethodDELETE /db/doc
Request None
Response JSON of the deleted revision
Admin Privileges Requiredno
Query ArgumentsArgumentrev
 Description Current revision of the document for validation
 Optionalyes
 Typestring
HTTP HeadersHeaderIf-Match
 DescriptionCurrent revision of the document for validation
 Optionalyes
   
Return Codes
409 Revision is missing, invalid or not the latest

Deletes the specified document from the database. You must supply the current (latest) revision, either by using the rev parameter to specify the revision:

DELETE http://couchdb:5984/recipes/FishStew?rev=3-a1a9b39ee3cc39181b796a69cb48521c
Content-Type: application/json

Alternatively, you can use ETags with the If-Match field:

DELETE http://couchdb:5984/recipes/FishStew
If-Match: 3-a1a9b39ee3cc39181b796a69cb48521c
Content-Type: application/json

The returned JSON contains the document ID, revision and status:

{
   "id" : "FishStew",
   "ok" : true,
   "rev" : "4-2719fd41187c60762ff584761b714cfb"
}

Note

Note that deletion of a record increments the revision number. The use of a revision for deletion of the record allows replication of the database to correctly track the deletion in synchronized copies.