API · Customers
Attachments
Attachments are files: a signature, a photo, a document. POST /attachments uploads a file without an owner;
GET /attachments/{id}/url — a signed link to the content with a limited lifetime;
GET /attachments/{id}/content — the content itself via that link, without a token. The attachment id is
passed in consents and interactions; a file not linked to anything is deleted after a day.
Upload an attachment
POST/attachments
A file without an owner: a consent signature (signature), a photo (photo), a document
(document). The body is multipart/form-data with the kind and file fields. Size — at most
10 MiB; the type is detected from the file content, not from the extension or the client's header:
image/png, image/jpeg, image/webp, application/pdf are allowed. The response is the
attachment id for consents[].attachment_id and interaction attachments; an unbound file lives
for a day (expires_at) and is then deleted. The content is served by a signed link
(GET /attachments/{id}/url). Ability attachments:write; the Idempotency-Key header is
required, the fingerprint is the form fields and the file's sha256.
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
multipart/form-data
object
kindstringrequired- Values
signaturephotodocument
filestring (binary)requiredPNG, JPEG, WebP or PDF, up to 10 MiB
Responses
201
Attachment saved
application/jsonobject
dataAttachmentrequiredmetaMetarequired
401
UNAUTHENTICATED — the Bearer token is missing or invalid
403
FORBIDDEN — the token lacks an ability (
details.ability) or a project (details.project)409
IDEMPOTENCY_IN_PROGRESS — a request with this
Idempotency-Key(details.key) is still running; retry later to get the stored response.422
VALIDATION_FAILED —
details.fields.kind(kind outside the list),details.fields.file(no file, empty, over the limit, content type outside the list),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
Signed link to the attachment content
GET/attachments/{id}/url
A link to GET /attachments/{id}/content with a server signature and a lifetime (10 minutes,
expires_at); it opens without a token — the signature is the permission. A link is issued only
for an attachment of your own organization (someone else's id — NOT_FOUND). Ability
attachments:read — a link to any attachment by id; links to attachments of its own interactions
are also available with interactions:read — in Interaction.attachments.
Parameters
idstring (uuid)pathrequired
Responses
200
Link issued
application/jsonobject
dataobjectrequiredFields
urlstring (uri)requiredexpires_atstring (date-time)requiredThe moment after which the link returns 403, ISO 8601, UTC
metaMetarequired
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
Attachment content by a signed link
GET/attachments/{id}/contentNo token
The address from GET /attachments/{id}/url: the expires and signature parameters are required
and checked by the server; no Bearer token is needed. A modified or expired link — FORBIDDEN; a
purged attachment — NOT_FOUND. The rate limit is per IP. The response is the file as is,
Content-Type by content, Cache-Control: private, no-store.
Parameters
idstring (uuid)pathrequiredexpiresintegerqueryrequiredSignature expiry as Unix timesignaturestringqueryrequired
Responses
200
File content
Headers
Content-Dispositionstringinline; filename="<id>.<ext>"
image/pngstring (binary)
image/jpegstring (binary)
image/webpstring (binary)
application/pdfstring (binary)
403
FORBIDDEN — the signature does not match or the link has expired
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
Attachment
object
owner — a consent or an interaction after
linking; before linking it is null and expires_at applies. The storage key and hash are not returned.idstring (uuid)requiredkindstringrequired- Values
signaturephotodocument
mimestringrequiredType detected from the file contentsizeintegerrequiredBytesownerobject | nullrequiredFields
typestringrequired- Values
consentinteraction
idstring (uuid)required
expires_atstring (date-time) | nullrequiredWhen an unlinked file is deleted, ISO 8601, UTC; null after linkingcreated_atstring (date-time)required
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