OriginChainDB
Database endpoints

Update a row conditionally

Write a row by primary key, with an optional version check through If-Match.

PUT /v1/tenants/{tenant}/rows/{schema}/{pk}

Update only the row version you readWithout If-Match, this request is an unconditional upsert.
  1. Read the current rowKeep the version associated with that record.
  2. Send a conditional writeSupply the expected version through If-Match.
  3. Check success or conflictOn 409, read and reconcile the newer row.

Before you start

Use your database bearer token.

Connection setup

For a conditional update, read the row and use its _oc_row_version in If-Match. Without that header, the request is an unconditional upsert. Do not combine If-Match with expect=insert.

Path parameters

FieldTypeRequired
tenantstringRequired
schemastringRequired
pkstringRequired

Query parameters

FieldTypeRequired
expectstringOptional
chunkintegerOptional

Headers

FieldTypeRequiredDescription
x-oc-db-userstringOptionalActing database user (role, grant and row-policy checks). Send with x-oc-db-key.
x-oc-db-keystringOptionalAPI key of the x-oc-db-user user.

Request body

application/json

Limits and accepted values
  • The full row as a JSON object keyed by column name;
  • its primary key must match the path.
  • Without an If-Match header this is an unconditional upsert.
  • If-Match: <n> (bare or quoted) requires the row to be at version n (its _oc_row_version);
  • If-Match: * requires the row to exist.
  • A stale version answers 409 write_conflict with current_version;
  • a missing row answers 412 precondition_failed.
  • Weak or list-valued If-Match is refused (400), as is ?expect=insert combined with If-Match. ?expect=insert alone makes the write insert-only. ?chunk is accepted but only affects NDJSON ingest.
  • Honors Idempotency-Key.
FieldTypeRequiredDescription
FieldsobjectOptionalThe full row as a JSON object keyed by column name; its primary key must match the path. Without an If-Match header this is an unconditional upsert. If-Match: <n> (bare or quoted) requires the row to be at version n (its _oc_row_version); If-Match: * requires the row to exist. A stale version answers 409 write_conflict with current_version; a missing row answers 412 precondition_failed. Weak or list-valued If-Match is refused (400), as is ?expect=insert combined with If-Match. ?expect=insert alone makes the write insert-only. ?chunk is accepted but only affects NDJSON ingest. Honors Idempotency-Key.

Read the result

version is the row version after a successful write. A stale If-Match returns 409; read the current row and reconcile your change rather than overwriting it blindly. Without If-Match, the request is an unconditional upsert.

Response statuses

HTTP status reference
StatusWhat to do
200OK
400Correct the request before retrying.
401Check the credential and Authorization header.
402Check feature access or available credits.
403Check tenant access, roles and permissions.
404Check the resource ID and API route.
409Resolve the conflict before retrying.
412Refresh the version or ETag before writing again.
413Split or reduce the request body.
415Send the required Content-Type.
422Correct the values or unsupported combination.
429Honor Retry-After when present; back off.
500Check the outcome before retrying a write.
501Check deployment support for this operation.
503Honor Retry-After when present; check write outcomes.
ยฉ 2026 Silicoyn Technologies Pvt Ltd