API · General
Field schema
The set of customer, interaction and catalog fields configured in the organization — for rendering forms and checking data before sending.
Entity field schema for rendering forms
GET/schema/{entity}
Active field definitions visible to API clients (visibility.api), in display order; the entity's
slots that have a field bound (for agent, only national_id and phone); types (customer_type
for customer, agent_role for agent).
The POST/PATCH body of this entity is validated against the same definitions. Ability
schema:read. The schema is shared across the organization; the project plays no part.
Parameters
entitystringpathrequiredcustomer,agent,interaction:<interaction type code>,catalog:<catalog code>orasset:<asset type code>— exactly in this form (case and spaces are not normalized). A code is Latin snake_case. An unknown entity, an inactive interaction type or asset type, or a missing or inactive catalog — NOT_FOUND withdetails.entity(as in the path).- Constraints
pattern: ^(customer|agent|interaction:[a-z][a-z0-9]*(_[a-z0-9]+)*|catalog:[a-z][a-z0-9]*(_[a-z0-9]+)*|asset:[a-z][a-z0-9]*(_[a-z0-9]+)*)$
- Example
customeragentinteraction:salecatalog:skuasset:device
Responses
200
The entity schema
application/jsonobject
dataSchemaDescriptionrequiredmetaMetarequired
401
UNAUTHENTICATED — the Bearer token is missing or invalid
403
FORBIDDEN — the token lacks an ability (
details.ability) or a project (details.project)404
NOT_FOUND — resource or route not found
429
RATE_LIMITED — the client's rate limit is exceeded:
details.limit— the limit per minute,details.retry_after— in how many seconds to retry; the same values are in the headersX-RateLimit-LimitandRetry-After.Headers
Retry-AfterintegerSeconds until the window resetsX-RateLimit-LimitintegerX-RateLimit-Remaininginteger
Schemas
SchemaDescription
object
entitystringrequiredAs in the path —customer,agent,interaction:<code>,catalog:<code>,asset:<code>fieldsarray<FieldDefinition>requiredIn display order; only active ones visible to the APIslotsarray<SlotDescription>requiredEntity slots (all forcustomer,national_idandphoneforagent, empty for the rest)typesarray<EntityTypeRef>requiredActivecustomer_typetypes forcustomer,agent_roleroles foragent; empty for other entities
FieldDefinition
object
codestringrequiredField key in the request body and inattributes- Constraints
pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$maxLength: 64
typeFieldTyperequiredlabelLocalizedTextrequiredrequiredbooleanrequiredThe field is required on creation; on an editnulldoes not clear itpiibooleanrequiredPersonal data — the API client does not log it and masks it on displayrulesobjectrequiredConstraints by type:string/text—min_length,max_length,pattern(a regular expression without delimiters,stringonly);integer/decimal—min,max(a string fordecimal) andscale(digits after the point);date—min,max(Y-m-dortoday);datetime—min,max(RFC 3339 ornow);multi_enum—min_items,max_items(distinct options);phone—default_region(ISO 3166-1 alpha-2 for numbers without+),regions(allowed countries);reference—catalog(catalog code; the field value is the code of an item of that catalog as a string, not a number: 1–64 characters without whitespace and control characters, the item must exist — otherwise 422 under the field code; on an edit a value equal to the stored one is not rechecked). An empty object — no constraints beyond the type.optionsarray<FieldOption>requiredOptions ofenum/multi_enum; empty for other typesslotSlot | nullrequiredCustomer slot the value goes to; null — a regular attribute
FieldType
string
- Values
stringtextintegerdecimalbooleandatedatetimeenummulti_enumphoneemailreference
LocalizedText
object
ru, en); at least one language is non-empty- Example
{"ru":"Телефон","en":"Phone"}
Key values: string
FieldOption
object
valuestringrequiredThe value passed in the body and stored- Constraints
maxLength: 64
labelLocalizedTextrequired
Slot
string
- Values
phoneemailnational_idbirth_dategenderregionlocalefull_name
SlotDescription
EntityTypeRef
object
codestringrequired- Constraints
pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$
labelLocalizedTextrequired
Meta
object
cursorcursorobjectFields
nextstring | nullrequiredCursor of the next page, null — there are no more pages
redirected_fromstring (uuid)Only on a redirect: the request came with the ID of a customer merged into another one (in the path or in the body'scustomer_id), the response is for the primary one; the value is the original ID (normalized, lower case). Without a redirect the key is absent. A retry with the sameIdempotency-Keyreturns the response stored by the first execution as is.idempotent_replaybooleanOnly on a retry: the response is taken from the idempotency store,datais byte-for-byte the same as in the first response; or a retry by the interaction's natural keyexternal_id—datais the existing interaction in its current state; or a repeated void of an already voided one. The first execution has no such field.- Always
true
versionintegerOnly in catalog lists: the catalog version — for items it is read before the rows of the first page of the traversal, for changes it is the upper bound of the feed. The next sync ischanges?since=<version>.- Constraints
minimum: 0
recordedintegerOnly when recording consents: how many rows were inserted; 0 — the whole batch was already recorded (a retry by natural key).- Constraints
minimum: 0
effectsInteractionEffects
InteractionEffects
object
external_id the deltas are empty. Rules are recalculated when an interaction is created, edited and voided: labels_added and labels_removed are labels the customer gained and lost; a change of
a rule row that did not make a label appear or disappear (a manual row exists alongside, a row of
another rule is overwritten) is visible only in rules_fired. balances — changes to the customer's balances made by the operation (redemptions and accruals on create, offsetting entries on void), one element per kind in ascending order of the code; empty on a retry and
an edit. assets — asset changes made by the operation (actions on item serial numbers on
create, their reversal on void) in recording order; empty on a retry and an edit. labels and
current_balances — the customer's state after the operation, returned on a retry too.labels_addedarray<CustomerLabel>requiredLabels the customer gained in the operationlabels_removedarray<string>requiredCodes of labels the customer lost in the operationbalancesarray<BalanceChange>requiredBalance changes of the operation by account kindassetsarray<AssetChange>requiredAsset changes of the operationrules_firedarray<RuleFired>requiredChanges to label rows made by rules, in order of applicationlabelsarray<CustomerLabel>requiredThe customer's active labels after the operationcurrent_balancesarray<CustomerBalance>requiredThe customer's current balances after the operation — likebalancesof the customer card: one element for each active account kind, zero without entries
CustomerLabel
object
sources — each active row.codestringrequiredLabel type code (lower case)kindstringrequiredKind from the type settings — blocking operations, a group, a flag- Values
blocksegmentflag
reasonstring | nullrequiredexpires_atstring (date-time) | nullrequiredISO 8601, UTC; null — no expirysourcestringrequiredSet manually or by a rule- Values
manualrule
created_byActorrequiredcreated_atstring (date-time)requiredMoment the label was set, ISO 8601, UTCsourcesarray<CustomerLabelSource>requiredActive label rows by source — the manual one first
Actor
object
kindstringrequired- Values
api_clientusersystem
idstring | nullrequiredID of the API client (UUID) or user; null forsystem
CustomerLabelSource
object
DELETE …/labels/{code}).sourcestringrequired- Values
manualrule
rule_idstring (uuid) | nullrequiredRule that set the row; null for the manual onereasonstring | nullrequiredexpires_atstring (date-time) | nullrequiredISO 8601, UTC; null — no expirycreated_byActorrequiredcreated_atstring (date-time)requiredMoment the row was set, ISO 8601, UTC
BalanceChange
object
change — the sum of the operation's entries for
the kind (signed; a redemption and an accrual of one kind make one element), balance — the balance after; decimal as a string with exactly the kind's scale, unit — as in
CustomerBalance. A kind with corrupted settings (a void goes through for it as well) — in canonical form, unit: null.account_kindstringrequiredchangestringrequired- Example
-3000
balancestringrequired- Example
2000
unitobject | nullrequiredAsunitinCustomerBalance— one unit form per language, not inflected by numberKey values: string
AssetChange
object
registered — registration (status_from: null) or re-linking of an ownerless asset, transitioned — a transition of the customer's asset, reverted — undone on void; customer_id — the owner after the changeidstring (uuid)requiredtypestringrequiredAsset type codeserialstringrequiredSerial number as recordedeventstringrequired- Values
registeredtransitionedreverted
status_fromstring | nullrequiredstatus_tostringrequiredcustomer_idstring (uuid) | nullrequired
RuleFired
object
set) or removed (removed).rulestringrequiredRule coderule_idstring (uuid)requiredRule ID — same assources[].rule_idof a customer labellabelstringrequiredLabel codeactionstringrequired- Values
setremoved
CustomerBalance
object
GET /v1/schema).account_kindstringrequiredAccount kind code (entity_types:account_kind)- Example
points
balancestringrequiredBalance — a decimal as a string with exactly the kind's number of decimal places (scale):"0"for a kind with no decimal places,"100.50"for a kind with two; can be negative (a minus allowed by the kind, or a reversal).- Example
100100.50-40.00
unitobject | nullrequiredUnit label for displaying the balance — a “language → text” object with any languages;null— not set. One form per language, as set on the account kind: plural forms by number (“1 point”, “5 points”) are not returned by the API — the forms are in the account kind settings, and only the admin panel uses them.- Example
{"ru":"балл","en":"pts"}
Key values: string