Docs

API reference

Every endpoint of the Affiligato API v2: what it takes and what it answers.

Every answer is { "data": … }, a list adds has_more, and an error is { "error": { "code", "message" } }. A key sees only its own program. Amounts are in minor units and times in milliseconds since the epoch. Lists come newest first; pass the last id you saw as starting_after.

Base URL: https://app.affiligato.com/api/v2. A secret API key from Integrations → Conversions API, sent as Bearer afk_….

Meta

GET /openapi.json

This OpenAPI document

  • 200 This OpenAPI document

Program

GET /program

The program this key belongs to

  • 200 The program this key belongs to
  • 401 unauthorized
  • 429 rate_limited

Partners

GET /partners

List partners, newest first, or find one by email

ParameterInTypeAbout
limitqueryinteger
starting_afterquerystring
emailquerystring
  • 200 List partners, newest first, or find one by email
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

POST /partners

Add an approved partner and email them their link

Body fieldTypeAbout
email (required)string
group_idstring
name (required)string
  • 201 Add an approved partner and email them their link
  • 400 invalid_request
  • 401 unauthorized
  • 409 conflict
  • 429 rate_limited

GET /partners/{id}

Get a partner

ParameterInTypeAbout
id (required)pathstring
  • 200 Get a partner
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

PATCH /partners/{id}

Change a partner's name, group or tags

ParameterInTypeAbout
id (required)pathstring
Body fieldTypeAbout
group_idobject
namestring
tagsstring[]
  • 200 Change a partner's name, group or tags
  • 400 invalid_request
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

POST /partners/{id}/approve

Set a partner's status to approved

ParameterInTypeAbout
id (required)pathstring
  • 200 Set a partner's status to approved
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

POST /partners/{id}/reject

Set a partner's status to rejected

ParameterInTypeAbout
id (required)pathstring
  • 200 Set a partner's status to rejected
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

POST /partners/{id}/suspend

Set a partner's status to suspended

ParameterInTypeAbout
id (required)pathstring
  • 200 Set a partner's status to suspended
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

Commissions

GET /commissions

List commissions, newest first

ParameterInTypeAbout
limitqueryinteger
starting_afterquerystring
  • 200 List commissions, newest first
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

POST /commissions

Create a manual commission for a partner

Body fieldTypeAbout
amount (required)integer
currencystring
notestring
partner_id (required)string
revenueinteger
status"approved" | "pending"
  • 201 Create a manual commission for a partner
  • 400 invalid_request
  • 401 unauthorized
  • 409 conflict
  • 429 rate_limited

GET /commissions/{id}

Get a commission

ParameterInTypeAbout
id (required)pathstring
  • 200 Get a commission
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

PATCH /commissions/{id}

Change an unpaid commission's amount or note

ParameterInTypeAbout
id (required)pathstring
Body fieldTypeAbout
amountinteger
notestring
  • 200 Change an unpaid commission's amount or note
  • 400 invalid_request
  • 401 unauthorized
  • 404 not_found
  • 409 conflict
  • 429 rate_limited

DELETE /commissions/{id}

Delete a commission that was never paid

ParameterInTypeAbout
id (required)pathstring
  • 200 Delete a commission that was never paid
  • 401 unauthorized
  • 404 not_found
  • 409 conflict
  • 429 rate_limited

POST /commissions/{id}/approve

Approve a pending commission

ParameterInTypeAbout
id (required)pathstring
  • 200 Approve a pending commission
  • 401 unauthorized
  • 404 not_found
  • 409 conflict
  • 429 rate_limited

POST /commissions/{id}/decline

Decline an unpaid commission

ParameterInTypeAbout
id (required)pathstring
  • 200 Decline an unpaid commission
  • 401 unauthorized
  • 404 not_found
  • 409 conflict
  • 429 rate_limited

Transactions

GET /transactions

List transactions, newest first

ParameterInTypeAbout
limitqueryinteger
  • 200 List transactions, newest first
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

POST /transactions

Record a payment; the partner who referred the customer is credited

Body fieldTypeAbout
amount (required)integer
currency (required)string
customer_idstring
emailstring
paid_atinteger
product_idsstring[]
source_idstring
  • 201 Record a payment; the partner who referred the customer is credited
  • 400 invalid_request
  • 401 unauthorized
  • 409 conflict
  • 429 rate_limited

GET /transactions/{id}

Get a transaction

ParameterInTypeAbout
id (required)pathstring
  • 200 Get a transaction
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

DELETE /transactions/{id}

Delete a transaction and reverse what it earned

ParameterInTypeAbout
id (required)pathstring
  • 200 Delete a transaction and reverse what it earned
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

List partners' links, newest first

ParameterInTypeAbout
limitqueryinteger
starting_afterquerystring
partner_idquerystring
  • 200 List partners' links, newest first
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

Clicks

GET /clicks

List clicks, newest first

ParameterInTypeAbout
limitqueryinteger
starting_afterquerystring
countryquerystring
devicequery"desktop" | "mobile" | "tablet"
link_idquerystring
partner_idquerystring
  • 200 List clicks, newest first
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

Promotion codes

GET /promo_codes

List partners' promotion codes, newest first

ParameterInTypeAbout
limitqueryinteger
starting_afterquerystring
  • 200 List partners' promotion codes, newest first
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

Customers

GET /customers

List referred customers, newest first

ParameterInTypeAbout
limitqueryinteger
  • 200 List referred customers, newest first
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

POST /customers/status

Set a referred customer's subscription status (active, trialing or canceled) by the customer id your billing reported, e.g. after a cancellation your own webhook received

Body fieldTypeAbout
customer_id (required)string
status (required)"active" | "canceled" | "trialing"
  • 200 Set a referred customer's subscription status (active, trialing or canceled) by the customer id your billing reported, e.g. after a cancellation your own webhook received
  • 400 invalid_request
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited

Payouts

GET /payouts

List payouts, newest first

ParameterInTypeAbout
limitqueryinteger
starting_afterquerystring
  • 200 List payouts, newest first
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

Webhooks

GET /webhooks

List the webhook endpoints, oldest first

  • 200 List the webhook endpoints, oldest first
  • 401 unauthorized
  • 429 rate_limited

POST /webhooks

Subscribe an HTTPS URL to events; the answer carries its signing secret, once

Body fieldTypeAbout
events (required)"*" | "partner.created" | "partner.updated" | "referral.created" | "customer.updated" | "link.created" | "link.updated" | "transaction.created" | "transaction.updated" | "commission.created" | "commission.updated" | "payout.created" | "payout.paid"[]
url (required)string
  • 201 Subscribe an HTTPS URL to events; the answer carries its signing secret, once
  • 400 invalid_request
  • 401 unauthorized
  • 429 rate_limited

DELETE /webhooks/{id}

Unsubscribe a webhook endpoint

ParameterInTypeAbout
id (required)pathstring
  • 200 Unsubscribe a webhook endpoint
  • 401 unauthorized
  • 404 not_found
  • 429 rate_limited