Skip to content

Affiliates API ​

SaaS edition only. The affiliate program — people share a referral link and earn a share of what the accounts they bring pay; administrators pay them by bank transfer each month and attach the proof.

All paths are relative to https://your-site.com/api/v1. Send Authorization: Bearer <token> and Accept: application/json; see authentication and errors.

MethodPathWhat it does
GET/affiliateThe program's terms and, once joined, your link and earnings
POST/affiliateJoin the affiliate program
PUT/affiliate/bankThe bank account your payouts go to
GET/affiliate-payouts/{payout}/proofDownload the proof of a payout (the affiliate paid, or administrators)
GET/admin/affiliatesEvery affiliate with their earnings (administrators)
GET/admin/affiliates/{affiliate}One affiliate in detail, with bank details (administrators)
PATCH/admin/affiliates/{affiliate}An affiliate's own rate or status (administrators)
POST/admin/affiliates/{affiliate}/payoutsRecord a bank transfer to an affiliate (administrators)
POST/admin/affiliate-payouts/{payout}/proofAttach or replace the proof of a payout (administrators)
DELETE/admin/affiliate-payouts/{payout}Undo a payout recorded by mistake (administrators)
POST/admin/affiliate-commissions/{commission}/voidVoid a commission whose payment was refunded, or count it again (administrators)

GET /affiliate ​

The program's terms and, once joined, your link and earnings

program: enabled, percent, months (0: as long as they pay), cookie_days, hold_days, minimum_payout, currency. affiliate: null before joining; else code, link, percent, status, clicks, signups, paying, pending/due/paid amounts per currency, months (earned per month), payouts (with proof links), commissions, bank.

Responses ​

  • 200 — data:
bash
curl -X GET "https://your-site.com/api/v1/affiliate" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json"

POST /affiliate ​

Join the affiliate program

Responses ​

  • 200 — Already in the program (the same link).
  • 201 — data: the affiliate, with the new referral link.
  • 403 — The program is closed.
bash
curl -X POST "https://your-site.com/api/v1/affiliate" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json"

PUT /affiliate/bank ​

The bank account your payouts go to

Kept encrypted; seen by you and the installation's administrators.

Request body ​

application/json, required

FieldTypeRequiredDescription
holderstringyesAt most 120 characters.
bankstringyesAt most 120 characters.
accountstringyesIBAN or account number. At most 64 characters.
swiftstring, nullable8 or 11 letters and digits.
countrystring, nullableAt most 60 characters.
notesstring, nullableAt most 500 characters.

Responses ​

  • 200 — data: the affiliate.
  • 404 — Not in the program yet.
  • 422 —
bash
curl -X PUT "https://your-site.com/api/v1/affiliate/bank" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"holder":"text","bank":"text","account":"text","swift":"text","country":"text","notes":"text"}'

GET /affiliate-payouts/{payout}/proof ​

Download the proof of a payout (the affiliate paid, or administrators)

Parameters ​

NameInTypeRequiredDescription
payoutpathintegeryes

Responses ​

  • 200 — The file (PDF or image).
  • 404 — No such payout of yours, or no proof attached.
bash
curl -X GET "https://your-site.com/api/v1/affiliate-payouts/{payout}/proof" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json"

GET /admin/affiliates ​

Every affiliate with their earnings (administrators)

Parameters ​

NameInTypeRequiredDescription
monthquerystringThe month whose earnings are shown (YYYY-MM, default this month).
qquerystringName, email or referral code. At most 100 characters.

Responses ​

  • 200 — data: affiliates (user, code, percent, custom_percent, status, clicks, signups, paying, month, pending, due, paid, bank, ready); meta: month, program, month_total, due_total, ready.
  • 403 — Not allowed (not an administrator, or outside the token's abilities).
  • 422 —
Response fields
FieldTypeRequiredDescription
dataobject[]
data[].idinteger
data[].codestring
data[].percentinteger
data[].monthobject[]
data[].month[].currencystring
data[].month[].centsinteger
data[].dueobject[]
data[].due[].currencystring
data[].due[].centsinteger
data[].readyboolean
metaobject
bash
curl -X GET "https://your-site.com/api/v1/admin/affiliates" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json"

GET /admin/affiliates/{affiliate} ​

One affiliate in detail, with bank details (administrators)

Parameters ​

NameInTypeRequiredDescription
affiliatepathintegeryes

Responses ​

  • 200 — data: the affiliate, its user, commissions (with the referred accounts' names) and payouts.
  • 403 — Not allowed (not an administrator, or outside the token's abilities).
  • 404 — Missing, or another account's.
bash
curl -X GET "https://your-site.com/api/v1/admin/affiliates/{affiliate}" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json"

PATCH /admin/affiliates/{affiliate} ​

An affiliate's own rate or status (administrators)

Parameters ​

NameInTypeRequiredDescription
affiliatepathintegeryes

Request body ​

application/json, required

FieldTypeRequiredDescription
commission_percentinteger, nullablenull: the program's rate. Applies to new payments. Minimum 1. Maximum 90.
statusstringOne of: active, suspended.

Responses ​

  • 200 — data: the affiliate.
  • 403 — Not allowed (not an administrator, or outside the token's abilities).
  • 422 —
bash
curl -X PATCH "https://your-site.com/api/v1/admin/affiliates/{affiliate}" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"commission_percent":1,"status":"active"}'

POST /admin/affiliates/{affiliate}/payouts ​

Record a bank transfer to an affiliate (administrators)

Pays every due commission in the currency; the affiliate is told by email. Needs their bank details.

Parameters ​

NameInTypeRequiredDescription
affiliatepathintegeryes

Request body ​

multipart/form-data, required

FieldTypeRequiredDescription
currencystringyesAt least 3 characters. At most 3 characters.
referencestringAt most 120 characters.
notestringAt most 500 characters.
paid_onstring (date)Today or earlier (default today).
proofstring (binary)PDF, PNG, JPG or WebP, up to 10 MB.

Responses ​

  • 201 — data: the payout.
  • 403 — Not allowed (not an administrator, or outside the token's abilities).
  • 422 — No bank details, or nothing due in the currency.
bash
curl -X POST "https://your-site.com/api/v1/admin/affiliates/{affiliate}/payouts" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json" \
  -F "currency=…" \
  -F "reference=…" \
  -F "note=…" \
  -F "paid_on=…"

POST /admin/affiliate-payouts/{payout}/proof ​

Attach or replace the proof of a payout (administrators)

Parameters ​

NameInTypeRequiredDescription
payoutpathintegeryes

Request body ​

multipart/form-data, required

FieldTypeRequiredDescription
proofstring (binary)yes

Responses ​

  • 200 — data: the payout.
  • 403 — Not allowed (not an administrator, or outside the token's abilities).
  • 422 —
bash
curl -X POST "https://your-site.com/api/v1/admin/affiliate-payouts/{payout}/proof" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json" \
  -F "proof=…"

DELETE /admin/affiliate-payouts/{payout} ​

Undo a payout recorded by mistake (administrators)

Its commissions are due again and the proof is deleted.

Parameters ​

NameInTypeRequiredDescription
payoutpathintegeryes

Responses ​

  • 204 — Undone.
  • 403 — Not allowed (not an administrator, or outside the token's abilities).
bash
curl -X DELETE "https://your-site.com/api/v1/admin/affiliate-payouts/{payout}" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json"

POST /admin/affiliate-commissions/{commission}/void ​

Void a commission whose payment was refunded, or count it again (administrators)

Parameters ​

NameInTypeRequiredDescription
commissionpathintegeryes

Request body ​

application/json, required

FieldTypeRequiredDescription
voidbooleanyes

Responses ​

  • 200 — data:
  • 403 — Not allowed (not an administrator, or outside the token's abilities).
  • 422 — The commission was paid already.
bash
curl -X POST "https://your-site.com/api/v1/admin/affiliate-commissions/{commission}/void" \
  -H "Authorization: Bearer $REPLORA_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"void":true}'

Replora: see what your visitors see.