Skip to main content
records

Create Labels Field Definition

Turn the company's label metadata into a multi_select definition on routines and write each routine's value from its labels references. Superadmin only; works while the company flag is off (the values stay invisible until it is on).

POST
/api/records/{company_name}/field-definitions/from-labels

One option per label: the key is a slug of the title (English first, else the first language with text; label_<id> when no letters or digits remain; _2, _3 on collision), the label the title (its own translations kept, the missing company languages filled), source_reference_id the metadata id. A repeat run appends options for new labels and plans every routine's value as the sorted distinct keys of its live label references, archived options left out. By default a run only creates a value or adds keys to it (set_count); a routine whose stored value holds a key the plan drops (overwrite_count, an API edit or an archived option) or whose references are all gone (unset_count) is rewritten or unset only with overwrite: true. The label references stay. dry_run: true answers the counts without writing.

422 types: group_unsupported (a group outside the routine sections), no_labels. 409 types: field_id_collision (a global row has the id), field_archived_exists (restore first), field_type_mismatch (the id holds another type), definition_unreadable.

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

company_namestringrequired

Body

application/json
dry_runbooleandefault:false
field_idstringdefault:labels
Pattern: ^[a-z][a-z0-9_]*$
groupstringdefault:routine
orderintegerdefault:10
overwritebooleandefault:false

Response

application/json

Successful Response

definitionobject | nullrequired
field_idstringrequired
option_countintegerrequired
overwrite_countintegerrequired
routine_countintegerrequired
set_countintegerrequired
unset_countintegerrequired
writtenbooleanrequired