API · Customers
Consents
GET /consents/texts?locale= — the current texts of all active consent types in the customer's language. A
version is a legal edition of the type's text; the current one is the latest whose date has come. The text is
in the requested language, otherwise in the organization's customer language (customer_locale, without it —
default_locale), otherwise the first available; locale in the response is the actual one. The app sends
type and version from the response when recording consent.
POST /customers/{id}/consents — a “given” batch, POST /customers/{id}/consents/revoke — a “revoked”
batch. An item is the type, the text version (without it — the current one on the local date of the fact in
the organization's time zone; for a revocation — the version of the last record), the channel (app,
office, paper… — the organization's codes), the agent's external id, a signature attachment, the moment of
the fact occurred_at (RFC 3339 with a zone, by the device clock: an offline queue brings yesterday's
signatures; without it — the moment of the request). The customer's state for a type is the last record by
occurred_at, always in Customer.consents. Both operations are under Idempotency-Key; inside, the fact
has a natural key (type + version + status + occurred_at): repeating the same form with a new key creates no
records, meta.recorded shows how many were inserted.
Record a batch of “given” consents
POST/customers/{id}/consents
A batch of “the customer gave consent” facts in one call and one transaction: each item is a type
(entity_types:consent_type, existing; case-insensitive), a text version (GET /consents/texts;
without it — the current one on the local date of occurred_at in the organization's time zone,
and without that — on the local today; a type without an effective version is an error), a
channel, an agent, a signature attachment and the moment of the fact. Each type appears in a batch
once. The attachment is bound to the record (attachments.owner); one signature for several types
is allowed — the first record is the owner, the others refer to the same attachment_id; an
attachment of another record or interaction is an error. A repeat of the same fact (same type,
version, status and occurred_at) does not create a row — idempotent without Idempotency-Key; a
repeat with a different attachment is an error: the record is immutable, and a signature must not
silently disappear.
Each new record that changes the state of a type is a consents.<type> history row. The response is the
customer card with the state per type and meta.recorded (how many rows were inserted). Ability
consents:write; the project plays no part.
Parameters
Idempotency-KeystringheaderrequiredIdempotency key: unique within the client, lives for 24 hours. A repeat with the same key and request returns the saved response withmeta.idempotent_replay: true; a different request with the same key getsIDEMPOTENCY_MISMATCH. A UUID is recommended.- Constraints
minLength: 1maxLength: 255
idstring (uuid)pathrequired
Request body
application/json
ConsentsInput
consentsarray<ConsentInput>requiredBatch items; each type at most once- Constraints
minItems: 1maxItems: 100
sourcestring | nullHow the fact reached the CRM — a code in snake_case;apiwhen omitted- Constraints
maxLength: 64- Example
api
Responses
200
Customer card with the consent state;
meta.recorded— rows inserted401
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
409
IDEMPOTENCY_IN_PROGRESS — a request with this key is still running (
details.key); CONFLICT — the customer is merged into another:details.customer_id,details.merged_into— the primary422
VALIDATION_FAILED —
details.fields:consents(empty or more than 100),consents.<i>.type(unknown type, duplicate in the batch),consents.<i>.version(no such version; no version effective on the local date of the fact),consents.<i>.channel,consents.<i>.agent_ref,consents.<i>.attachment_id(not in the organization or purged, already bound to another record, a repeat of the fact with a different attachment),consents.<i>.occurred_at(not RFC 3339 with a time zone, more than a minute in the future),consents.<i>.interaction_id(forbidden),source,Idempotency-Key; IDEMPOTENCY_MISMATCH — the key has already been used for a different request (details.key).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
Record a batch of “revoked” consents
POST/customers/{id}/consents/revoke
The same shape and rules as POST /customers/{id}/consents; the record status is revoked. A
version without a number is the version of the customer's last record of this type (the text being
revoked), or the current one if there were no records; a revocation without a preceding “given” is
allowed: an explicit refusal is a state too. The response is the card with revoked and the fact
date per type.
Parameters
Idempotency-KeystringheaderrequiredIdempotency key: unique within the client, lives for 24 hours. A repeat with the same key and request returns the saved response withmeta.idempotent_replay: true; a different request with the same key getsIDEMPOTENCY_MISMATCH. A UUID is recommended.- Constraints
minLength: 1maxLength: 255
idstring (uuid)pathrequired
Request body
application/json
ConsentsInput
consentsarray<ConsentInput>requiredBatch items; each type at most once- Constraints
minItems: 1maxItems: 100
sourcestring | nullHow the fact reached the CRM — a code in snake_case;apiwhen omitted- Constraints
maxLength: 64- Example
api
Responses
200
Customer card with the consent state;
meta.recorded— rows inserted401
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
409
IDEMPOTENCY_IN_PROGRESS — a request with this key is still running (
details.key); CONFLICT — the customer is merged into another:details.customer_id,details.merged_into— the primary422
VALIDATION_FAILED — as for
POST /customers/{id}/consents; IDEMPOTENCY_MISMATCH (details.key)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
Current consent texts in the customer's locale
GET/consents/texts
For each active consent type (entity_types:consent_type, by code) — the current text version:
the highest-numbered among versions whose effective_from date has arrived (a calendar date in the
organization's time zone — effective_from is the legal effective date; without a configured time
zone — UTC). The text is in the requested locale (locale, ISO 639-1, case-insensitive), otherwise
in the organization's default customer language (settings.customer_locale, without it —
default_locale), otherwise the first available; locale in the item is the language of the text
actually returned. A type without an effective version is present with version, effective_from,
locale and text = null. Without locale — the organization's customer language. Ability
consents:read; an organization setting, the project plays no part.
Parameters
localestringqueryCustomer language code, ISO 639-1 (ru,kk);kk-KZis VALIDATION_FAILED underlocale- Constraints
pattern: ^[A-Za-z]{2}$
- Example
kk
Responses
200
Texts by type
application/jsonobject
dataarray<ConsentText>requiredmetaMetarequired
401
UNAUTHENTICATED — the Bearer token is missing or invalid
403
FORBIDDEN — the token lacks an ability (
details.ability) or a project (details.project)422
VALIDATION_FAILED —
details.fieldswith errors by field429
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
ConsentInput
object
consents block at registration and in an
interaction (there occurred_at defaults to the interaction's started_at).
interaction_id is forbidden in the item — the server sets the link to the interaction.typestringrequiredConsent type code (entity_types:consent_type), case-insensitive- Constraints
maxLength: 64- Example
pdn
versioninteger | nullText version number fromGET /consents/texts. Without it: “given” — the current version on the local date ofoccurred_atin the organization's time zone (without that — on the local today), “revoked” — the version of the customer's last record of the type, otherwise the current one. A nonexistent number —VALIDATION_FAILED.- Constraints
minimum: 1- Example
1
channelstringrequiredWhere the customer expressed their will — an arbitrary channel code in snake_case (app,office,paper,web); the CRM does not interpret it- Constraints
maxLength: 64- Example
app
agent_refstring | nullExternal ID of the agent in whose presence consent was given (predates the agent registry); leading and trailing spaces are trimmed- Constraints
maxLength: 255- Example
AG-7
attachment_idstring (uuid) | nullSignature attachment (POST /attachments) in this organization, not yet linked or linked to a record of the same batch (one signature for several types). Linking removes the retention period.occurred_atstring (date-time) | nullMoment of the fact by the client's clock — strictly RFC 3339 with a time zone (Zor±hh:mm), no later than the request moment plus one minute (tolerance for the device clock); fractional seconds are dropped. Without it — the request moment. Part of the fact's natural key: a retry with the same value does not create a record.- Constraints
maxLength: 64
Customer
object
POST /customers, GET /customers/search
and GET /customers/{id}. attributes — every active schema field
visible to the API, under its code (not set — null); identities — all identities with
normalized values (slot types phone/email/national_id — only if the field of
that slot is visible to the API, custom types — always); labels — active labels; in responses
of customer operations they already include rule labels recalculated by this request.
consents — consent state by type (the latest record of each type; types without records
are absent); balances — one element for each active account kind of the organization (an account has no project — it is visible to everyone who can see the customer; a kind without entries shows zero; a disabled kind is not
returned); assets — assets whose current owner is the customer, in any status, newest first
(an asset has no project; assets of disabled types and of types with corrupted settings
are not returned — the latter until the settings are fixed on the “Entity types” page); history — only with
include=history.idstring (uuid)requiredtypestringrequiredCustomer type codestatusstringrequiredRecord lifecycle; blocks and segments are labels, not a status- Values
activearchivedmerged
sourcestringrequiredCode of the channel that created the record (api,admin,importor a custom one)attributesobjectrequiredidentitiesarray<CustomerIdentity>requiredlabelsarray<CustomerLabel>requiredActive labels, one element per code, in order of the code's first row; the top-level created_at is the moment of the manual row if there is one, so it can be later than that of the next labelconsentsarray<Consent>requiredThe latest record of each consent type, by type codebalancesarray<CustomerBalance>requiredBy active account kinds, in ascending order of the kind codeassetsarray<Asset>requiredcreated_atstring (date-time)requiredISO 8601, UTCupdated_atstring (date-time)requiredISO 8601, UTChistoryarray<CustomerHistoryEntry>Only withinclude=history; without it the key is absent
CustomerIdentity
object
id is for DELETE /customers/{id}/identities/{identity}.idstring (uuid)requiredtypestringrequiredIdentity type code (phone,email,national_idor a custom one)valuestringrequired
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
Consent
object
typestringrequiredConsent type codestatusstringrequired- Values
givenrevoked
versionintegerrequiredNumber of the text version the record refers to- Constraints
minimum: 1
channelstringrequiredagent_refstring | nullrequiredoccurred_atstring (date-time)requiredMoment of the fact by the client's clock, ISO 8601, UTCsourcestringrequiredHow the fact reached the CRM (api,admin,import, …)attachment_idstring (uuid) | nullrequiredSignature attachment; link —GET /attachments/{id}/urlinteraction_idstring (uuid) | nullrequiredInteraction in which it was submitted; null before itcreated_byActorrequiredcreated_atstring (date-time)requiredRecord moment, ISO 8601, UTC
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
Asset
object
assets, of lists and of asset write
responses. The status is a code without a label (status labels are in the asset type settings, as with balances and
labels). attributes — each active field of the asset:<type> schema visible to the API, under its code (not set
— null).idstring (uuid)requiredtypestringrequiredAsset type code (entity_types:asset_type)- Example
device
serialstringrequiredSerial number as sent (without leading and trailing spaces, NFC); unique within the type by its normalized formmodelobject | nullrequiredModel — an item of the type's catalog (catalog); null — no model specifiedFields
idstring (uuid)requiredcodestringrequiredItem code in the catalog
statusstringrequiredStatus code from the type settings- Example
owned
customer_idstring (uuid) | nullrequiredOwner; null — the asset has no owner (after the registering interaction is voided or the owner is removed)attributesobjectrequiredcreated_atstring (date-time)requiredISO 8601, UTCupdated_atstring (date-time)requiredMoment of the last change (status, owner, attributes), ISO 8601, UTC
CustomerHistoryEntry
object
field — the path (type, status, a slot code —
phone, national_id, …; attributes.<field code>; identities.<type> — the list of
normalized values of the type; labels.<code> — labels), old_value/new_value — before and after
(null — was not set / is no longer set). On creation — a row for each value set.fieldstringrequired- Example
phoneattributes.favorite_productidentities.qr_token
old_valueany valuerequirednew_valueany valuerequiredcreated_byActorrequiredcreated_atstring (date-time)requiredISO 8601, UTC
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
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
ConsentText
object
version — the legal edition number per type,
effective_from — the version date (Y-m-d), locale — the language of the returned text (after fallback),
text — plain text with line breaks. For a type without an effective version these four fields are null.typestringrequiredConsent type code; it andversionare sent in a consent record- Example
pdn
labelobjectrequiredType label by interface language:{"ru": …, "en": …}Key values: string
versioninteger | nullrequired- Constraints
minimum: 1
effective_fromstring (date) | nullrequiredlocalestring | nullrequired- Constraints
pattern: ^[a-z]{2}$
textstring | nullrequired