API · Catalogs and rules
Catalogs
Organization catalogs (products, outlets and others): reading, changes since a version, item upload.
Organization catalogs
GET/catalogs
All of the organization's catalogs by code, including inactive ones (active: false): a client that
kept a copy learns about the deactivation. No pagination — an organization has dozens of catalogs
(meta.cursor.next is always null). Ability catalogs:read; a catalog is shared across the
organization, the project plays no part. The item field schema — GET /schema/catalog:<code>. Any
query parameter — VALIDATION_FAILED (“Unknown parameter”).
Responses
200
Catalogs
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
Catalog with categories
GET/catalogs/{code}
The catalog header and all its categories, including inactive ones, as a flat list: parents before
children (level by level from the roots, by code within a level), the parent given by its code. Category
codes in items and in the change feed match this list. For a catalog without has_categories the list is
empty. An inactive catalog can be read. Ability catalogs:read.
Parameters
codestringpathrequiredCatalog code (snake_case in Latin letters, up to 64 characters; converted to lower case). If the organization has no such catalog or the code fails the format —NOT_FOUNDwithdetails.codeas sent (first 64 characters).- Example
sku
Responses
200
Catalog
application/jsonobject
dataCatalogDetailsrequiredmetaMetarequired
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 — the organization has no catalog with this code, or the code does not match the format (
details.code— as in the path, the first 64 characters)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
Catalog items
GET/catalogs/{code}/items
Catalog items, including inactive ones, by code in database sort order, with a cursor
(meta.cursor.next). An inactive catalog can be read. Ability catalogs:read.
Syncing a copy: meta.version is the catalog version read before the rows of the first page; all
pages of one pass return the same value. After the pass the client requests
GET /catalogs/{code}/changes?since=<meta.version> — changes made during the pass arrive there
(possibly repeating state already received — apply them by code).
Filters (all combined with AND): active; category — the category and its descendants (an unknown
code gives an empty list); attributes[<code>]=<value> — equality on a field of the catalog:<code>
schema visible to the API: the value is converted to its stored form (decimal by scale, phone in
E.164, email in lower case, boolean — true/false/1/0, date — YYYY-MM-DD, datetime —
RFC 3339 with a time zone, reference — item code), for multi_enum — “contains the option”. Only the
type's format is checked, not the write rules (bounds, options, length, existence of the reference): no
such value gives an empty list. An unknown, inactive or API-hidden field, or an empty or malformed value —
VALIDATION_FAILED under attributes.<code>. category on a catalog without categories —
VALIDATION_FAILED. A catalog with the campaign role accepts project (the code of a project assigned
to the API client; any other gives an empty list) and at (RFC 3339 with a time zone: the campaign window
[starts_at, ends_at) covers the moment); on other catalogs — VALIDATION_FAILED.
All campaigns (role campaign) are visible; projects lists only the codes of projects assigned to the
API client (including deactivated ones); a campaign of other projects only comes with projects: [].
Parameters
codestringpathrequiredCatalog code (snake_case in Latin letters, up to 64 characters; converted to lower case). If the organization has no such catalog or the code fails the format —NOT_FOUNDwithdetails.codeas sent (first 64 characters).- Example
sku
activestringquerytrueor1— active only,falseor0— inactive only (case-insensitive); without the parameter — all- Example
true
categorystringqueryCategory code — items of the category and its descendantsattributesobjectqueryattributes[<field code>]=<value>— equality (formulti_enum— contains the option)Sent as keys: name[key]=value
Key values: string
- Example
{"brand":"acme"}
projectstringqueryCampaign catalog only — campaigns of the project (code)atstring (date-time)queryCampaign catalog only — campaigns running at this moment (RFC 3339 with a time zone)limitintegerqueryList 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 items
application/jsonobject
dataarray<CatalogItem>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
versionintegerrequiredOnly 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 — the organization has no catalog with this code, or the code does not match the format (
details.code— as in the path, the first 64 characters)422
VALIDATION_FAILED —
details.fields:active,category,attributes.<code>,project,at,limit,cursor(cursor from another request or corrupted), an unknown parameter — under its own name.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
Batch write of categories and items by code
PUT/catalogs/{code}/items
Upsert of catalog categories and items in a single version: a record with a new code is created, one
with an existing code is partially updated (a missing key leaves the field unchanged); there is no
deletion — use active: false. If nothing changed, the version stays the same and changed: false.
Ability catalogs:write (it does not grant reading). A catalog in import mode accepts the call: the API
is the channel of the accounting system; manual mode accepts it too (an organization without an
accounting system uploads the initial list). No Idempotency-Key: repeating the same body gives
unchanged and the same version. An inactive catalog — NOT_FOUND.
Category: code (required; up to 64 characters without whitespace, case-sensitive), label ({ru, en},
required on creation), parent (code, or null for a root), active. Requires has_categories.
Item: code (string or integer — a barcode), label (required on creation), attributes — fields of
the catalog:<code> schema visible to the API (GET /schema/catalog:<code>), merged field by field: null
removes a field, an empty string also becomes null; required schema fields are required on creation; a
field hidden from the API is “unknown”. components — [{code, qty}] of items of the same catalog
(replaced as a whole; a component exists, is active and is not a bundle itself; requires
has_components), category (code or null), active. A catalog with the campaign role also takes
starts_at, ends_at (RFC 3339 with a time zone) and projects (codes of the organization's active
projects — not only those assigned to the API client); they are required on creation.
At most 1000 categories and 1000 items per call; a duplicate code in the batch is an error. Order of
errors: body shape (a JSON object, lists, extra keys — body and field names) → catalog (NOT_FOUND) →
limit → record errors, which all arrive at once under body paths.
Parameters
codestringpathrequiredCatalog code (snake_case in Latin letters, up to 64 characters; converted to lower case). If the organization has no such catalog or the code fails the format —NOT_FOUNDwithdetails.codeas sent (first 64 characters).- Example
sku
Request body
application/json
CatalogUpsertInput
categoriesarray<object>- Constraints
maxItems: 1000
Items
codestring | integerrequiredlabelLocalizedTextparentstring | integer | nullactiveboolean
itemsarray<object>- Constraints
maxItems: 1000
Items
codestring | integerrequiredlabelLocalizedTextattributesobjectcomponentsarray<object>Items
codestring | integerrequiredqtyintegerrequired- Constraints
minimum: 1
categorystring | integer | nullactivebooleanstarts_atstring (date-time)ends_atstring (date-time)projectsarray<string>
No other keys
Responses
200
Batch result
application/jsonobject
dataCatalogUpsertResultrequiredmetaMetarequired
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 — the organization has no catalog with this code, or the code does not match the format (
details.code— as in the path, the first 64 characters)422
VALIDATION_FAILED —
details.fields:body(the body is not a JSON object: malformed JSON, anotherContent-Type, an empty body, a list),categories,items(not a list, more than 1000), any other body key — under its own name;categories.<i>.<field>,items.<i>.<field>,items.<i>.attributes.<code>,items.<i>.components.<j>.code,items.<i>.projects.<j>.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
Catalog changes since version N
GET/catalogs/{code}/changes
Rows of the catalog log with since < version <= meta.version in version order (within a version —
the catalog, categories, items), with a cursor. One operation (an upsert batch, an import, a header edit)
is one version, with a row per changed catalog, category or item. An inactive catalog can be read — the
row of its deactivation (subject: catalog, operation: deactivated) is visible. Ability
catalogs:read.
Syncing: meta.version is the catalog version read before the rows of the first page; all pages of
the pass return the same value and no rows newer than it. After the pass, the next sync uses
since=<meta.version>. A request with since equal to the current version returns an empty list and the
same version. since greater than the catalog version — VALIDATION_FAILED under since: the client's
copy comes from another database, and the catalog is reloaded in full (GET /catalogs/{code}/items).
diff — {"<path>": {"old", "new"}} for changed paths only; on creation — all non-empty ones with
old: null. Paths are the field names of API resources: for a catalog — label, active,
has_categories, has_components; for a category — label, active, parent (code); for an item —
label, active, category (code), components, attributes.<code> (a key of the attributes map;
API-visible fields only), for campaigns — starts_at, ends_at (UTC), projects (codes of projects
assigned to the API client; a path that then has old = new is not shown; empty — null). A row with
no visible paths comes with diff: {}. Apply a version as a whole (a category's parent may come after
the child), and a version may continue on the next page: accumulate rows until the version number
changes or cursor.next becomes null.
Parameters
codestringpathrequiredCatalog code (snake_case in Latin letters, up to 64 characters; converted to lower case). If the organization has no such catalog or the code fails the format —NOT_FOUNDwithdetails.codeas sent (first 64 characters).- Example
sku
sinceintegerqueryrequiredCatalog version the client is already synced to (0 — from the beginning)- Constraints
minimum: 0
limitintegerqueryList 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 changes
application/jsonobject
dataarray<CatalogChange>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
versionintegerrequiredOnly 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 — the organization has no catalog with this code, or the code does not match the format (
details.code— as in the path, the first 64 characters)422
VALIDATION_FAILED —
details.fields:since(missing, not an integer ≥ 0, greater than the catalog version),limit,cursor(from another request or corrupted), an unknown parameter — under its own name.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
Catalog
object
source — the mode: manual — edited in the admin panel, import — by a file
or by PUT /catalogs/{code}/items from an accounting system. version — a change counter: any change to
the catalog, its categories and items takes the next number; changes since version N —
GET /catalogs/{code}/changes?since=N.codestringrequired- Example
sku
labelLocalizedTextrequiredsourcestringrequired- Values
manualimport
roleCatalogRole | nullrequiredhas_categoriesbooleanrequiredhas_componentsbooleanrequiredItems can be bundles —componentsactivebooleanrequiredversionintegerrequired- Constraints
minimum: 0
LocalizedText
object
ru, en); at least one language is non-empty- Example
{"ru":"Телефон","en":"Phone"}
Key values: string
CatalogRole
string
- Values
campaignskuregion
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
CatalogDetails
object
source — the mode: manual — edited in the admin panel, import — by a file
or by PUT /catalogs/{code}/items from an accounting system. version — a change counter: any change to
the catalog, its categories and items takes the next number; changes since version N —
GET /catalogs/{code}/changes?since=N.codestringrequired- Example
sku
labelLocalizedTextrequiredsourcestringrequired- Values
manualimport
roleCatalogRole | nullrequiredhas_categoriesbooleanrequiredhas_componentsbooleanrequiredItems can be bundles —componentsactivebooleanrequiredversionintegerrequired- Constraints
minimum: 0
categoriesarray<CatalogCategory>requiredAll categories, parents before children
CatalogCategory
object
codestringrequiredCategory code — up to 64 non-whitespace characters, case-sensitive (ЦБ-000123)labelLocalizedTextrequiredparentstring | nullrequiredParent category code,null— rootactivebooleanrequired
CatalogItem
object
code (up to 64 non-whitespace characters, case-sensitive; a barcode goes
as a string). version — the catalog version at the item's last change. starts_at, ends_at,
projects — only in a catalog with the campaign role.codestringrequired- Example
device_a
labelLocalizedTextrequiredactivebooleanrequiredcategorystring | nullrequiredCategory code (GET /catalogs/{code}→categories)attributesobjectrequiredActive fields of thecatalog:<code>schema visible to the API, in schema order; not set —null(GET /schema/catalog:<code>)componentsarray<object>requiredBundle composition — codes of items of the same catalog; not a bundle —[]Items
codestringrequiredqtyintegerrequired- Constraints
minimum: 1
versionintegerrequired- Constraints
minimum: 1
starts_atstring (date-time) | nullCampaign — start of the window[starts_at, ends_at), UTC;null— the item has no campaign termsends_atstring (date-time) | nullCampaign — end of the window (exclusive), UTCprojectsarray<string>Campaign — codes of its projects among those assigned to the client, by code
CatalogUpsertResult
object
versionintegerrequiredCatalog version after the batch (the previous one if nothing changed)- Constraints
minimum: 0
changedbooleanrequiredcategoriesarray<CatalogUpsertOutcome>requiredOutcome per category in body orderitemsarray<CatalogUpsertOutcome>requiredOutcome per item in body order
CatalogUpsertOutcome
object
codestringrequiredoutcomestringrequired- Values
createdupdatedactivateddeactivatedunchanged
pathsarray<string>requiredDiff paths of the record (before and after the batch) in API resource names, as in the feed (active,attributes.<code>…), but without filtering by field and project visibility; empty forunchanged
CatalogChange
object
versionintegerrequired- Constraints
minimum: 1
subjectstringrequired- Values
catalogcategoryitem
codestringrequiredCode of the catalog, category or itemoperationstringrequired- Values
createdupdatedactivateddeactivated
diffobjectrequiredChanged paths as seen by the APIKey values
oldany valuerequirednewany valuerequired
atstring (date-time)required