Environments
- Sandbox API:
https://smtp.yativo.com - Production API:
https://api.yativo.com
Authentication
All Affiliate endpoints need an authenticated request. Server-to-server requests use your team’s API key and secret:Authorization: Bearer <ACCESS_TOKEN>
instead. Since 15 October 2026, bearer tokens are only accepted from the
dashboard, and the legacy POST /api/v1/auth/login (account_id +
app_secret) flow is deprecated. Don’t send a bearer token together with the
key pair. See Authentication.
Note: unlike most other business endpoints, the Affiliate endpoints do
not require KYC to be complete — a user can see their referral code and
share it before finishing verification.
Response Envelope
Every endpoint returns one of two shapes. Non-paginated success/error (profile endpoint, register,
validate-referrer-code):
referrals, commissions):
Gotcha — HTTP status on success is always200. Thestatus_codefield inside the JSON body is decorative and may show201etc.; the actual HTTP response status for every successful call is200. Error responses do use a real, meaningful HTTP status (400,422,500, …), matchingstatus_codein the body. So: branch on thestatusfield (“success” vs “failed”), not on the raw HTTP status code, for success handling — but you can trust a non-2xx HTTP status as a genuine error.
Gotcha — decimal fields are strings.signup_bonus_amount,percentage_rate,amount,basis_amount,rate_appliedare all serialized as strings (e.g."5.50","10.00"), not JSON numbers, because they’re MySQLdecimalcolumns. Run them throughparseFloat()/Number()before doing arithmetic or formatting.
1) Capture a Referral at Signup
There’s no dedicated “join as affiliate” endpoint — every user is lazily enrolled as an affiliate the first time they (or their referrer) touch the Affiliate API. What the frontend needs to do is pass the referral code through at signup.1a. Validate a referral code (optional, unauthenticated)
Call this as soon as you have a?ref=CODE value in the URL (e.g. someone
landed on your signup page via a shared referral link), to show a “Referred
by a friend ✓” confirmation before the user finishes the form.
1b. Path A — Standard (email + password) registration
One call, pass the code asreferral_code.
1c. Path B — Magic-link (passwordless) login/registration
This is a two-step flow, and the same two calls now handle both signup and returning-user login — there’s no separate “complete registration” step anymore (POST /api/v1/auth/register/complete/{token} still exists in
the codebase but is unused by the current frontend; it may return in the
future for a richer post-signup profile form). The referral code is only
ever passed on the second call.
Step 1 — request the OTP / magic link. This creates a bare user record
under the hood if the email doesn’t exist yet, and emails them a one-time
code / link either way. It does not take a referral code.
"is_registered": true. You can use that to tailor the UI copy
(“Welcome back” vs. “Welcome”), but it’s purely advisory — you don’t need
to branch to a different endpoint for step 2 below; both new and returning
users complete the same way.
Step 2 — verify the OTP. The user opens the emailed link or enters the
OTP; the frontend submits it to this endpoint, passing the referral code as
referred_by. This logs the user in (creating their session/JWT) whether
they’re brand new or returning.
token is the 5-digit OTP the user received by email (also embeddable in
the magic-link URL as ?magic=<token>). It expires 10 minutes after being
issued, and works only once. After 5 wrong attempts the code is invalidated
and the endpoint returns 429. The user then has to request a new code from
POST /api/v1/auth/login/magic. Both endpoints are rate-limited per IP
address: 5 code requests and 10 login attempts per minute.
Always safe to passreferred_byhere, even for a returning user. The backend only ever attaches a referral for an account that has never set a real password and has never logged in before — i.e. a genuinely brand-new signup completing its very first login. If the email belongs to an existing customer,referred_byis silently ignored: no referral row is created and no signup bonus is paid, no matter what’s in the request. You don’t need to conditionally omit the field based onis_registered.
2) Get My Affiliate Profile
Returns (and lazily creates, on first call) the authenticated user’s affiliate profile: their referral code, current commission settings, and referral count. Call this to render the “Refer a friend” / affiliate dashboard page.Endpoint
Sample Response
Field Notes
Build the shareable referral link client-side, e.g.
https://app.yativo.com/signup?ref={referral_code}, and have your signup
page read ?ref= into the referral_code field described in §1.
3) List My Referred Users
Paginated list of users the authenticated user has referred, most recent first.Endpoint
Sample Response
signup_bonus_status values
4) List My Commission History
Paginated ledger of every commission (signup bonuses and percentage payouts) the authenticated user has earned as an affiliate, most recent first. Use this to render an earnings history / payout log.Endpoint
Sample Response
commission_type values
status values
currency is the currency the commission was paid in — for percentage
type this is always the same currency as the underlying referred-user
transaction (no FX conversion is performed).

