Documents
POST
/_api/database/:db/document/:collection
Create a new document.
Request Body Options
Send a JSON object representing the document. The _key field is optional; if omitted, one will be auto-generated.
{"name": "Alice", "age": 30}
Response
200 OK
application/json
{
"_key": "123456",
"_rev": "1",
"name": "Alice",
"age": 30
}
POST
/_api/database/:db/document/:collection/_batch
Insert multiple documents in a single request. More efficient than individual inserts.
Request Body
[{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]
Response
{ "inserted": 2, "documents": [...] }
GET
/_api/database/:db/document/:collection/:key
Retrieve a document by key.
Response
200 OK
application/json
{
"_key": "123456",
"_rev": "1",
"name": "Alice",
"age": 30
}
PUT
/_api/database/:db/document/:collection/:key
Replace/Update a document.
Response
200 OK
application/json
{
"_key": "123456",
"_rev": "2",
"name": "Alice",
"age": 31
}
DELETE
/_api/database/:db/document/:collection/:key
Remove a document.
Response
204 No Content