Appearance
Affiliates
Base /v1. A commission programme run by staff, separate from promo codes and from user referrals. Affiliates earn commissionBps of each referred person's net subscription revenue for commissionMonths after attribution; never on trials. Attribution is one per person across referrals and affiliates (see Referrals); the affiliate's code or click token is sent to POST /me/attribution.
Money: commission is computed with percentBps (half-up, once), held AFFILIATE_COMMISSION_HOLD_DAYS past payment, then posted hourly to the affiliate profile's creator_earnings (from platform_revenue) once the matured total in the programme currency reaches payoutThreshold. Idempotency keys: affiliate-commission:<paymentId>, reversals affiliate-commission-reversal:<commissionId>:<reversalId>. Refunds and chargebacks reverse proportionally (exact over partial refunds); posted commission is clawed back through the ledger. Self-paid or same-payment-method commissions are stored blocked.
Links: web SHARE_BASE_URL/a/<code>, deep plemuz://a/<code>, landing page SHARE_BASE_URL/ambassadors/<slug>.
Public (guest-safe)
| Method | Path | Body / query | Response | Errors |
|---|---|---|---|---|
| GET | /affiliate-programmes | – | Programme[] open for applications | – |
| GET | /affiliate-programmes/:slug | – | Programme & { isOpen } | AFFILIATE_PROGRAMME_NOT_FOUND |
| GET | /affiliates/pages/:slug | – | LandingPage | AFFILIATE_PAGE_NOT_FOUND |
| GET | /affiliates/codes/:code | – | LandingPage for that code | AFFILIATE_PAGE_NOT_FOUND |
| GET | /affiliates/links/:code/qr.svg | – | image/svg+xml | VALIDATION_FAILED |
| POST | /affiliates/clicks (30/min/IP) | { code, channel?: link|qr|deep_link|landing, deviceKey?, referrer? } | 201 { clickToken | null, expiresAt | null, deepLink } | AFFILIATE_LINK_NOT_FOUND |
Programme: { id, slug, name, description, termsUrl, commissionBps, commissionMonths, attributionWindowDays, payoutThreshold: Money, eligiblePlans[], benefits[], acceptsApplications }. Empty eligiblePlans = every paid plan. LandingPage: { slug, displayName, handle, avatarUrl, headline, bio, code, webUrl, deepLink, qrPath, landingUrl, programme: { name, description, benefits[], termsUrl }, isAcceptingSignUps }. Clicks from bots get no token; repeats from the same device within AFFILIATE_CLICK_DEDUPE_MINUTES are stored as duplicates and not counted.
Signed-in user
| Method | Path | Body / query | Response | Errors |
|---|---|---|---|---|
| POST | /affiliate-programmes/:slug/applications | { profileId, pitch, audienceSize?, primaryChannelUrl?, countryCode? } | 201 Application | AFFILIATE_PROGRAMME_CLOSED, AFFILIATE_PROFILE_INVALID, AFFILIATE_APPLICATION_EXISTS, AFFILIATE_ALREADY_MEMBER |
| GET | /me/affiliate-applications | – | Application[] (applications and invitations) | – |
| POST | /me/affiliate-applications/:id/withdraw | – | Application | AFFILIATE_APPLICATION_NOT_FOUND, AFFILIATE_APPLICATION_DECIDED |
| POST | /me/affiliate-applications/:id/accept | { profileId } (invitation) | Application | as above, AFFILIATE_PROFILE_INVALID |
| POST | /me/affiliate-applications/:id/decline | – | Application | as above |
| GET | /me/affiliates | – | Affiliate[] | – |
| PATCH | /me/affiliates/:id/page | { slug?, headline?, bio? } | Affiliate | AFFILIATE_NOT_FOUND, AFFILIATE_SUSPENDED, AFFILIATE_SLUG_TAKEN |
| GET | /me/affiliates/:id/dashboard | ?from&to (ISO, default 30 days, max 367) | Dashboard | AFFILIATE_NOT_FOUND, AFFILIATE_RANGE_INVALID |
| GET | /me/affiliates/:id/commissions | ?cursor&limit | page of Commission | AFFILIATE_NOT_FOUND |
| GET | /me/affiliates/:id/links | – | Link[] | AFFILIATE_NOT_FOUND |
| POST | /me/affiliates/:id/links | { label?, code? } | 201 Link | AFFILIATE_LINK_LIMIT, AFFILIATE_CODE_TAKEN, AFFILIATE_SUSPENDED |
| PATCH | /me/affiliates/:id/links/:linkId | { label?, isActive? } (default link can't be switched off) | Link | AFFILIATE_LINK_NOT_FOUND |
Application: { id, programmeId, profileId, origin: application|invitation, status: pending|invited|approved|rejected|declined|withdrawn|expired, pitch, invitationMessage, decisionReason, expiresAt, createdAt }. Affiliate: { id, programmeId, programmeName, profileId, slug, headline, bio, status: active|suspended|terminated, landingUrl, joinedAt }. Link: { id, code, label, isDefault, isActive, webUrl, deepLink, qrPath }. Dashboard: { from, to, clicks, signUps, conversions, activeReferredSubscribers, commissions: [{ accrued, held, paid, reversed }] per currency, links: [{ linkId, code, label, clicks, signUps, conversions, commission: Money[] }] }. Commission: { id, planCode, base, commissionBps, amount, reversed, status: held|posted|reversed|blocked, paidAt, availableAt, postedAt }. Money is { amountMinor: string, currency }.
Staff (affiliates:read support+, affiliates:manage admin+)
| Method | Path | Permission | Body / query | Response |
|---|---|---|---|---|
| GET | /staff/affiliate-programmes | read | ?status&cursor&limit | page of StaffProgramme (Programme + status, createdAt, updatedAt) |
| GET | /staff/affiliate-programmes/:id | read | – | StaffProgramme |
| POST | /staff/affiliate-programmes | manage | { slug, name, description?, termsUrl?, commissionBps, commissionMonths, attributionWindowDays, payoutThreshold, eligiblePlans?, benefits?, acceptsApplications? } | 201, starts draft |
| PATCH | /staff/affiliate-programmes/:id | manage | any of the create fields but slug | StaffProgramme |
| POST | /staff/affiliate-programmes/:id/status | manage | { status } (draft→active→paused⇄active→closed) | StaffProgramme / AFFILIATE_PROGRAMME_INVALID_TRANSITION |
| POST | /staff/affiliate-programmes/:id/invitations | manage | { userId, message? } | 201 StaffApplication (expires after AFFILIATE_INVITATION_DAYS) |
| GET | /staff/affiliate-applications | read | ?status&programmeId&cursor&limit | page of StaffApplication |
| POST | /staff/affiliate-applications/:id/approve | manage | { reason? } | StaffApplication; creates the affiliate, slug and default code |
| POST | /staff/affiliate-applications/:id/reject | manage | { reason } | StaffApplication |
| POST | /staff/affiliate-applications/:id/cancel | manage | – | cancels an open invitation |
| GET | /staff/affiliates | read | ?programmeId&status&cursor&limit | page of StaffAffiliate |
| POST | /staff/affiliates/:id/suspend | /terminate | manage | { reason } | StaffAffiliate |
| POST | /staff/affiliates/:id/reinstate | manage | { reason? } | StaffAffiliate |
| GET | /staff/affiliate-reports | read | ?programmeId&from&to&limit | { from, to, programmeId, clicks, signUps, conversions, activeReferredSubscribers, blockedCommissions, commissions[], topAffiliates: [{ affiliateId, slug, accrued, conversions }] } |
Suspended affiliates' links stop attributing and their held commission isn't posted until reinstated; paused/closed programmes take no new attributions but existing referrals keep earning until their window ends.
Events
| Type | Payload |
|---|---|
affiliates.affiliate.joined | { affiliateId, programmeId, userId, profileId, joinedAt } |
affiliates.affiliate.status_changed | { affiliateId, status, occurredAt } |
affiliates.commission.accrued | { commissionId, affiliateId, programmeId, paymentId, amount, availableAt } |
affiliates.commission.posted | { …, amount, postedAt } |
affiliates.commission.reversed | { …, kind: refund|chargeback, amount, wasPosted, reversedAt } |
Consumes identity.user.attributed. Notifications: affiliate.invited, affiliate.approved, affiliate.application_rejected, affiliate.status_changed, affiliate.commission_earned, affiliate.commission_reversed.
KYC: one document, one account
kyc_verifications.document_blind_index holds a keyed HMAC (purpose kyc.document) of the normalised BVN/NIN/ID number. A trigger sets is_document_claimed when the request becomes verified (any path) and clears it on revoked; a unique partial index on (type, document_blind_index) allows one claimed row. POST /verifications/kyc/bvn and POST /verifications/kyc/id-document refuse with KYC_DOCUMENT_ALREADY_USED (409) before any provider call; a lost race fails the request with document_already_used.
Account privacy
On identity.user.deleted: memberships become terminated (account_deleted), headline/bio cleared, links deactivated; applications and the person's own referral attribution are deleted. Commissions and reversals are kept as earnings records.