Skip to main content

Delete a Document

  • Use this endpoint with the **DELETE** method to delete one document from the database:
    <server URL>/databases/<database name>/docs?id=<document ID>

  • In this page:

Example

This is a cURL request to delete the document "employees/1-A" from a database named "Example" on our playground server:

curl -X DELETE "http://live-test.ravendb.net/databases/Example/docs?id=employees/1-A"

Response:

HTTP/1.1 204
status: 204
Server: nginx
Date: Tue, 27 Aug 2019 11:40:12 GMT
Connection: keep-alive
Raven-Server-Version: 4.2.3.42

Request Format

This is the general format of the cURL request:

curl -X DELETE "<server URL>/databases/<database name>/docs?id=<document ID>"
--header "If-Match: <expected change vector>"
Query ParametersDescriptionRequired
idID of a document to be deleted.Yes
HeadersDescriptionRequired
If-MatchExpected change vector. If it matches the server-side change vector the document is deleted, if they don't match a concurrency exception is thrown.No

Response Format

HeaderDescription
Content-TypeMIME media type and character encoding. This should always be: application/json; charset=utf-8.
Raven-Server-VersionVersion or RavenDB the responding server is running
HTTP Status CodeDescription
204The document was successfully deleted, or no document with the specified ID exists.
409The change vector submitted did not match the server-side change vector. A concurrency exception is thrown.