API · Customers
OTP codes
POST /verifications — sending a one-time code to a recipient: phone — the number as is (the region and
allowed countries come from the phone field settings in the customer schema) or customer_id — the phone from
the card; the channel (sms, whatsapp) and the purpose (purpose — a code from the organization's message
templates). Delivery goes through a queue, so a 201 response is always status: pending: a provider failure
shows as failed in GET /verifications/{id} (with failure_reason) or as OTP_PROVIDER_ERROR when
checking the code.
Limits are per recipient per channel, across all purposes: the pause before a resend — OTP_RESEND_TOO_SOON,
sends per rolling twenty-four hours — OTP_DAILY_LIMIT, both with details.retry_after (seconds) and the moment.
Organization setup errors (codes turned off, a channel without a driver, a purpose without a template) —
VALIDATION_FAILED under channel or purpose: no record is created and the limit is not spent. Ability
otp:send, Idempotency-Key is required; the project is not involved. The code itself never appears in API
responses.
POST /verifications/{id}/check with otp_code — 200 and status: verified (the organization's customer
with this phone is linked if there is exactly one and customer_id is empty). A wrong code —
OTP_INVALID_CODE with details.attempts_left, expired — OTP_EXPIRED, attempts used up —
OTP_ATTEMPTS_EXCEEDED (the correct code is no longer accepted), delivery failed — OTP_PROVIDER_ERROR (502,
details.reason); after these three a new send is needed. Ability otp:verify, without Idempotency-Key:
repeating the correct code on a verified check returns the same record.
Send a one-time code
POST/verifications
Issues a verification: generates a code, stores its hash and queues delivery.
Ability otp:send; the Idempotency-Key header is required (a repeat without a key sends a second SMS).
Body: channel — sms or whatsapp; purpose — the reason (snake_case), known to the organization
from its message templates (verification, check_code, … — the registry of purposes is the
templates); exactly one of phone (raw number: without + it is parsed in the default_region of
the field on the customer schema's phone slot and must fall within its regions; without such a
field only E.164 is accepted) and customer_id (the phone from the card's phone slot; a customer of
another organization or without a phone — VALIDATION_FAILED under customer_id); locale — the
requested message language (ISO 639-1, case-insensitive); without it, or without a template in it —
the organization's customer language, then the first available one. interaction_id must not be
sent — it is set by the interaction.
Order of checks — configuration before limits: OTP disabled or the channel has no driver →
VALIDATION_FAILED under channel; a purpose without a template on the channel → under purpose;
then limits on the “channel + addressee” pair across all purposes and statuses (including failed):
OTP_DAILY_LIMIT — sends within a rolling 24 hours are not fewer than daily_limit
(details.limit, details.retry_after — seconds until the send after which the limit allows one
again leaves the window, details.resets_at); OTP_RESEND_TOO_SOON — less than
resend_after_seconds has passed since the last send (details.retry_after, details.resend_at) —
the same code with retry_after: 1 if another request to this addressee is still running. A refusal
creates no row.
Response 201 — Verification: status is always pending (delivery has not happened yet),
addressee — the normalized E.164 number, expires_at — until when the check accepts the code,
resend_after — from when the next code can be sent to the same addressee. The code itself is not
returned in the response.
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
VerificationInput
POST /verifications; exactly one of phone and customer_id — do not send the other,
or send null or "" (treated as absent).channelstringrequired- Values
smswhatsapp
purposestringrequiredPurpose — a snake_case code known to the organization from its message templates- Constraints
maxLength: 64- Example
verification
phonestring | nullRaw number; without+— in the region of the phone field of the customer schema- Constraints
maxLength: 32- Example
+7 701 555 00 018 (701) 555-00-01
customer_idstring (uuid) | nullA customer of the organization; the phone is taken from theirphoneslotlocalestring | nullRequested message language, ISO 639-1;kk-KZgives VALIDATION_FAILED underlocale- Constraints
pattern: ^[A-Za-z]{2}$- Example
kk
Responses
201
Code issued, delivery queued
application/jsonobject
dataVerificationrequiredmetaMetarequired
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 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:channel(unknown channel, OTP disabled, the channel has no driver),purpose(not snake_case, no template on the channel),phone(cannot be parsed, outside the allowed countries, sent together withcustomer_id, neither sent — then alsocustomer_id),customer_id(not a UUID, not found in the organization, no phone),locale,interaction_id,Idempotency-Key; OTP_RESEND_TOO_SOON (details.retry_after,details.resend_at); OTP_DAILY_LIMIT (details.limit,details.retry_after,details.resets_at); 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
Verification status
GET/verifications/{id}
Verification by ID — the same Verification as in the POST response: the client checks status
before the code is entered (failed with failure_reason — offer a retry) and expires_at. Ability
otp:send; another organization's verification is indistinguishable from a nonexistent one —
NOT_FOUND. The code hash, attempt count and provider response are not returned.
Parameters
idstring (uuid)pathrequired
Responses
200
Verification
application/jsonobject
dataVerificationrequiredmetaMetarequired
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
Check a code
POST/verifications/{id}/check
Code entry. Ability otp:verify; no Idempotency-Key is needed — no entity is created, and repeating
the correct code on an already verified verification returns the same Verification without a write.
Another organization's verification is indistinguishable from a nonexistent one — NOT_FOUND.
Order: state first, then the code — the response does not reveal whether the code is correct while
there is nothing to check. failed → OTP_PROVIDER_ERROR (502: the code was not delivered,
details.reason — the provider's refusal text or a generic reason); expired or just expired →
OTP_EXPIRED (details.expired_at; the row immediately becomes expired); attempts exhausted →
OTP_ATTEMPTS_EXCEEDED (details.attempts) — the correct code is no longer accepted; then the
comparison: a wrong code (including one that is not 4–8 digits) → OTP_INVALID_CODE, the attempt
counts, details.attempts_left — how many more wrong entries are allowed (0 — that was the last
one); correct → 200, status: verified, verified_at. On an already verified one, a wrong code
gives OTP_INVALID_CODE without counting an attempt. After OTP_PROVIDER_ERROR, OTP_EXPIRED and
OTP_ATTEMPTS_EXCEEDED a new send is needed (POST /verifications).
Customer binding: if customer_id is empty and the organization has exactly one customer with this
phone, that customer is set in customer_id; with several or none it stays null.
Parameters
idstring (uuid)pathrequired
Request body
application/json
VerificationCheckInput
POST /verifications/{id}/checkotp_codestringrequiredThe code from the message — as a string, not a number: leading zeros matter (0042≠42); a JSON number and an empty string give VALIDATION_FAILED; leading and trailing spaces are dropped. A non-empty string that is not 4–8 digits is a regular wrong code (OTP_INVALID_CODE, the attempt counts).- Constraints
minLength: 1maxLength: 16- Example
0427
Responses
200
Code is correct — the verification is confirmed (or was already confirmed with this code)
application/jsonobject
dataVerificationrequiredmetaMetarequired
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.fields.otp_code(missing, empty, not a string, longer than 16); OTP_INVALID_CODE (details.verification_id,details.attempts_left); OTP_EXPIRED (details.verification_id,details.expired_at); OTP_ATTEMPTS_EXCEEDED (details.verification_id,details.attempts).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
502
OTP_PROVIDER_ERROR — the code was not delivered (the provider refused or was unavailable on all attempts, or the code expired while delivery was queued):
details.verification_id,details.provider(driver code ornull),details.reason— the provider's refusal text, “Expired before delivery” (the provider was not called) or the generic “Delivery failed”. A new send is required.
Schemas
Verification
object
resend_after — from when the next code
can be sent to the same addressee (created_at plus the organization's resend pause at the time of the response;
the pause counts from the last send to the addressee for any purpose, so in a GET some time later
the value may be out of date — POST answers with an exact OTP_RESEND_TOO_SOON).idstring (uuid)requiredThe same ID is sent in the code check and when linking to an interactionpurposestringrequiredchannelstringrequired- Values
smswhatsapp
addresseestringrequiredNormalized E.164 number — in full, as sent to the provider- Example
+77015550001
localestring | nullrequiredThe requested language (not the actual message language after fallback)- Constraints
pattern: ^[a-z]{2}$
statusVerificationStatusrequiredexpires_atstring (date-time)requiredUntil when the code is accepted, ISO 8601, UTCresend_afterstring (date-time)requiredcustomer_idstring (uuid) | nullrequiredThe customer, ifcustomer_idwas sent (or found by phone during the check, or the customer of the interaction the verification is linked to)interaction_idstring (uuid) | nullrequiredThe interaction after linkingcreated_atstring (date-time)requiredverified_atstring (date-time) | nullrequiredfailure_reasonstring | nullrequiredOnly forfailed: the provider's refusal reason or “Expired before delivery” (the code expired before the delivery job reached the provider); configuration reasons are reported generically as “Delivery failed”.
VerificationStatus
string
pending — the code
is issued and awaits input (delivery may not have happened yet); verified — confirmed;
expired — the code has expired; failed — the provider did not send it (see failure_reason).- Values
pendingverifiedexpiredfailed
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