Database endpoints
Write a batch
Writes many rows in one request, from a JSON array or a newline-delimited JSON stream.
POST /v1/tenants/{tenant}/rows/{schema}/_batch
- Choose JSON array or NDJSONMatch the request format to your ingestion workflow.
- Send the row batchValidate rows against the destination table.
- Inspect inserted and errorCheck partial progress before retrying a failed stream.
Before you start
Use your database bearer token.
Register the destination table first. The example writes three linked rows to demo.people.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
schema | string | Required |
Query parameters
| Field | Type | Required |
|---|---|---|
expect | string | Optional |
chunk | integer | Optional |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-oc-db-user | string | Optional | Acting database user (role, grant and row-policy checks). Send with x-oc-db-key. |
x-oc-db-key | string | Optional | API key of the x-oc-db-user user. |
Request body
application/json
Limits and accepted values
- A JSON array (up to 64 MiB) is written atomically.
- Send Content-Type application/x-ndjson, application/jsonl or application/ndjson to stream one JSON row per line instead, committed in chunks of ?chunk rows (default 1000, max 10000).
- With ?expect=insert a duplicate primary key is rejected with 409.
- Honors Idempotency-Key.
| Field | Type | Required | Description |
|---|---|---|---|
Fields | object[] | Optional | A JSON array (up to 64 MiB) is written atomically. Send Content-Type application/x-ndjson, application/jsonl or application/ndjson to stream one JSON row per line instead, committed in chunks of ?chunk rows (default 1000, max 10000). With ?expect=insert a duplicate primary key is rejected with 409. Honors Idempotency-Key. |
Array item | object | Optional | One row keyed by column name. |
Read the result
inserted reports the rows written. JSON-array and NDJSON requests have different commit boundaries: an NDJSON stream commits in chunks, so a later failure can leave earlier chunks written.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 200 | OK |
| 207 | See the error body |
| 400 | Correct the request before retrying. |
| 401 | Check the credential and Authorization header. |
| 402 | Check feature access or available credits. |
| 403 | Check tenant access, roles and permissions. |
| 404 | Check the resource ID and API route. |
| 409 | Resolve the conflict before retrying. |
| 413 | Split or reduce the request body. |
| 415 | Send the required Content-Type. |
| 422 | Correct the values or unsupported combination. |
| 429 | Honor Retry-After when present; back off. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 503 | Honor Retry-After when present; check write outcomes. |