On this page

Every write to an entity’s records follows the same rules for finding the record it addresses and for what an update changes. This page states those rules for a single-record upsert or delete and for an entity synchronization, and lists where a bulk load counts a row instead of refusing it.

OperationWritesRole
POST /api/golden/{entity}/upsertOne record of an entitySTEWARD or ADMIN
DELETE /api/golden/{entity}/deleteDeletes one record of an entitySTEWARD or ADMIN
POST /api/golden/{entity}/restoreRestores a deleted record from historySTEWARD or ADMIN
POST /api/golden/{entity}/source/releaseRemoves one recorded origin from a live recordADMIN
PUT /api/entities/synchronizeAn entity’s records, from its configured sourcesADMIN
POST /api/tables/load, POST /api/tables/transformA table that belongs to no entityADMIN

An entity’s data is written only through the entity: its synchronization or the upsert. A table load or transform whose target is an entity’s table is refused; see Table loads.

The upsert request

The request carries one record and optional controls:

MemberDefaultEffect
recordRequiredThe record to write. Its _id, when present, is read as a string, so 42 and "42" address the same record
insertfalseCreate a record; refuse the request when the key already names one
updatefalseUpdate an existing record; refuse the request when the key names none
transformationNoneA transformation resource applied to record before the entity’s pipeline. A name that is not a transformation answers 404
commentNoneA comment recorded with the change where auditing is enabled

Setting both insert and update is a 400.

The response reports inserted, updated, the written record, and messages that explain the result. An update that changes nothing still answers updated: true, with a message saying the record already held these values.

How the upsert finds its record

Golden resolves one identity after the requested transformation and the entity’s pipeline. On a DEFAULT dataset, a supplied, free, usable _id becomes the record’s identity; without one, Golden assigns an identifier. On COLUMN and SCRIPT datasets, Golden computes the identity from the prepared business fields. A script never receives _id as an input. A supplied _id must agree with the computed identity; it is never silently ignored. An absent, partial or unusable computed identity is refused with 400 IDENTITY_INVALID. A different supplied _id is refused with 400 IDENTITY_MISMATCH on creation. An update cannot change the identity, including by emptying or filling an identity field.

A live identity addresses its record. An identity in history is resolved as merged, deleted or undone, rather than reused. A new identity creates a record unless update: true requires an existing one. See dataset identity.

Situations and answers

SituationAnswer
DEFAULT dataset, a free, usable _idCreated under that identifier; it need not be a UUID
DEFAULT dataset, update: true without _id400; supply the record identifier
No _id, an identity that names a live record (COLUMN or SCRIPT)That record is updated
COLUMN or SCRIPT, supplied _id differs from the computed identity on creation400 IDENTITY_MISMATCH
COLUMN or SCRIPT, computed identity is absent, partial or unusable400 IDENTITY_INVALID; nothing is created
insert: true with a live _id or a live identity409 with existingIds naming that record
insert: true with a free identityCreated under the identity
insert: true with an _id or identity in historyThe same answer as without the flag: 409 with survivorId, 409 with restoredIds, or 410
update: true with an _id naming nothing, even if another identity is live409; nothing is written
The survivor of an undone merge409 with restoredIds naming live restored records, or the records history still holds to restore; 410 only when history holds none
A changed identity on update, or qualityState in the request400; build the request from writable fields rather than posting a complete read response
A creation on a dataset requiring _src_id without a keyed _source entry400 PROVENANCE_VOCABULARY
An identity script that fails400 naming the failure. Nothing is written

Identity values that cannot key a record

An identity value cannot key a record when it is longer than 255 characters, contains /, \, ?, #, %, [, ] or a control character, or is . or ...

A COLUMN identity of several columns joins their trimmed values with ::. No component may contain :: or start or end with :, so a key splits one way only; the rule applies to a one-column identity too. A SCRIPT identity is one value and is not split.

Read a conflict

A 409 from an upsert or a delete carries a conflict body. The member that is filled says what to do next:

MemberMeaningNext step
survivorIdA merge absorbed the record the request namedWrite to the survivor
restoredIdsThe request named the survivor of a merge that was undone; these are the restored records still live, or the ones history holds to restoreChoose a live record or review restoration
existingIdsA live record already holds the key or the source pairUse that identifier
existingIdsTotalAccompanies existingIds: how many records hold it. It exceeds the length of existingIds only when the list was cut—
reasonMachine-readable conflict reason; handle unknown values as a generic conflictInspect the other structured members
NoneThe key the request named is wrongCorrect the request

existingIds names at most 20 live records, sorted by identifier; when it is cut, the message says how many of the total it names. A 410 means the addressed record was deleted. The conflict reason can distinguish UNKNOWN_ID, ALREADY_EXISTS, MERGED, MERGE_UNDONE and DELETED; clients should still handle unknown reasons. See conflict handling for the general status conventions.

What an update writes

An update is a partial merge:

  • A member left out of the body is untouched.
  • A member sent as null is emptied.
  • A member cannot be removed from the record, only emptied.

The same rule applies to an entity synchronization and a table load; see Empty values in a load for how each source format expresses “empty” and “untouched”.

An update may add _source entries but cannot remove or alter an existing entry. Restating an entry changes nothing. An _xml, _text or _binary root sent on update replaces that root; an absent or null root leaves it unchanged. A foreign _golden entry is refused unless the same write supplies a real origin that supersedes it.

A malformed _source is a 400 naming the first problem found, with the entry and the member, in the caller’s language.

Golden manages _metadata, _audit, quality and search evidence itself; a request carrying _audit is a 400. Build a write from the record’s business fields and _id rather than from a complete read response; see Record metadata.

Lineage uniqueness

A _source entry pairs a source (_src) with its record reference (_src_id). The dataset’s optional lineageUnique setting, off by default, prevents two live records from holding the same real pair. It checks both creations and updates; history does not reserve a pair. A conflict returns 409 with existingIds and existingIdsTotal. Enabling the setting over pairs already held by several live records warns about those records rather than silently changing them. A pair is not another address for an upsert.

An ADMIN may call POST /api/golden/{entity}/source/release with _id, _src, _src_id and a required comment to remove an origin from a live record. The change is audited and published as an update. If the list would become empty, Golden restores its own default origin. A configured source may add the released pair again on a later load.

Writes under a data scope

A caller restricted by a data scope is never told the identifier of a record outside it. A request that addresses that record directly is treated as unknown; related identifiers in an otherwise visible response are filtered:

  • An update of a live record outside the scope is a 404 before any refusal of the update, such as a changed identity or invalid provenance.
  • An out-of-scope identity is treated as unknown; refusal bodies list only identifiers the caller can see, and existingIdsTotal counts only those.
  • A survivor or restored record outside the scope answers as an unknown id.

Delete a record

DELETE /api/golden/{entity}/delete removes one current record. The record identifier and an optional comment travel in a JSON body:

curl --fail-with-body --silent --show-error \
  --request DELETE \
  --header "Authorization: Bearer ${GOLDEN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{"recordId":"<record id>","comment":"<reason>"}' \
  "${GOLDEN_URL}/api/golden/{entity}/delete"

A successful delete answers deleted: true and the deleted record. The delete answers history the way the upsert does and never follows a merge to delete the survivor.

SituationAnswer
A live id, including one sent with surrounding spacesThe record is deleted
An id a merge absorbed409 with survivorId; the survivor is not deleted
The survivor of an undone merge409 with restoredIds; 410 only when history holds none of the restored records
A deleted id, including a second delete of the same id410
An unknown or blank id, or one outside the caller’s data scope404, naming only the id sent

A STEWARD or ADMIN can restore a deleted record from history with POST /api/golden/{entity}/restore, supplying its _id and an optional comment. A table that belongs to no entity has no restore route.

Tables without history

Golden can answer for an absorbed or deleted record only on a table that keeps history. On a table without history, a merge deletes the records it absorbs, so an upsert or delete of an absorbed or deleted id is treated as unknown, a search for it finds nothing, and reloading an absorbed record’s identity recreates it beside its survivor. Choose history when the table is created for an entity that is reloaded and merged.

Entity synchronization

A synchronization applies the same identity and lineage rules as an upsert, but counts refused rows by category and continues where possible. A source row is prepared by its transformation and pipeline before its identity is checked.

RowResult
DEFAULT with a free usable _idCreated under that identifier
DEFAULT with an _id in historySkipped; a load does not restore it
COLUMN or SCRIPT with an absent, partial or unusable identityRefused; no identifier is minted
COLUMN or SCRIPT with a supplied _id that differs from its computed identityRefused on creation
A reserved, unsupported _ memberRefused
An update with new _source entriesEntries are added, subject to lineage rules
An update with a content rootThe supplied root replaces the stored root

A source that stamps provenance must supply a provenanceKey if the dataset requires _src_id. It no longer uses the record identity as _src_id. A source on a COLUMN or SCRIPT dataset that reads rows named by _id must declare provenanceKey: _id. An unmapped CSV header beginning with _ other than _id, _source, _xml, _text or _binary stops the load.

The task output separates skipped rows from refused rows and reports refusal counts by category. Merged, deleted and undone identities are skipped as information, not treated as new records. Re-importing an export of a DEFAULT entity remains idempotent.

Empty values in a load

On a synchronization a source row is a full snapshot of the columns it carries:

SourceEmptied on updateLeft untouched
JDBCA SQL NULL, or an empty arrayA column the query does not select
CSVA blank cellA column the file does not have
JSON"column": nullA member absent from the object

Table loads

A table load or transform writes only into a table that belongs to no entity. On such a table, null in an update empties a business field. INSERT remains insert-only: a repeated identity is refused as ALREADY_EXISTS. DELETE archives a version when history is enabled. An identity in history is still consulted, so a load does not silently recreate it.

A transform with an identity script that cannot compile stops before reading. A transform cannot change a stored row’s identity. A history relation cannot be a destination. If a table becomes an entity’s table during a load, the run stops at its next chunk. The completion summary reports skipped and refused rows by category. See table destinations.

Records stored before Golden 3.2.0

Records written under earlier identity rules are not silently re-keyed. An existing _id that differs from the current dataset identity remains as stored; an identity-addressed write can therefore address a different record. Review those records before relying on identity-based writes. To rebuild consistently, follow Rebuild a dataset’s tables.

Golden 3.4.0 · Published 2026-10-29