API · Interactions and accounting
Assets
Customer assets (a device, a card and other organization types): registration, update, status transitions.
Customer's assets
GET/customers/{id}/assets
A page of assets whose current owner is the customer, newest first (updated_at descending, ties by
id); cursor pagination: pass meta.cursor.next as the cursor parameter with the same type and
status until it becomes null. Ability assets:read; an asset has no project. An asset changed while
paging moves to the top of the list. Assets of disabled types and of types with broken settings are not
returned. The list for a trade-in — status=owned. The customer is not in the organization —
NOT_FOUND. type, status — codes (an unknown type or status gives an empty list, a malformed format
is an error). Errors — VALIDATION_FAILED with details.fields.<parameter>, before the customer check:
first the request shape (a parameter outside the list — “Unknown parameter”), then the values, all at
once (type, status, limit range, cursor).
Parameters
idstring (uuid)pathrequiredtypestringquerystatusstringquerylimitintegerqueryList page size, 1…200; 50 when omitted- Default
50- Constraints
minimum: 1maximum: 200
cursorstringqueryOpaque cursor frommeta.cursor.nextof the previous page; valid only with the same filters — otherwiseVALIDATION_FAILEDundercursor. Without the parameter — the first page.- Constraints
maxLength: 512
Responses
200
Page of assets
application/jsonAssetList
Asset list —dataandmeta.cursordataarray<Asset>requiredmetaobjectrequiredService data of the response; for lists it containscursorFields
cursorobjectrequiredFields
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
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
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
Find an asset by serial number
GET/assets
Searches for an asset by type and serial number: the serial number is normalized by the type's rule
(surrounding spaces trimmed, case per the serial setting), and the asset is looked up by the
uniqueness key “type, normalized serial number” — data holds 0 or 1 element, meta.cursor.next is
always null. Ability assets:read. Finds both an asset without an owner and an asset of a disabled
type. An unknown type gives an empty list; a malformed type code or serial number (empty, longer than
128, control characters) — VALIDATION_FAILED under type / serial.
Parameters
typestringqueryrequiredserialstringqueryrequired
Responses
200
The asset found, or an empty list
application/jsonAssetList
Asset list —dataandmeta.cursordataarray<Asset>requiredmetaobjectrequiredService data of the response; for lists it containscursorFields
cursorobjectrequiredFields
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
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
Register an asset to a customer
POST/assets
Registers an asset — a device bought before the CRM, or one handed over outside an interaction.
Ability assets:write; the Idempotency-Key header is required: a repeat with the same key and body
returns the saved response and meta.idempotent_replay: true, no second asset is created.
type — code of an active asset type; serial — serial number (unique within the type in normalized
form); customer_id — the owner, an active customer; item — model code in the type's catalog
(catalog), a disabled item is allowed; status — any status of the type (default initial: the
transition table describes status changes, not the initial state); attributes — fields of the
asset:<type> schema visible to the API; reason — the reason (up to 1000 characters).
A serial number of an asset without an owner (after a void or owner removal) means re-linking:
the same asset gets the owner, status, model (if sent) and attributes; fields not visible to the API
keep their values, and the previous values are kept in revisions. A serial number of an asset with an
owner — CONFLICT with details.reason: serial_taken and details.existing_id.
Order of refusals: body shape — type (unknown, disabled — under type) — all value errors at once
(serial, status, item, attributes.<code>, reason) — owner (not in the organization or not
active — under customer_id) — serial number taken. The 201 response is the asset (Asset) both on
registration and on re-linking.
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
Request body
application/json
AssetInput
typestringrequiredCode of an active asset typeserialstringrequiredSerial number; leading and trailing spaces are removed, normalized by the type's rule, up to 128 characterscustomer_idstring (uuid)requiredOwner — an active customeritemstring | nullModel code — an item of the type's catalog (catalog)statusstring | nullType status; defaults toinitialattributesobject | nullFields of theasset:<type>schema visible to the APIreasonstring | null- Constraints
maxLength: 1000
Responses
201
Asset registered (or re-linked)
401
UNAUTHENTICATED — the Bearer token is missing or invalid
403
FORBIDDEN — the token lacks an ability (
details.ability) or a project (details.project)409
CONFLICT — the serial number is taken by an asset with an owner (
details.reason: serial_taken,details.existing_id); IDEMPOTENCY_IN_PROGRESS — a request with this key is still running (details.key).422
VALIDATION_FAILED —
details.fields:type,serial,customer_id,item,status,attributes.<code>,reason,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
Asset with history
GET/assets/{id}
An asset with its history of statuses and owners (history, by event number). Ability
assets:read; an asset has no project — both an asset without an owner and an asset of a disabled type
are visible. An event linked to an interaction is returned only if the interaction is in projects
assigned to the API client (as with interaction entries). include=revisions — attribute revisions
(PATCH edits and re-linking): paths of fields hidden from the API are cut out, a revision without
visible paths comes with diff: {}. The asset is not in the organization — NOT_FOUND.
Parameters
idstring (uuid)pathrequiredincludestringqueryComma-separated extensions —revisions; an unknown block —VALIDATION_FAILEDunderinclude- Example
revisions
Responses
200
Asset with history
application/jsonobject
dataAssetDetailsrequiredmetaMetarequired
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
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
Edit asset attributes
PATCH/assets/{id}
Edits asset attributes: only the fields of the asset:<type> schema that are sent and visible to the
API; null clears an optional field. Ability assets:write, no Idempotency-Key: repeating the same
body changes nothing. An edit is not a history event but a revision (include=revisions on GET); an
empty edit (the same values) writes nothing. The model, serial number, status and owner are not changed
here: any key other than attributes — VALIDATION_FAILED under its own name.
Refusals: the asset does not exist — NOT_FOUND; the type is disabled, or the owner has status
archived or merged (their assets are read-only) — VALIDATION_FAILED under asset; values — under
attributes.<code>; the owner changed during the operation — CONFLICT with
details.reason: owner_changed (repeat the request). The response is the asset after the edit.
Parameters
idstring (uuid)pathrequired
Request body
application/json
AssetPatch
attributesobjectrequiredOnly the type's schema fields being changed, under their codes;nullclears an optional field
No other keys
Responses
200
Asset after the edit
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
409
CONFLICT — the owner changed during the operation (
details.reason: owner_changed,details.asset_id)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
Change an asset's status and/or owner
POST/assets/{id}/transitions
Manual change of status and/or owner. Ability assets:write, the Idempotency-Key header is required.
At least one of status and customer_id is needed (otherwise VALIDATION_FAILED under status).
status — a transition by the type's transition table with no exceptions (a transition to the same
status is also refused); customer_id — the new owner, an active customer; null removes the owner; no
key leaves the owner unchanged; an empty string — VALIDATION_FAILED under customer_id, not “remove”.
The body is a JSON object (otherwise VALIDATION_FAILED under body); query parameters do not replace
body fields. Both at once give two history events (transitioned with the previous owner, then
owner_changed) in one operation. expected_status — the status the operator saw: if it differs from
the current one — CONFLICT.
Order of refusals: body shape — the asset does not exist (NOT_FOUND) — the type is disabled (under
asset) — values, all at once (status, expected_status, reason) — the new owner is missing or not
active (under customer_id) — the current owner is not active (under asset) — expected_status
(CONFLICT, details.reason: status_mismatch, details.expected, details.actual) — the transition is
not allowed (VALIDATION_FAILED under status, details.reason: transition_not_allowed,
details.from, details.to). Nothing changed (the same owner) — 200 without a write. The response is
the asset after the operation.
Parameters
idstring (uuid)pathrequiredIdempotency-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
Request body
application/json
AssetTransitionInput
status and customer_id is requiredstatusstring | nullNew status — according to the type's transition tablecustomer_idstring (uuid) | nullNew owner;null— remove the owner; no key — the owner does not changeexpected_statusstring | nullThe status the operator saw; on a mismatch —CONFLICTreasonstring | null- Constraints
maxLength: 1000
Responses
200
Asset after the operation
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
409
CONFLICT —
expected_statusdoes not match (details.reason: status_mismatch,details.expected,details.actual) or the owner changed during the operation (details.reason: owner_changed,details.asset_id); IDEMPOTENCY_IN_PROGRESS — a request with this key is still running (details.key).422
VALIDATION_FAILED —
details.fields:body,status,customer_id,expected_status,reason,asset,Idempotency-Key; for a disallowed transition alsodetails.reason: transition_not_allowed,details.from,details.to; 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
Schemas
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
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
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
AssetDetails
object
GET /assets/{id}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, UTChistoryarray<AssetEvent>requiredrevisionsarray<AssetRevision>Only withinclude=revisions
AssetEvent
object
registered — registration (with status_from — re-linking an asset that has no owner),
transitioned — a transition, owner_changed — an owner change, reverted — cancellation of an event when the
interaction is voided (reverts_event_id).idstring (uuid)requirednumberintegerrequiredEvent number for the asset — history order- Constraints
minimum: 1
kindstringrequired- Values
registeredtransitionedowner_changedreverted
status_fromstring | nullrequiredStatus before the event; null for the first registrationstatus_tostringrequiredowner_from_idstring (uuid) | nullrequiredowner_to_idstring (uuid) | nullrequiredinteraction_idstring (uuid) | nullrequiredInteraction that changed the assetreverts_event_idstring (uuid) | nullrequiredreasonstring | nullrequiredcreated_byActorrequiredcreated_atstring (date-time)requiredISO 8601, UTC
AssetRevision
object
PATCH edit or a replacement on re-linkingnumberintegerrequired- Constraints
minimum: 1
diffobjectrequiredChanged pathsattributes.<code>→{old, new}; paths of fields hidden from the API are cut out (the result can be{})Key values
oldany valuerequirednewany valuerequired
created_byActorrequiredcreated_atstring (date-time)required