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

  • entitystringpathrequired

    customer, agent, interaction:<interaction type code>, catalog:<catalog code> or asset:<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 with details.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/json

    object

  • 401

    UNAUTHENTICATED — the Bearer token is missing or invalid

    Error format and codes

  • 403

    FORBIDDEN — the token lacks an ability (details.ability) or a project (details.project)

    Error format and codes

  • 404

    NOT_FOUND — resource or route not found

    Error format and codes

  • 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 headers X-RateLimit-Limit and Retry-After.

    Headers

    • Retry-Afterinteger

      Seconds until the window resets
    • X-RateLimit-Limitinteger

    • X-RateLimit-Remaininginteger

    Error format and codes

Schemas

SchemaDescription

object

  • entitystringrequired

    As in the path — customer, agent, interaction:<code>, catalog:<code>, asset:<code>
  • fieldsarray<FieldDefinition>required

    In display order; only active ones visible to the API
  • slotsarray<SlotDescription>required

    Entity slots (all for customer, national_id and phone for agent, empty for the rest)
  • typesarray<EntityTypeRef>required

    Active customer_type types for customer, agent_role roles for agent; empty for other entities

FieldDefinition

object

  • codestringrequired

    Field key in the request body and in attributes
    Constraints
    pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$maxLength: 64
  • typeFieldTyperequired

  • labelLocalizedTextrequired

  • requiredbooleanrequired

    The field is required on creation; on an edit null does not clear it
  • piibooleanrequired

    Personal data — the API client does not log it and masks it on display
  • rulesobjectrequired

    Constraints by type: string/text — min_length, max_length, pattern (a regular expression without delimiters, string only); integer/decimal — min, max (a string for decimal) and scale (digits after the point); date — min, max (Y-m-d or today); datetime — min, max (RFC 3339 or now); 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>required

    Options of enum/multi_enum; empty for other types
  • slotSlot | nullrequired

    Customer slot the value goes to; null — a regular attribute

FieldType

string

Schema field type (closed list)
Values
stringtextintegerdecimalbooleandatedatetimeenummulti_enumphoneemailreference

LocalizedText

object

Label by platform language (ru, en); at least one language is non-empty
Example
{"ru":"Телефон","en":"Phone"}

Key values: string

FieldOption

object

  • valuestringrequired

    The value passed in the body and stored
    Constraints
    maxLength: 64
  • labelLocalizedTextrequired

Slot

string

Semantic customer slot — a field whose meaning the CRM knows (phone for OTP, national ID for deduplication).
Values
phoneemailnational_idbirth_dategenderregionlocalefull_name

SlotDescription

object

  • codeSlotrequired

  • typesarray<FieldType>required

    Field types that can be bound to the slot
  • fieldstring | nullrequired

    Code of the bound field; null — the slot is free or its field is hidden from the API

EntityTypeRef

object

  • codestringrequired

    Constraints
    pattern: ^[a-z][a-z0-9]*(_[a-z0-9]+)*$
  • labelLocalizedTextrequired

Meta

object

Service data of the response; for lists it contains cursor
  • cursorobject

    Fields
    • nextstring | nullrequired

      Cursor 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's customer_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 same Idempotency-Key returns the response stored by the first execution as is.
  • idempotent_replayboolean

    Only on a retry: the response is taken from the idempotency store, data is byte-for-byte the same as in the first response; or a retry by the interaction's natural key external_id — data is 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
  • versioninteger

    Only 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 is changes?since=<version>.
    Constraints
    minimum: 0
  • recordedinteger

    Only 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

Effects of the operation: what rules and accounts did in its transaction. On a retry by 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>required

    Labels the customer gained in the operation
  • labels_removedarray<string>required

    Codes of labels the customer lost in the operation
  • balancesarray<BalanceChange>required

    Balance changes of the operation by account kind
  • assetsarray<AssetChange>required

    Asset changes of the operation
  • rules_firedarray<RuleFired>required

    Changes to label rows made by rules, in order of application
  • labelsarray<CustomerLabel>required

    The customer's active labels after the operation
  • current_balancesarray<CustomerBalance>required

    The customer's current balances after the operation — like balances of the customer card: one element for each active account kind, zero without entries

CustomerLabel

object

Active customer label — one item per code; expired labels are not in the response. A label can have two rows — manual and rule; the label is active while at least one of them is. The top-level fields come from the manual row if there is one, otherwise from the rule row; sources — each active row.
  • codestringrequired

    Label type code (lower case)
  • kindstringrequired

    Kind from the type settings — blocking operations, a group, a flag
    Values
    blocksegmentflag
  • reasonstring | nullrequired

  • expires_atstring (date-time) | nullrequired

    ISO 8601, UTC; null — no expiry
  • sourcestringrequired

    Set manually or by a rule
    Values
    manualrule
  • created_byActorrequired

  • created_atstring (date-time)required

    Moment the label was set, ISO 8601, UTC
  • sourcesarray<CustomerLabelSource>required

    Active label rows by source — the manual one first

Actor

object

Who performed the operation — an API client, an admin panel user or the system
  • kindstringrequired

    Values
    api_clientusersystem
  • idstring | nullrequired

    ID of the API client (UUID) or user; null for system

CustomerLabelSource

object

Label row of one source: a person sets and removes the manual row, only the rule sets and removes the rule row (it cannot be removed via DELETE …/labels/{code}).
  • sourcestringrequired

    Values
    manualrule
  • rule_idstring (uuid) | nullrequired

    Rule that set the row; null for the manual one
  • reasonstring | nullrequired

  • expires_atstring (date-time) | nullrequired

    ISO 8601, UTC; null — no expiry
  • created_byActorrequired

  • created_atstring (date-time)required

    Moment the row was set, ISO 8601, UTC

BalanceChange

object

A change of the customer's balance of one account kind in the operation: 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_kindstringrequired

  • changestringrequired

    Example
    -3000
  • balancestringrequired

    Example
    2000
  • unitobject | nullrequired

    As unit in CustomerBalance — one unit form per language, not inflected by number

    Key values: string

AssetChange

object

An asset change made by an interaction operation: 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 change
  • idstring (uuid)required

  • typestringrequired

    Asset type code
  • serialstringrequired

    Serial number as recorded
  • eventstringrequired

    Values
    registeredtransitionedreverted
  • status_fromstring | nullrequired

  • status_tostringrequired

  • customer_idstring (uuid) | nullrequired

RuleFired

object

A rule that fired: the rule's label row was set (set) or removed (removed).
  • rulestringrequired

    Rule code
  • rule_idstring (uuid)required

    Rule ID — same as sources[].rule_id of a customer label
  • labelstringrequired

    Label code
  • actionstringrequired

    Values
    setremoved

CustomerBalance

object

Customer balance by account kind. There is no kind label — as with the card's labels and consents, kind labels are in the schema (GET /v1/schema).
  • account_kindstringrequired

    Account kind code (entity_types:account_kind)
    Example
    points
  • balancestringrequired

    Balance — 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 | nullrequired

    Unit 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