Creates a new document or update an existing one

post

/_/baas-services/database/{project_id}/v2/setDocument

This service creates a new document in the specified collection or updates an existing one. For creating a new document, provide a collection path (odd-length array) and the data. For updating, provide a document path (even-length array), data, and options (e.g., merge: true to merge with existing data). Supports API version 2 for data formats. For duality views, specify dv_name, data, and optional OID for updates. Returns the OID of the created or updated document. Requires authentication via Bearer token or AppKey. Use 'version' in request Body for optimistic locking on updates. Payload may include "$embeddings" in document data for BYOV vector fields. For API version 2 operation-array payloads, `set` on `$embeddings` accepts an object keyed by vector column name, `delete` on `$embeddings` accepts an array of embedding keys, and delete semantics perform key-nulling in the request-resource transform; vector apply treats `null` as clear-column (sets VECTOR column to `NULL`).

Request

Path Parameters
Header Parameters
Back to Top

Response

200 Response

Returns OID of the new/updated document

401 Response

Authentication Failure

Default Response

Error
Back to Top