Account Protection Guide
Account Protection Guide
Protect every account action. Down to the last point.
One API, three decisions, and verifications that Koin runs end to end. The perfect complement to your transactional antifraud solution: it extends protection beyond the payment, to every sensitive action on the account, with a native data model for loyalty and points programs.
The core integration, in two calls
POST /v1/ato/evaluations — Can this action continue?
PATCH /v1/ato/evaluations/{evaluation_id}/notifications — This is how it ended.
approved · received · denied
To act on the whole account (search, block, unblock), use Account Services: /v1/ato/accounts/…
To record situations on the account that don't need an evaluation (today: points that arrive from a bank or another loyalty program), use Account events: POST /v1/ato/accounts/USER_ID/events New
References
- Sandbox — api-sandbox.koin.com.br
- API Reference · Account Protection — Create Evaluation · Notifications
- API Reference · Transactional — Create Evaluation (Ecommerce)
- API Reference · Account Services
- For agents — llms.txt
New
Marks capabilities this guide documents before they are published in the API Reference. Field names may see minor adjustments; the model does not change.
1. The essentials
Whenever a user attempts something sensitive on their account, your backend asks Koin before executing it. Koin responds with one of three decisions:
| Decision | What it means | What you do |
|---|---|---|
approved | No risk signals | You continue without friction |
received | A verification is required | You show the strategy Koin indicates (token, liveness, 3DS…) |
denied | High risk or blocked account | You do not execute the action |
When the action ends, you tell Koin how it ended. That is all.
POST /v1/ato/evaluations → Can this action continue?
PATCH /v1/ato/evaluations/{evaluation_id}/notifications → This is how it ended.
Koin decides on its own. Its models, heuristics, and Koin's data network detect account takeover from day one, without you writing a single rule. If you want, you can customize the decision for your program (rules, lists, thresholds, and strategies per evaluation) from the dashboard or with the assistance of your account manager. Your integration does not change in either case.
One API, four families of endpoints
Account Protection is one product. It has several endpoints, grouped in families, and each family has its own reference. They all use the same key and the same user_id.
| Family | Endpoints | What it is for |
|---|---|---|
| Account evaluations | POST /v1/ato/evaluations · PATCH /v1/ato/evaluations/{evaluation_id}/notifications | Evaluate each sensitive account action and report how it ended. |
| Transactions | POST /v1/antifraud/evaluations | Points purchases and purchases with points. |
| Account Services | /v1/ato/accounts/… | Search accounts, block them, and revert the block. |
| Account events New | POST /v1/ato/accounts/USER_ID/events | Record situations on the account that don't need an evaluation: Koin gives no verdict, but enriches the member's profile and weighs them in future evaluations. |
2. Why Koin
| Koin | What is typical in the market | |
|---|---|---|
| Decides on its own, and can be customized | Koin delivers a ready decision from the first evaluation. Each customer can adjust it to their program without touching the integration. | A score the customer has to turn into their own rules before they can use it. |
| End-to-end verification | Koin sends the token, hosts the page, validates, and reports the final decision. You can also use your own verifications. | The provider returns a score or a recommendation; you build the verification. |
| Native loyalty | Monitors, natively, situations and data specific to the misuse and abuse of loyalty programs. | No provider publishes loyalty events. |
| Control of the whole account | Search, block, and unblock accounts, with your own reasons and a history for every action. One by one or in bulk. | Varies by provider. |
| Built for LatAm | Native CPF, CNPJ, DNI, CUIL, CI, and PASSPORT; WhatsApp as a channel; its own device SDK (JS, iOS, Android, Flutter). | Models designed for the US and Europe. |
| One identity across every endpoint | The same user_id links account evaluations, transactions, account actions, and partner credits: yesterday's suspicious login weighs on today's redemption. | Account evaluations and transactions live in separate products. |
| Open documentation | Public, readable by agents (llms.txt, every page as .md). | Many providers keep it behind a login. |
3. Quickstart: your first evaluation in 3 steps
Step 1 · Authentication
Every call uses your private key as a Bearer token. The Koin team delivers it during onboarding.
Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
Step 2 · Capture the device
Integrate the device fingerprint SDK (JavaScript, iOS, Android, Flutter). The SDK generates a session_id that you send on every evaluation.
Why it matters
The device is the number-one signal against account takeover. A successful login from a device that has never been seen, followed by an email change, is the classic pattern of a taken-over account.
Step 3 · Evaluate a login
curl -X POST https://api-sandbox.koin.com.br/v1/ato/evaluations \
-H "Authorization: Bearer $KOIN_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "LOGIN",
"details": {
"user_id": "company_8812345",
"email": "[email protected]",
"authentications": [ { "type": "PASSWORD", "validated": true } ],
"client_result": "SUCCESS"
},
"device": {
"ipv4": "187.61.115.149",
"session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12",
"merchant_device": "77370a68-b70e-4a71-a83e-222994416c12"
}
}'Response:
{
"id": "VEFRUD8HUR25N4992221",
"evaluation_id": "31ff2cc8-199e-4c3c-ba2d-4d85b88bd9f2",
"status": "approved",
"score": 12,
"analysis_type": "AUTOMATIC"
}Store the evaluation_id: you will use it to report the final result.
4. Key concepts
The whole model rests on eight ideas.
| Concept | In one line |
|---|---|
Evaluation (type) | The sensitive action you send to Koin so it can evaluate it and return a decision. |
Account event (type) New | A situation on the account that is only reported: Koin gives no verdict. It enriches the member's profile and weighs in future evaluations. |
Verification strategy (strategies[]) | The extra step Koin may require before letting the action proceed: token by email or WhatsApp, liveness, 3DS. Koin decides when to apply it; the customer can customize that criterion. |
Authentication context (authentication) | The context of a password change: with an active session or without a session. It distinguishes, for example, someone who forgot their password from someone who changes it while logged in. |
Forced change (forced) | A password change forced by your system, for example a mandatory reset from support or suspicious activity. Koin treats it as a distinct flow. |
Prior check by the customer (client_result) | The result of a validation your system already performed before calling Koin, for example whether the password was correct. It is an input. |
| Final result | How the business action ended: it completed or it did not. It is reported later, separately. |
Account status (blocked · risk_score) | Two things: whether it is blocked (by you or by Koin, always reversible), and its detected risk level: LOW, MEDIUM, or HIGH. It does not belong to a single evaluation. |
The prior check and the final result are not the same thing.
client_resulthappens before the evaluation ("the password was correct"). The final result happens when the whole flow ends ("the email change was completed").
5. How an evaluation works
Every evaluation follows the same path. Verification is conditional: it happens only if Koin responds received, and either Koin or your own system can orchestrate it.
sequenceDiagram
actor User
participant Backend as Customer backend
participant Koin
User->>Backend: Starts a sensitive action
Backend->>Koin: POST /v1/ato/evaluations
Koin-->>Backend: approved, received + strategy, or denied
opt received and Koin orchestrates the strategy
User->>Koin: Completes verification on Koin's page
Koin-->>Backend: Final decision approved or denied via callback_url
end
opt received and the customer orchestrates the strategy
User->>Backend: Completes the customer's verification
Backend->>Koin: PATCH with the strategy result
Koin-->>Backend: Final decision approved or denied via callback_url
end
Backend->>User: Executes or cancels the action
Backend->>Koin: PATCH with the final result of the action
Figure 1 · Evaluation lifecycle, with the strategy orchestrated by Koin or by the customer.
The callback carries the decision, not the strategy result.
When there is a verification, Koin combines its result with the rest of the signals and sends you, through
callback_url, the final decision of the evaluation:approvedordenied.
6. Decisions and strategies
The three decisions
status | Meaning | What your system does |
|---|---|---|
approved | The action may continue. | Completes the action. |
received | In progress: a verification is required. | Shows the strategy (link) or runs it with its own means, and waits for the final decision through callback_url. |
denied | Block. | Does not execute the action. If the account is blocked (by you or by Koin), all of its sensitive evaluations return denied. |
On account evaluations (
LOGIN,SIGN_UP,CHANGE_PASSWORD,CHANGE_PROFILE,CLOSE_ACCOUNT),receivedalways comes with a strategy the user resolves in the moment. It never leaves the user waiting for a manual review.
Available strategies
strategies[].type | What it validates | When it is typically used |
|---|---|---|
VerificationCode | 6-digit token by email or WhatsApp, or magic link. | Forgotten password, contact change, account closure. |
Liveness | Facial biometrics with a proof of life. | High risk: contact change after a suspicious login. |
CollectAuthRecovery | 3DS2 authentication (FRICTIONLESS or CHALLENGE). | Actions that involve a card. |
ManualVerification | Review by the risk team, held until the SLA. | High-value operations, never on login. |
Example response with a strategy:
{
"id": "12345678",
"evaluation_id": "1b943df8-e4fa-4a50-a254-67186911d66e",
"status": "received",
"score": 50,
"analysis_type": "AUTOMATIC",
"strategies": [
{
"type": "VerificationCode",
"link": "https://antifraud.koin.com.br/recovery/1b943df8-e4fa-4a50-a254-67186911d66e?language=en"
}
]
}Detail for each strategy: Strategies.
7. Evaluation catalog
A single endpoint, POST /v1/ato/evaluations, and the type field indicates the evaluation. Koin decides in each case whether a verification applies; the "Reference verification" column shows the usual behavior, which each customer can customize.
| Evaluation | When you send it | When you do not | Reference verification |
|---|---|---|---|
LOGIN | The user signs in. You report the result of your own credential check (client_result). | Do not send only successful logins: failed ones feed credential-stuffing detection — including attempts on an identifier that matches no account. New | According to the risk Koin detects. |
SIGN_UP | Account creation. Requires user_id, first_name, last_name, birth_date, email, and profile (category and points_balance). | — | According to the risk Koin detects. |
CHANGE_PASSWORD | Any password change or creation. The authentication field indicates the context, and forced marks forced changes. | — | Depends on the context: typically yes when the user has no session, no when they change it while logged in. |
CHANGE_PROFILE | A piece of data is added, updated, deleted, or confirmed: email, phone, account, card, personal data, category, or a beneficiary. | Passwords: use CHANGE_PASSWORD. Points balance: it is not reported here (see §11). | Token when phone and/or email changes; for the rest, according to the risk Koin detects. |
CLOSE_ACCOUNT | The user asks to close their account. | — | Token, always. |
The API Reference also includes USER_ACTIVATION, GENERAL_CHECKPOINT, and ENROLLMENT, for use cases outside the scope of this guide.
Points that arrive from outside your program are not an ATO evaluation.A credit from a bank or another loyalty program does not go through
POST /v1/ato/evaluations. Record it with the Account events endpoint: see §11.5.
Fields common to every evaluation
| Field | Required | Why it matters |
|---|---|---|
type | Yes | Defines the evaluation and the details schema. |
details.user_id | Yes, except a LOGIN with failure_reason: ACCOUNT_NOT_FOUND, where it is not sent New | The identity that links every account evaluation, in Account Protection and in the transactional API. Always use the same identifier. |
reference_id | Recommended | Your own identifier for the action (the id you give it in your system). It links the evaluations of the same commerce, and together with the evaluation type it identifies the case: see the note below. |
event_date | Recommended | Date and time of the action according to your system, as a local datetime without a timezone suffix. It is not the time the case was created. In CHANGE_PROFILE, Koin uses it to order the member's changes by when they happened; if you do not send it, Koin uses the time of the request. New |
initiator | Recommended | Who starts the action: USER (the end user) or SYSTEM (your system). A SYSTEM evaluation does not update the device in the user vault. |
channel | Optional | Channel through which the action happens, for example WEB. |
merchant | Optional | Brand inside your commerce, for example koin, hotels, or flights. |
device.session_id | Recommended | Generated by the device SDK. Without it, Koin loses the strongest signal against account takeover. |
device.ipv4 / device.ipv6 | Recommended (one of the two) | Geolocation, ASN, and detection of distributed attacks. |
device.merchant_device | Optional | Your own device identifier, so you can cross-check it with Koin's. |
device.user_agent | Recommended when the SDK did not load | User agent of the browser or the app. |
callback_url | Optional | HTTPS endpoint where you receive the final evaluation decision when there was a strategy. |
sla_date | Optional | How long the evaluation may stay open. |
reference_id: one action, one evaluation
reference_idis your own id for the action. A second ATO evaluation with the same commerce, the samereference_id, and the same evaluation type responds HTTP409and does not open another case. The samereference_idon a different evaluation type is a different evaluation.
Two names that look alike
merchantnames the brand inside your commerce.device.merchant_deviceis your own device identifier. They are two different fields and do not replace one another.
8. Recipes by evaluation
8.1 LOGIN
New · A sign-in can involve several steps. Report each one in authentications, as the first factor or as an additional factor. The overall outcome goes in client_result and, when it failed, the reason in failure_reason. What the user typed to sign in goes in identifier.
{
"type": "LOGIN",
"details": {
"user_id": "company_8812345",
"client_result": "SUCCESS",
"identifier": { "type": "PHONE", "phone": { "area_code": "11", "number": "987654321", "type": "MOBILE" } },
"authentications": [
{ "type": "PASSWORD", "validated": true },
{ "type": "OTP", "channel": "SMS", "phone": { "area_code": "11", "number": "987654321", "type": "MOBILE" }, "validated": false },
{ "type": "OTP", "channel": "WHATSAPP", "phone": { "area_code": "11", "number": "987654321", "type": "MOBILE" }, "validated": true }
]
},
"device": {
"ipv4": "187.61.115.149",
"session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12"
}
}Every step carries type and validated: whether the step was passed. The steps that reach the user through a contact channel also carry that channel and the data it was sent to:
Step type | Allowed channel | Contact data |
|---|---|---|
OTP | SMS · WHATSAPP · EMAIL · VOICE | phone for SMS, WHATSAPP and VOICE; email for EMAIL. |
MAGIC_LINK | SMS · WHATSAPP · EMAIL | phone for SMS and WHATSAPP; email for EMAIL. |
PASSWORD · SOCIAL_NETWORK · SINGLE_SIGN_ON · PASSKEY · BIOMETRICS · TOTP · PUSH · SECURITY_KEY | — | A step of one of these types that carries a channel or contact data is rejected with 400. |
A SOCIAL_NETWORK or SINGLE_SIGN_ON step may carry sso_type: the identity provider, for example GOOGLE, APPLE, or MICROSOFT.
The CAPTCHA is not a step: keep reporting it in captcha, as before. Security questions are not accepted as a step.
authentication_typeis deprecated
It still works exactly as it does today, but it is no longer documented: express the sign-in with
authentications. ALOGINwithout any of the new fields is processed exactly as before. Sendingauthentication_typeandauthenticationsin the same request responds400.
Migrating from authentication_type. New · The two values in use today become the first step of authentications, and a FAILED login carries the same step with validated: false.
PASSWORD:
{
"user_id": "company_8812345",
"client_result": "SUCCESS",
"authentications": [ { "type": "PASSWORD", "validated": true } ]
}SOCIAL becomes SOCIAL_NETWORK (sso_type is optional):
{
"user_id": "company_8812345",
"client_result": "SUCCESS",
"authentications": [ { "type": "SOCIAL_NETWORK", "sso_type": "GOOGLE", "validated": true } ]
}What the user typed. New · identifier is optional in any LOGIN: what the user typed to sign in, with a type and only the field of that type.
identifier.type | Field |
|---|---|
EMAIL | email (string) |
USERNAME | username (string) |
PHONE | phone (area_code, number, type) |
DOCUMENT | document (type, number, nationality) |
One example for each type:
{ "type": "EMAIL", "email": "[email protected]" }
{ "type": "USERNAME", "username": "typed_user" }
{ "type": "PHONE", "phone": { "area_code": "11", "number": "987654321", "type": "MOBILE" } }
{ "type": "DOCUMENT", "document": { "type": "DNI", "number": "11124837511", "nationality": "AR" } }An identifier without its type, without the field of its type, or with the field of another type responds 400. It is required when the login has no account (see below).
documentare deprecated inLOGIN
Use
identifierinstead.documentindetailsstill work during the transition, but they are no longer documented as the way to report what the user typed. If you send them together with anidentifierof the same type, the values must match (the email without distinguishing case, the document by its number); otherwise the request responds400.
Why the login failed. New · failure_reason and failure_reason_detail are only accepted with client_result: FAILED; with SUCCESS they respond 400. Values: ACCOUNT_NOT_FOUND · INVALID_PASSWORD · ACCOUNT_LOCKED · ACCOUNT_DISABLED · PASSWORD_EXPIRED · MFA_REQUIRED · MFA_FAILED · OTHER. failure_reason_detail is free text, up to 255 characters, without personal data. With OTHER it is required; with any other failure_reason it is optional, and you can send it to add context to the failure. Sending it without a failure_reason responds 400.
Login without an account
New · The most valuable attempt of an attack with leaked credentials is the one on an identifier that matches no account. Send it too: without user_id, with failure_reason: ACCOUNT_NOT_FOUND, and the identifier the user typed. Koin evaluates it like any other failed login.
{
"type": "LOGIN",
"details": {
"client_result": "FAILED",
"failure_reason": "ACCOUNT_NOT_FOUND",
"identifier": { "type": "EMAIL", "email": "[email protected]" }
},
"device": { "ipv4": "200.1.2.3" }
}A LOGIN without user_id is only accepted with failure_reason: ACCOUNT_NOT_FOUND. Any other combination — no user_id with another reason, or ACCOUNT_NOT_FOUND with a user_id — responds 400.
Two names that look alike
authentication, inCHANGE_PASSWORD(see §8.2), is the context of a password change: with a session or without one.authentications, inLOGIN, is the list of steps of a sign-in. They are two different fields.
8.2 CHANGE_PASSWORD: one evaluation for every password change
Every password change uses the same evaluation. The authentication field indicates the context it happens in —with a session or without one— and forced marks forced changes, for example a mandatory reset started by your system. That way, each flow gets the right treatment.
flowchart LR
A["I forgot my password<br/>(no session)"]
E["CHANGE_PASSWORD"]
B["Change from my profile<br/>(with session)"]
C["Forced reset<br/>(support or suspicious activity)"]
R{"Koin decision"}
A -->|"authentication: unauthenticated"| E
B -->|"authentication: authenticated"| E
C -->|"forced: true"| E
E --> R
classDef dark fill:#0E2419,color:#ffffff,stroke:#0E2419
class E dark
classDef decision fill:#E6F6EA,color:#0A7F25,stroke:#10B132
class R decision
Figure 2 · Password change: 2 contexts and the forced change, 1 evaluation.
authentication | Use case | Reference verification |
|---|---|---|
unauthenticated | I forgot my password. The user, without a session, starts the process. The previous password stays valid until it finishes. | Yes (for example, a token). |
authenticated | Change from the profile. The user, with an active session, changes their password. | Typically no. |
The field accepts only these two values (case insensitive). If you omit it, the evaluation is still processed, but Koin loses the context. forced is optional: if you don't send it, it is false; a non-boolean value is rejected with 400.
| Field | Location | Values | Default |
|---|---|---|---|
authentication | details | authenticated (with session) / unauthenticated (no session) | Optional, no value. |
forced | details | true / false | false if you don't send it. |
initiator | root | USER / SYSTEM | Optional, no value. |
A forced reset —the system resets the password (support or suspicious activity) and the user changes it afterwards— is marked with forced: true, typically together with initiator: SYSTEM. It is verified according to the risk Koin detects.
A regular change, started by the user:
{
"type": "CHANGE_PASSWORD",
"initiator": "USER",
"details": {
"user_id": "company_8812345",
"email": "[email protected]",
"authentication": "unauthenticated",
"forced": false,
"client_result": "SUCCESS"
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}A mandatory reset, started by the system:
{
"type": "CHANGE_PASSWORD",
"initiator": "SYSTEM",
"details": {
"user_id": "company_8812345",
"email": "[email protected]",
"authentication": "unauthenticated",
"forced": true,
"client_result": "SUCCESS"
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}8.3 CHANGE_PROFILE: operation × data
CHANGE_PROFILE combines an operation (type) with the data it operates on (field), and carries the previous value and the new one when that applies. Passwords do not go here: they have their own evaluation, CHANGE_PASSWORD.
field ↓ / type → | ADD | UPDATE | DELETE | CONFIRM |
|---|---|---|---|---|
EMAIL | ✓ | ✓ | ✓ | ✓ |
PHONE | ✓ | ✓ | ✓ | ✓ |
ACCOUNT | ✓ | ✓ | ||
CARD | ✓ | ✓ | ||
PERSONAL_INFO | ✓ | |||
CATEGORY | ✓ | |||
BENEFICIARY | ✓ | ✓ | ✓ |
Phone or email change: Koin asks for a token to confirm the change.
{
"type": "CHANGE_PROFILE",
"details": {
"user_id": "company_8812345",
"type": "UPDATE",
"field": "PHONE",
"old_phone": { "area_code": "11", "number": "987654321", "type": "MOBILE" },
"new_phone": { "area_code": "21", "number": "912345678", "type": "MOBILE" },
"client_result": "SUCCESS"
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}Confirming an email or a phone. New · When your system confirms an email or a phone, send a CHANGE_PROFILE with type: CONFIRM and client_result: SUCCESS, and tell Koin how you validated it with the validation object: the type of validation and the channel the code or the link was sent through. Koin records the data as validated by you.
{
"type": "CHANGE_PROFILE",
"details": {
"user_id": "company_8812345",
"type": "CONFIRM",
"field": "PHONE",
"phone": { "area_code": "11", "number": "987654321", "type": "MOBILE" },
"validation": { "type": "OTP", "channel": "WHATSAPP" },
"client_result": "SUCCESS"
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}| Field | Values |
|---|---|
validation.type | OTP · MAGIC_LINK |
validation.channel | SMS · WHATSAPP · EMAIL · VOICE. VOICE only with OTP. |
The channel has to match the field: an EMAIL is validated through the EMAIL channel, and a PHONE through SMS, WHATSAPP, or VOICE. In a CONFIRM of an email or a phone, validation and the data being confirmed (value for an email, phone for a phone) are required.
The channel is the one your system used for its own validation. Koin does not send SMS (see §12), so an SMS or VOICE channel here always describes your validation, not one run by Koin.
You can also send validation in an ADD with client_result: SUCCESS, when you add a piece of data you have already validated: Koin treats it as a confirmed data. In an ADD it is optional, and without it the ADD works as before. validation in a DELETE or an UPDATE responds 400.
validationdescribes your validation, not the evaluation's strategy.
The
validationobject tells Koin how you confirmed the data. It does not replace the strategy Koin may ask for (see §6).
Special case: email without a password.
If the user changes their email and did not have a password (for example, they signed in with a social network), they must create one. In that case you also send a
CHANGE_PASSWORD.
flowchart LR
A["User changes<br/>email or phone"]
B["CHANGE_PROFILE"]
T["Confirmation<br/>token"]
Q{"Did the email change and<br/>was there no password?"}
P["CHANGE_PASSWORD"]
F["End"]
A --> B
B --> T
T --> Q
Q -->|"Yes"| P
Q -->|"No"| F
classDef dark fill:#0E2419,color:#ffffff,stroke:#0E2419
class B,P dark
classDef decision fill:#E6F6EA,color:#0A7F25,stroke:#10B132
class T decision
Figure 3 · Contact change: 2 evaluations, 1 conditional.
Category and beneficiary changes are in the Loyalty Pack.
8.4 CLOSE_ACCOUNT
A single evaluation, always confirmed with a token, whether or not the user has a password.
{
"type": "CLOSE_ACCOUNT",
"details": { "user_id": "company_8812345" },
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}- The user asks to close their account.
- You send
CLOSE_ACCOUNT. - Koin responds
receivedwith the strategy (token). - The user validates the token, Koin sends you the final decision, and you execute the closure.
- You report the final result.
9. Reporting the final result
When the action ends, you report how it ended with a separate notification.
sequenceDiagram
participant Backend as Customer backend
participant Koin
Backend->>Koin: POST /v1/ato/evaluations
Koin-->>Backend: evaluation_id + decision
Note over Backend: The user completes or abandons the action
Backend->>Koin: PATCH /v1/ato/evaluations/{evaluation_id}/notifications
Koin-->>Backend: 200 OK
Figure 4 · Final-result notification.
Three simple rules:
- The
evaluation_idis enough. You do not need to repeat the evaluation type: the mechanism is the same for the whole catalog. - It is independent of the verification. A user can validate the token correctly and still not finish the change. That is why they are two different pieces of data.
- It closes the learning loop. For each action, Koin stores the context, the strategy that was applied, and the final result. With that, it calibrates its decisions for your program.
If your system orchestrates the strategy
When Koin responds received and you run the verification yourself (see §12), you tell Koin how it went with the same PATCH endpoint. Koin combines that result with the rest of the signals and sends you the final decision (approved or denied) through callback_url.
{
"type": "STATUS",
"notification_date": "2026-10-16T14:10:44.307",
"strategies": {
"type": "VerificationCode",
"results": [
{ "channel": "WhatsApp", "status": "Accept" }
]
}
}strategies.results[].status: Accept · Reject. The same mechanism is used for 3DS (CollectAuthRecovery), with provider and mode; the full example is in Strategies. Contract: Send Notifications.
10. Blocking and recovering accounts
An evaluation protects one action. Account Services protects the whole account. You can find an account, block it when you suspect or confirm a takeover, and give its owner back access when they regain control.
Account Services is part of the same Account Protection API: other endpoints, the same key, the same user_id, and its own reference. The body has no commerce: Koin identifies your program from your token, so you can only see and change your own accounts.
| Method | Path | Purpose |
|---|---|---|
POST | /v1/ato/accounts/search | Search accounts. |
POST | /v1/ato/accounts/USER_ID/blocks | Block an account. |
POST | /v1/ato/accounts/blocks | Bulk block. |
POST | /v1/ato/accounts/USER_ID/recoveries | Start a recovery, or record one that already ended. |
PATCH | /v1/ato/accounts/USER_ID/recoveries/{recovery_id} | Complete a recovery that was started. |
POST | /v1/ato/accounts/recoveries | Bulk recovery. |
You decide when to block an account
A denied from Koin is one reason to block an account. It is not the only one, and you do not need it. You can block an account whenever you decide to, for reasons Koin cannot see:
| Where the reason comes from | Examples |
|---|---|
| Signals Koin gives you | Repeated denied decisions, a high score, a member who answers "it wasn't me" to a notification. |
| Signals only you have | A support ticket, a chargeback, fraud found in another channel, an alert from a partner, or your own policy. |
That is why every block carries your own reason, an optional comment, and an external_reference with the case id in your system. Koin also blocks accounts on its own when it receives alerts that an account was taken over, and anyone (you or the Koin team) can undo what the other did.
10.1 Account status
Every account has two statuses you can see: whether it is blocked (blocked) and its risk level (risk_score). They are not the verdict of an evaluation, and they are independent of the account's lifecycle.
| Status | Meaning | Effect on its evaluations |
|---|---|---|
blocked: false | Account with no blocks. | The engine decides as usual. |
blocked: true | Blocked account: by you, or by Koin when it receives alerts that it was taken over. The block is reversible. | All its sensitive evaluations return denied. |
risk_score | The risk level Koin detects on the account: LOW, MEDIUM, or HIGH. | The higher it is, the more friction: the engine asks for more verifications before approving. |
Every block and every recovery is a record with its own id, date, origin, and reason. The sequence of those records is the history of the account.
10.2 Block and unblock
| Action | Effect on the account |
|---|---|
| Create a block (you or Koin) | The account stays blocked: blocked: true. |
Complete a recovery (PATCH with completed: true, or POST with completed: true) | The block is reverted: blocked: false. |
expires_at passes on a recovery in progress | The recovery is abandoned and the account stays blocked. |
stateDiagram-v2
[*] --> Unblocked
Unblocked --> Blocked: create block (you or Koin)
Blocked --> Unblocked: recovery completed
Blocked --> Blocked: expires_at passes
Figure 5 · Block and unblock of an account.
Three rules to remember:
- The block is reversible, and only one way. The only way to revert a block is a recovery. If a block was a mistake, recover the account with
client_flow: FALSE_POSITIVE. - Reverting the block updates the account. Koin updates
last_recovered_atandrecovery_count. - When
expires_atpasses, the account stays blocked. The recovery is recorded as abandoned. Abandoned recoveries show where your flow adds friction, and they reveal someone who starts a recovery many times and never finishes it.
10.3 Search accounts
POST /v1/ato/accounts/search?page=1&limit=50
You search with at least one filter. If you send several, all of them must match.
| Filter | Description |
|---|---|
user_id | The member identifier. |
document | The member document. |
email | An email of the account. |
phone | A phone of the account. |
device | merchant_device (your own device identifier) or koin_device_id (only if Koin shares device ids with you). |
blocked | true or false. It works on its own, for example to list every blocked account. |
risk_score | A list of levels: LOW, MEDIUM, or HIGH. |
A body without filters returns 400. It is a POST so documents and emails do not travel in the URL.
Pagination goes in query parameters: page (from 1) and limit (50 by default, 100 at most). The response returns page, limit, and total, the number of accounts that match the filters.
{
"email": "[email protected]",
"blocked": true,
"risk_score": ["HIGH", "MEDIUM"]
}Response:
{
"accounts": [
{
"user_id": "company_8812345",
"blocked": true,
"blocked_at": "2026-10-19T17:40:00Z",
"risk_score": "HIGH",
"last_recovered_at": "2026-08-02T10:15:00Z",
"recovery_count": 1,
"first_name": "Maria",
"last_name": "Silva",
"birth_date": "1988-04-12",
"document": { "type": "CPF", "number": "12345678909", "nationality": "BR" },
"emails": ["[email protected]"],
"phones": [{ "area_code": "11", "number": "912345678", "type": "MOBILE" }]
}
],
"page": 1,
"limit": 50,
"total": 1
}The search returns a list because one email, document, phone, or device can belong to more than one account. For accounts with a recovery in progress, the summary also carries recovery_id and expires_at. You only see accounts of your own program, with data you sent to Koin, and only active emails and phones.
10.4 Block
POST /v1/ato/accounts/USER_ID/blocks receives these fields:
| Field | Required | Description |
|---|---|---|
reason | Yes | ATO_SUSPECTED · ATO_CONFIRMED · NOT_ME · FRAUD_CONFIRMED · INTERNAL_POLICY · OTHER |
comment | No | Free text. |
external_reference | No | The id of the case in your system. |
INTERNAL_POLICY and OTHER are for reasons that belong to your program. ATO_SUSPECTED and ATO_CONFIRMED tell Koin that you suspect or confirm an account takeover; NOT_ME records that the member said it was not them; FRAUD_CONFIRMED records confirmed fraud.
Block an account (POST /v1/ato/accounts/company_8812345/blocks):
{
"reason": "ATO_CONFIRMED",
"comment": "Email change from an unknown device",
"external_reference": "case-8841"
}Response (201):
{
"block_id": "7c1e9a52-3f0b-4d8e-9a61-2b5d0f4c8e13",
"user_id": "company_8812345",
"reason": "ATO_CONFIRMED",
"blocked": true,
"blocked_at": "2026-10-19T17:40:00Z"
}10.5 Recovery
A recovery is a resource of the account. You create it with POST /v1/ato/accounts/USER_ID/recoveries, and the completed field says whether it already finished. There are two cases:
| Case | When it happens | What you send |
|---|---|---|
| Self-service, in two steps | The user taps "Recover my account" in your app and goes through your own recovery flow. | POST with completed: false, then PATCH with completed: true. |
| Call center, in one step | An analyst of your team reviews the account, validates the identity, and removes what the attacker added while the account is still BLOCKED. You tell Koin once, at the end. | POST with completed: true. |
Self-service. With completed: false, a recovery in progress opens until expires_at. The account stays blocked, but the evaluations of your recovery flow (for example, the CHANGE_PASSWORD of the reset) pass with strong verification instead of being denied because of the block. When you are sure the user recovered the account, you complete it with the PATCH and the block is reverted. If the user abandons and expires_at passes, the recovery is abandoned and the account stays blocked.
sequenceDiagram
actor User
participant App as Your app
participant Koin
User->>App: Taps Recover my account
App->>Koin: POST /v1/ato/accounts/{user_id}/recoveries with completed false
Koin-->>App: 201 recovery in progress
User->>App: Resets the password
App->>Koin: CHANGE_PASSWORD evaluation
Koin-->>App: received with strong verification instead of denied
App->>Koin: PATCH /v1/ato/accounts/{user_id}/recoveries/{recovery_id} with completed true
Koin-->>App: 200 block reverted
opt The user abandons and expires_at passes
Koin->>Koin: Records the recovery as abandoned, the account stays blocked
end
Figure 6 · Self-service recovery, in two steps.
Call center. The account stays blocked during the review, and you register the recovery once it is done.
sequenceDiagram
actor Analyst as Your analyst
participant System as Your system
participant Koin
Note over System,Koin: The account stays blocked during the review
Analyst->>Analyst: Validates identity and removes what the attacker added
Analyst->>System: Confirms the recovery
System->>Koin: POST /v1/ato/accounts/{user_id}/recoveries with completed true
Koin-->>System: 201 block reverted
Figure 7 · Call-center recovery, in one step.
Create (POST):
| Field | Required | Description |
|---|---|---|
completed | No | false by default: opens a recovery in progress. true: reverts the block in one step. |
client_flow | Yes | Your recovery flow (Koin does not own these flows): PASSWORD_RESET · ACCOUNT_REVIEW · IDENTITY_VERIFICATION · FALSE_POSITIVE · OTHER |
reported_by | Yes | Who intends to recover the account: USER or COMMERCE. |
expires_at | No | Only with completed: false. A future ISO-8601 date and time until which the recovery can stay open. If you do not send it, Koin applies a default period. With completed: true it returns 400. |
sessions_revoked | No | You revoked the sessions and tokens of the account. |
comment | No | Free text. |
Complete (PATCH):
| Field | Required | Description |
|---|---|---|
completed | Yes | It only accepts true; false returns 400. |
sessions_revoked | No | You revoked the sessions and tokens of the account. |
comment | No | Free text. |
client_flow and reported_by are set when the recovery is created and do not change.
Start a self-service recovery (POST /v1/ato/accounts/company_8812345/recoveries):
{
"client_flow": "PASSWORD_RESET",
"reported_by": "USER",
"expires_at": "2026-10-20T18:10:00Z"
}Response (201):
{
"recovery_id": "3d8f2b71-9c4e-4a05-b6d2-8e1f7a3c5b90",
"user_id": "company_8812345",
"completed": false,
"client_flow": "PASSWORD_RESET",
"reported_by": "USER",
"expires_at": "2026-10-20T18:10:00Z",
"blocked": true
}Finish it (PATCH /v1/ato/accounts/company_8812345/recoveries/3d8f2b71-9c4e-4a05-b6d2-8e1f7a3c5b90):
{
"completed": true,
"sessions_revoked": true,
"comment": "User reset the password and reviewed the account"
}Record a call-center recovery in one step (POST /v1/ato/accounts/company_8812345/recoveries):
{
"completed": true,
"client_flow": "ACCOUNT_REVIEW",
"reported_by": "COMMERCE",
"sessions_revoked": true,
"comment": "User validated their identity through the call center"
}
What Koin does not ask you for
Koin does not ask in the request for what it can already see in your evaluations: the password change (a
CHANGE_PASSWORDwith a successful result), the MFA verifications (the validated steps of aLOGIN, indetails.authentications), and the evaluations linked to the attack come from the evaluations you already send. The rest (sessions_revoked,comment) Koin does not verify: it records what you report.
Particular cases:
POSTwithcompleted: falseon an account that already has a recovery in progress (the user started the recovery again) returns200with the same recovery (the samerecovery_id) and renewsexpires_at, with the value you sent or the default period.POSTwithcompleted: trueon an account with a recovery in progress returns409: the recovery in progress is completed with thePATCH.POSTon an unblocked account returns409if there never was a recovery, because there is nothing to recover. If there was (for example, you retry after a timeout), it returns200with that recovery.PATCHon a recovery that is already completed returns200, so you can retry after a timeout.PATCHon an expired recovery returns409withEXPIRED: an abandoned recovery stays abandoned. If your analyst did finish the recovery, you register it with aPOSTwithcompleted: true.PATCHon a recovery interrupted by a new block returns409.PATCHwith arecovery_idthat does not exist for that account returns404.
10.6 Bulk operations
Every bulk endpoint is the same path without USER_ID. It receives a list accounts of up to 1,000 entries, each one with its own fields (the same as the individual creation, plus user_id). There is no bulk PATCH: completing a two-step recovery is done user by user.
{
"accounts": [
{ "user_id": "company_8812345", "reason": "ATO_CONFIRMED" },
{ "user_id": "company_7700001", "reason": "ATO_CONFIRMED" },
{ "user_id": "company_0000000", "reason": "ATO_CONFIRMED" }
]
}Response:
{
"summary": { "received": 3, "blocked": 2, "not_found": 1, "rejected": 0 },
"results": [
{ "user_id": "company_8812345", "result": "BLOCKED", "block_id": "7c1e9a52-3f0b-4d8e-9a61-2b5d0f4c8e13" },
{ "user_id": "company_7700001", "result": "BLOCKED", "block_id": "a40d6e38-1b7f-4c92-8d35-6f0e2c9b1a74" },
{ "user_id": "company_0000000", "result": "NOT_FOUND" }
]
}- It always responds
200with 1,000 entries or fewer, with one result per entry in the same order as the request. An invalid entry does not make the others fail. - More than 1,000 entries returns
400for the whole request. - If the same
user_idappears twice, the entries are processed in order; the second one changes nothing and gets the same result.
10.7 Results, retries, and errors
Every operation can be retried. Creating a resource returns 201. If the account was already in that state, it returns 200 with the existing resource (the same id), with no side effects and no new entry in the history. There are no ALREADY_* results.
A retry with different data (for example, another reason) does not change the account or the recorded reason either: Koin keeps the original, which is the one that caused the restriction. The only exception is the expires_at of a recovery in progress, which is renewed.
In individual responses, the blocked field says whether the account stayed blocked. In bulk responses, each entry carries a result:
| Operation | Result (201 / 200) | Not allowed (409 individual · result in bulk) |
|---|---|---|
| Create a block | BLOCKED | — |
Create a recovery with completed: false | RECOVERY | REJECTED: the account is not blocked |
Create a recovery with completed: true | UNBLOCKED | REJECTED: there is already a recovery in progress (complete it with the PATCH) or the account is not blocked |
Complete a recovery (PATCH, individual only) | UNBLOCKED | EXPIRED: the recovery expired |
In every operation, an account that Koin does not know for your program is NOT_FOUND (404 for an individual call). An invalid entry in a bulk call is REJECTED with an error field (400 for an individual call). The summary of a bulk call counts the entries by result.
11. Loyalty Pack: Account Protection for points programs
A loyalty account is a wallet. Points are redeemed for tickets, transferred, and sold on parallel markets. The attacker is not after the account: they are after the balance.
To date, no account-protection provider publishes a data model for points programs. Koin models it with pieces that add to the account evaluations you already know:
| Piece | What it captures | Where it lives | Endpoint |
|---|---|---|---|
| Points profile | The member's balance and tier | SIGN_UP and transactions with points | Account evaluations and transactions |
| Category (tier) | Tier changes, by the member or by the system | CHANGE_PROFILE · CATEGORY | Account evaluations |
| Beneficiaries | Who can fly with the member's points | CHANGE_PROFILE · BENEFICIARY | Account evaluations |
| Transactions with points | Points purchase and purchase with points (transfer: under construction) | POST /v1/antifraud/evaluations | Transactions |
| Partner credits | Points the member receives from a bank or another program, with their bonus and speed | PARTNER_CREDIT | Account events |
Anatomy of an account takeover in loyalty
Each step of the attack is an evaluation or a transaction Koin sees, and they are all linked by the same user_id:
sequenceDiagram
actor Attacker
participant Program as Loyalty program
participant Koin
Attacker->>Program: Login with leaked credentials
Program->>Koin: LOGIN with a new device and an IP from another state
Attacker->>Program: Changes the account email
Program->>Koin: CHANGE_PROFILE EMAIL UPDATE
Koin-->>Program: received with VerificationCode to the original channel
Attacker->>Program: Adds an unknown beneficiary
Program->>Koin: CHANGE_PROFILE BENEFICIARY ADD
Attacker->>Program: Redeems the full balance for a ticket
Program->>Koin: Redemption with Points payments and points_balance
Koin-->>Program: denied because the redemption consumes 100 percent of the balance
Figure 8 · Anatomy of an account takeover in a loyalty program.
None of these actions is suspicious on its own. The sequence is, and Koin sees it in full because every endpoint shares the member's identity.
From there, your program can block the account or start a recovery (see §10). Koin's denied is one signal among others: you can block whenever your own reasons say so.
11.1 Points profile at signup
SIGN_UP requires the same fields as the API Reference: user_id, first_name, last_name, birth_date, email, and profile. Inside profile, category and points_balance are required.
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | Member identifier. |
first_name | string | Yes | First name. |
last_name | string | Yes | Last name. |
birth_date | string (YYYY-MM-DD) | Yes | Date of birth. |
email | string | Yes | Email contact. |
profile.points_balance | integer | Yes | Points balance at the time of the request. |
profile.category | string | Yes | The member's category or tier. |
{
"type": "SIGN_UP",
"details": {
"user_id": "company_8812345",
"first_name": "Maria",
"last_name": "Souza",
"birth_date": "1988-03-14",
"email": "[email protected]",
"document": { "type": "CPF", "number": "12345678909", "nationality": "BR" },
"authentication_type": "PASSWORD",
"profile": {
"points_balance": 0,
"category": "BASIC"
}
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}The balance is not updated with
CHANGE_PROFILE. Koin receives the current balance on every transaction with points (see §11.4), right where it is used.
11.2 Category (tier) change
A tier change is reported with CHANGE_PROFILE, operation UPDATE on the CATEGORY field.
A category change is normally triggered by the program's system, not by the user. That is why the evaluation includes initiator, so Koin can tell an automatic change from one made by the member.
initiator | Who started the change |
|---|---|
USER | The member, from the app or the site. |
SYSTEM | The customer's system (tier requalification, migration, support). |
{
"type": "CHANGE_PROFILE",
"initiator": "SYSTEM",
"details": {
"user_id": "company_8812345",
"type": "UPDATE",
"field": "CATEGORY",
"old_value": "SILVER",
"new_value": "GOLD"
}
}
Why it matters
A tier upgrade changes the member's limits (redemptions, beneficiaries, cabin upgrades). A tier change started by the user, or right before a large redemption, is a signal Koin takes into account.
11.3 Beneficiaries
Beneficiaries are the people who can fly with the member's points. They are the natural destination of an account takeover: the attacker adds a third party and redeems in their name.
They are reported with CHANGE_PROFILE on the BENEFICIARY field. Each evaluation carries one beneficiary. To add or remove several people, send one evaluation per person. There are three operations:
| Operation | When | What you send |
|---|---|---|
ADD | A beneficiary is added. | beneficiary: the new beneficiary. |
DELETE | A beneficiary is removed. | beneficiary with only the document. |
UPDATE | A beneficiary's data is changed. | old_beneficiary with the document of the beneficiary that changes, and new_beneficiary with their new data. Same old/new format as a phone change. |
A full beneficiary (ADD, and new_beneficiary on UPDATE) always includes:
| Field | Type | Description |
|---|---|---|
first_name | string | First name. |
last_name | string | Last name. |
birth_date | string (YYYY-MM-DD) | Date of birth. |
gender | string | FEMALE · MALE · OTHER. |
document | object | type and number (and optionally nationality). Examples: DNI, CPF, CNPJ, CUIL, CI, PASSPORT. PASSPORT is used for foreign beneficiaries. |
email | string | The beneficiary's email. |
phone | object | area_code, number, and type, the same as in the rest of the API. |
address | object | Address, with the same schema as the rest of the API (street, number, city, state, zip_code, country_code…). |
On DELETE, beneficiary carries only the document. On UPDATE, old_beneficiary does the same: it is the key that identifies the beneficiary you are changing.
Add a beneficiary:
{
"type": "CHANGE_PROFILE",
"initiator": "USER",
"details": {
"user_id": "company_8812345",
"type": "ADD",
"field": "BENEFICIARY",
"beneficiary": {
"first_name": "João",
"last_name": "Souza",
"birth_date": "2012-07-02",
"gender": "MALE",
"document": { "type": "CPF", "number": "98765432100", "nationality": "BR" },
"email": "[email protected]",
"phone": { "area_code": "11", "number": "987650000", "type": "MOBILE" },
"address": { "street": "Rua Augusta", "number": "1500", "city": "São Paulo", "state": "SP", "zip_code": "01304-001", "country_code": "BR" }
}
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}Remove a beneficiary:
{
"type": "CHANGE_PROFILE",
"initiator": "USER",
"details": {
"user_id": "company_8812345",
"type": "DELETE",
"field": "BENEFICIARY",
"beneficiary": {
"document": { "type": "CPF", "number": "98765432100" }
}
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}Update a beneficiary:
{
"type": "CHANGE_PROFILE",
"initiator": "USER",
"details": {
"user_id": "company_8812345",
"type": "UPDATE",
"field": "BENEFICIARY",
"old_beneficiary": {
"document": { "type": "CPF", "number": "98765432100" }
},
"new_beneficiary": {
"first_name": "João",
"last_name": "Souza",
"birth_date": "2012-07-02",
"gender": "MALE",
"document": { "type": "CPF", "number": "98765432100", "nationality": "BR" },
"email": "[email protected]",
"phone": { "area_code": "21", "number": "912340000", "type": "MOBILE" },
"address": { "street": "Rua Augusta", "number": "1500", "city": "São Paulo", "state": "SP", "zip_code": "01304-001", "country_code": "BR" }
}
}
}
Why it matters
Koin builds the program's beneficiary network. The same beneficiary document showing up on many unrelated accounts is the fingerprint of a miles broker. And changing a beneficiary's email or phone is a way to divert redemption notifications.
11.4 Points transactions
Purchasing points and purchasing products with points are evaluated in the transactions endpoint of Account Protection. It has its own reference, and it is the same product: the same key, and the same member identity as the account evaluations.
| Transaction | Status |
|---|---|
| Points purchase | Available |
| Purchase with points (mixed payment) | Available |
| Points transfer | Under construction: the model will be published in a future version of this guide. |
If the points arrive from another program or a bank, their arrival is recorded today as a partner credit: see §11.5.
POST /v1/antifraud/evaluations
Full reference: API Reference · Transactional.
The golden rule:buyer.idis required
and it must carry the same identifier you send as
user_idon account evaluations. That is what lets Koin know which member is making the transaction and connect it with everything that happened on their account.
Points purchase
It is modeled with what already exists: a Generic item that indicates Points, with the quantity (quantity), the price (price), and the transaction total. The payment method is the usual one (card, Pix, and so on).
The item's seller_id indicates which loyalty program the points belong to (the airline, a bank, another coalition partner). That is how Koin distinguishes a purchase of the program's own points from a purchase of points from a partner program.
{
"type": "Ecommerce",
"buyer": {
"id": "company_8812345",
"first_name": "Maria",
"last_name": "Souza",
"email": "[email protected]",
"document": { "type": "CPF", "number": "12345678909", "nationality": "BR" }
},
"items": [
{
"type": "Generic",
"id": "PTS-10000",
"name": "Purchase of 10,000 points",
"category": { "id": "POINTS", "name": "Points" },
"seller_id": "COMPANY",
"quantity": 10000,
"price": { "currency_code": "BRL", "value": 0.07 }
}
],
"payments": [
{
"method": "CreditCard",
"amount": { "currency_code": "BRL", "value": 700.00 },
"installments": 1,
"details": { "bin": "424242", "last_digits": "4444", "brand_name": "Visa" },
"payer": { "first_name": "Maria", "last_name": "Souza", "email": "[email protected]" }
}
],
"transaction": {
"reference_id": "COMPANY-PTS-000123",
"country_code": "BR",
"total_amount": { "currency_code": "BRL", "value": 700.00 }
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}Purchase with points and mixed payment
Mixed payment methods are supported: in payments you send one method for each part of the payment, for example CreditCard for the cash portion and Points for the points used (quantity) with their equivalent amount.
In addition, the buyer includes their points profile in buyer.profile:
| Field | Required | Description |
|---|---|---|
buyer.profile.points_balance | Yes | Points balance before the transaction. |
buyer.profile.category | No | The member's category or tier. |
{
"type": "Ecommerce",
"buyer": {
"id": "company_8812345",
"first_name": "Maria",
"last_name": "Souza",
"email": "[email protected]",
"document": { "type": "CPF", "number": "12345678909", "nationality": "BR" },
"profile": {
"points_balance": 48000,
"category": "GOLD"
}
},
"items": [
{
"type": "Flight",
"id": "XY1234-2026-12-20",
"quantity": 1,
"price": { "currency_code": "BRL", "value": 1200.00 },
"itinerary_type": "ONEWAY",
"route_type": "DOMESTIC",
"routes": [
{
"position": 1,
"segments": [
{
"position": 1,
"airline_code": "XY",
"flight_number": 1234,
"departure": { "airport_code": "VCP", "date": "2026-12-20T08:15:00Z" },
"arrival": { "airport_code": "REC", "date": "2026-12-20T11:20:00Z" }
}
]
}
],
"passengers": [
{
"first_name": "João",
"last_name": "Souza",
"birth_date": "2012-07-02",
"document": { "type": "CPF", "number": "98765432100", "nationality": "BR" }
}
]
}
],
"payments": [
{
"method": "Points",
"quantity": 30000,
"amount": { "currency_code": "BRL", "value": 850.00 }
},
{
"method": "CreditCard",
"amount": { "currency_code": "BRL", "value": 350.00 },
"installments": 1,
"details": { "bin": "424242", "last_digits": "4444", "brand_name": "Visa" },
"payer": { "first_name": "Maria", "last_name": "Souza", "email": "[email protected]" }
}
],
"transaction": {
"reference_id": "COMPANY-RES-778812",
"country_code": "BR",
"total_amount": { "currency_code": "BRL", "value": 1200.00 }
},
"device": { "ipv4": "187.61.115.149", "session_id": "455e1d2f-6db1-409a-8089-80e40cf37a12" }
}
Why the prior balance matters
With
points_balanceandquantity, Koin knows what share of the balance is being spent. Draining 100% of an account built up over years, from a new device, is the clearest signature of a taken-over account.
The Flight item (routes, segments, passengers with a document) is already part of the transactional model. With it, Koin cross-checks the redemption passengers against the account beneficiaries. See the item types in the API Reference · Transactional.
11.5 Partner credits: points that arrive from outside your program
New · Members do not only earn points inside your program. A bank or another loyalty program can credit points to a member's account: Livelo, Esfera, the card issuer, or any other partner. Every time that happens, you tell Koin with a PARTNER_CREDIT event, and Koin records where the balance came from.
POST /v1/ato/accounts/USER_ID/events
The member goes in the path: the same user_id you use everywhere else. Your program comes from your key, like in Account Services: there is no commerce in the body.
| Field | Required | Description |
|---|---|---|
type | Yes | PARTNER_CREDIT. |
partner_name | Yes | Free text that identifies the source: a bank or another program (for example LIVELO, ESFERA, the card issuer). Keep the name consistent per partner so the history stays clean. |
base_points | Yes | Integer ≥ 0. Points or miles generated by the credit, without the bonus. |
speed | No | STANDARD or EXPRESS. STANDARD takes days; EXPRESS takes hours and is sometimes paid for. |
bonus_points | No | Integer ≥ 0. Bonus applied, in points. |
campaign_id | No | The program's bonus campaign the credit belongs to, so a legitimate campaign does not look like abuse. |
reference_id | No | Your own id for the credit. Repeated for your program and the same type, it responds 409 and is not recorded again. |
event_date | No | Date and time of the credit according to your system, as a local datetime without a timezone suffix, like in account evaluations. |
Example (POST /v1/ato/accounts/company_8812345/events):
{
"type": "PARTNER_CREDIT",
"partner_name": "LIVELO",
"base_points": 5000,
"speed": "EXPRESS",
"bonus_points": 1000,
"campaign_id": "PROMO-2026-11",
"reference_id": "CREDIT-LIVELO-000123",
"event_date": "2026-11-18T15:40:00"
}Response (201):
{
"event_id": "5f1c2b7e-3a9d-4c66-8f0e-52a7b8d9c101",
"message": "Event received",
"status": "received"
}
receivedhere is not a decision.In an evaluation,
receivedmeans a verification is required (§6). In this response it only means the event was accepted.PARTNER_CREDITnever returns a decision.
Why it mattersThe balance that arrives from outside is the beginning of many abuse stories: a brand-new account that receives points right away (a signup made with someone else's data), a bonus on an account created yesterday, an express transfer paid for the first time, or a balance redeemed minutes after it lands. To Koin they are invisible if it only sees the redemption. The credit history is what makes them visible: that is what this event is for.
Rules of this event:
- It is a record, not an evaluation. No decision, no strategy, no
callback_url: the model of §6 does not apply here. - It never blocks, restricts, or challenges the member. A partner credit only adds to the member's history.
- There is no
deviceto send. The credit did not happen on your site or app: the request carries only the fields of the table above. - The member has to be registered. If Koin does not know the
user_idfor your program, the call returns404. Send partner credits after the member is registered (§11.1). - Errors.
400for a missing required field or an invalidspeed;404if the member is not registered;409for areference_idrepeated with the same type. - Koin builds the member's history. Every credit is recorded for the member, and that history is part of what Koin weighs in every evaluation that follows.
12. Operating modes
Each customer chooses how they operate, from the dashboard and without changing the API contract:
| Koin operates | The customer operates | |
|---|---|---|
| Strategies | The response includes a link to Koin's hosted page. The user verifies there and Koin sends you the final evaluation decision (approved or denied) through callback_url. | The response includes the recommended type. You run your validation, report its result through PATCH, and Koin sends you the final decision through callback_url. |
| Communications | Koin sends the token and the magic link on the customer's behalf, by email or WhatsApp. Koin does not send SMS. | You send the messages through your own channels. |
You can start with your current verifications and migrate to Koin's strategy by strategy.
13. Errors and best practices
Response codes
| Code | Meaning | What to do |
|---|---|---|
200 | Evaluation created, or an existing resource returned on a retry (Account Services). | Apply the decision. |
201 | Resource created (Account Services, Account events). | Store the id of the resource. |
400 | Validation error. Also a search without filters, a bulk call with more than 1,000 entries, a PARTNER_CREDIT with a missing required field or an invalid speed, or an invalid combination in a LOGIN or a CHANGE_PROFILE. In a LOGIN: user_id with ACCOUNT_NOT_FOUND, an ACCOUNT_NOT_FOUND without its complete identifier, failure_reason or failure_reason_detail with a SUCCESS result, a failure_reason_detail without failure_reason, an email or a document that does not match the identifier of the same type, OTHER without failure_reason_detail, an authentication step with a channel or contact data that does not match its type (for example, MAGIC_LINK with VOICE), or authentication_type together with authentications. In a CHANGE_PROFILE: a CONFIRM of an email or a phone without validation or without the data it confirms, a validation without type or without channel, a channel that does not match the field (for example, an email with SMS) or the validation type (VOICE with MAGIC_LINK), or a validation in a DELETE or an UPDATE. New | Fix the request: causes indicates which field failed. |
401 | Unauthorized. | Check the key and the endpoint permissions. |
404 | Evaluation not found (PATCH), an account that Koin does not know for your program (Account Services), or a PARTNER_CREDIT for a member Koin does not know (Account events). | Check the evaluation_id or the user_id. |
409 | The state of the account does not allow the operation (for example, a recovery on an account that is not blocked), the recovery expired (EXPIRED), or a second record arrived with the same commerce, reference_id, and type (an ATO evaluation or a PARTNER_CREDIT). Nothing new is recorded. | Review the account's status and choose the right operation. For a repeated reference_id, do not resend: keep using the first evaluation or event. |
412 | The case is already closed (PATCH with type: STATUS). | Do not retry. The evaluation is no longer open. |
500 | Internal error. | Retry with backoff and apply your fallback policy. |
Validation error example:
{
"code": 400,
"message": "Validation errors",
"causes": ["type must not be blank"]
}Integration checklist
- The same
user_ideverywhere: account evaluations, transactions (buyer.id), Account Services, and partner credits. -
session_idon every evaluation: integrate the device SDK on web and app. - Also send what fails: logins with
client_result: FAILEDand abandoned actions. - Close every cycle:
PATCHwith the final result of each evaluation. - Listen on
callback_url: that is where the final decision arrives when there was a strategy. - Define your fallback: what your flow does if Koin does not respond in time (for example, allow the login and ask for a token on high-value actions).
- Explicit timeouts: set a timeout on your HTTP client and record fallback cases.
- Do not reuse evaluations: one action, one evaluation. Send a
reference_idper evaluation: repeating it for the same evaluation type returns409, and ATO has no pre-evaluation. - Block when you decide to: you do not need a
deniedfirst. Send your ownreasonand yourexternal_reference. - Revert every block with a recovery: it is the only way to unblock an account. Use
client_flow: FALSE_POSITIVEif the block was a mistake. - Retry freely: every Account Services operation can be retried with the same data and returns the same resource.
- Record every partner credit: each time points arrive from a bank or another program, send a
PARTNER_CREDITafter the member exists: see §11.5.
14. From sandbox to production
flowchart LR
A["1. Sandbox<br/>integration and tests"]
B["2. Listener mode<br/>real data, without blocking"]
C["3. Customization<br/>optional, per program"]
D["4. Go-live<br/>active decisions"]
E["5. Continuous improvement<br/>final results and<br/>confirmed fraud"]
A --> B
B --> C
C --> D
D --> E
classDef go fill:#10B132,color:#06210F,stroke:#10B132
class D go
classDef decision fill:#E6F6EA,color:#0A7F25,stroke:#10B132
class E decision
Figure 9 · From sandbox to production.
- Sandbox. You integrate against
https://api-sandbox.koin.com.brwith your test key. - Listener mode. Koin receives real traffic and learns your program's behavior without affecting your members. On the transactions endpoint it is enabled with
transaction.listener_mode: true: the evaluation is recorded and always returns approved. - Customization (optional). Koin already decides on its own. If you want, you adjust rules, lists, thresholds, and strategies per evaluation with our team.
- Go-live. You turn decisions on, evaluation by evaluation.
- Continuous improvement. Final results and confirmed fraud cases feed the engine back.
Let's talk?
The Koin team supports every integration, from sandbox to go-live. Full API Reference: api-docs.koin.com.br
Updated 1 day ago
