/data/{collection}/{id}Update Record
Applies a partial update (delta) to the record identified by id in the named collection.
Only the fields present in the request body are modified; omitted fields are left unchanged.
Passing ?requireApproval=true routes the update through the Maker-Checker evaluation engine: if no auto-approve policy matches, the operation is queued and the response returns HTTP 202 with meta.status: "pending_approval".
Returns K9O_COLLECTION_NOT_FOUND (404) if the collection does not exist and K9O_NOT_FOUND (404) if the record id does not exist.
| collection * | path | The collection's name. |
| id * | path | The record's id: the value of its |
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
| HTTP | K9O Code | Description |
|---|---|---|
| 200 | Success | |
| 202 | Accepted | |
| 401 | K9O_SESSION_EXPIRED | Your session has expired; sign in again to update records. |
| 401 | K9O_INVALID_CREDENTIALS | The credentials provided are not valid; the update request was rejected. |
| 403 | K9O_ACCESS_DENIED | Your role does not permit updating records in this collection. |
| 403 | K9O_RESERVED_COLUMN_WRITE_PROHIBITED | The update payload contains a reserved column name (prefixed with '_') that may only be written by the platform. |
| 404 | K9O_COLLECTION_NOT_FOUND | The target collection does not exist in this project. |
| 409 | K9O_ALREADY_EXISTS | The update violates a unique constraint on the collection. |
| 409 | K9O_MULTIPLE_ROWS_RETURNED | The update targeted more than one row where only one was expected. |
| 409 | K9O_BYOK_REGION_MISMATCH | The change writes an encrypted field for a data subject, and the project's customer-managed key does not cover the region the record is written in. Nothing was changed, and the field is never sealed under a platform key. |
| data * | object | The record as stored after the write, keyed by column name: every column of the collection's table, including Protected columns come back as plaintext, except columns that need a reveal purpose, which come back in their opaque protected form. With An anonymous guest-capture insert gets only Values are serialised from their Postgres column type:
|
| meta * | any | Request metadata: cost, timing, request and trace ids. |
| data * | object | The write was queued for approval (HTTP 202) because a bound approval policy requires it, or It expires after 28 days unless decided. |
| id * | string | The pending change's id ( Approve or reject it through the pending-approvals API. |
| status * | "pending_approval" | Always The write runs when the change is approved. |
| collection * | string | The collection the change targets. |
| operation * | "insert" | "update" | "delete" | The write that was queued. |
| makerId * | string | Who proposed the change: the accountable originator on a delegated call, otherwise the caller (a user id, or |
| proposedPayload * | object | The request body as sent, applied when the change is approved: column name to value. Empty for a delete. |
| targetRecordId * | any | The record an update or delete targets; null for an insert. |
| One of: string | ||
| or: null | ||
| meta * | object | Request metadata (cost, timing, request and trace ids), plus |
| approval * | object | Marks the answer as queued for approval. |
| status * | "pending_approval" | |
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.from('products').update({}).eq('id', 'prod_demo00000001')Showing example in TypeScript
{}{
"data": {
"id": "string",
"status": "pending_approval",
"collection": "string",
"operation": "insert",
"makerId": "string",
"targetRecordId": "string"
},
"meta": {
"approval": {
"status": "pending_approval"
}
}
}