Skip to main content
PATCH
Edit a business definition

Authorizations

Authorization
string
header
required

MeshQu API key passed as a bearer token: Authorization: Bearer mqu_…. Mint one in the console (Settings → API keys).

X-MeshQu-Tenant-Id
string
header
required

Tenant UUID for multi-tenant isolation. Required on all authenticated routes — validated before authentication (middleware/tenant.ts), so a missing or non-UUID header returns 400 (MISSING_TENANT_ID / INVALID_TENANT_ID) before the API key is checked.

Path Parameters

field_name
string
required

The canonical key, e.g. vendor.

Body

application/json
expected_revision
integer
required

The declaration_revision the caller believes is current. REQUIRED: the write applies only if it still matches, and is refused 409 STALE_DEFINITION_REVISION with expected_revision and current_revision otherwise (contract §7). Two authors editing the same definition concurrently is exactly what this is for — the second is refused and the console reloads and re-offers.

Required range: x >= 1
label
string

The display label. Changing it NEVER renames the canonical key (contract §1) — the key is what rules and payloads use and it is never renamed at all.

Required string length: 1 - 200
description
string | null

What the fact means, in the business's words. null clears it.

Maximum string length: 2000
owner
string | null

Who in the business owns this fact's meaning. RECORDS a name; grants no authority. null clears it.

Maximum string length: 200
choices
any[] | null

The choice domain — business metadata that NEVER edits a rule's allowed values. Replaces the domain wholesale; null removes it. Adding a choice changes no rule, no active_rules_hash and no receipt, and a rule value that is not in the domain stays legal and is shown as unlisted rather than removed. Codes must be distinct (case-insensitively) or the request is refused 422 DUPLICATE_CHOICE_CODE; a malformed entry is refused 422 INVALID_CHOICE_SHAPE naming its index.

Maximum array length: 200
value_type
string

NOT EDITABLE. Present only so a type change is refused 422 DEFINITION_TYPE_CHANGE_UNSUPPORTED rather than as an unexpected property: contract §2 makes a type change a redeclaration, and the author creates a new definition under a new key (R-BC-2 open).

unit
string

NOT EDITABLE, for the same reason as value_type. Refused 422 DEFINITION_TYPE_CHANGE_UNSUPPORTED.

Response

Default Response

field_name
string
required

The canonical key, UNCHANGED by this write — it is never renamed (contract §1).

label
string
required
value_type
required
Available options:
number
declaration_revision
integer
required

The revision AFTER this write. Send it back as expected_revision on the next edit.

changed
boolean
required

false when the request supplied the stored values back: no revision row was appended and the counter did not move. Appending a revision identical to its predecessor would put an event in the history that did not happen.

description
string
unit
string
owner
string
choices
object[]

The business's list of possible values for this definition — business metadata that NEVER edits a rule's allowed values. Not a permitted subset: the subset a particular list rule allows or forbids lives in the rule. At most 200 entries.

Maximum array length: 200
change_kind

Which ordinary revision this write was. ABSENT when nothing changed. When several fields move at once it is meaning if the description changed, otherwise the first changed field in the fixed order label, owner, choices — a label on the revision, never a statement of what the revision contains, which is always the full snapshot.

Available options:
declare