Skip to content

REST API reference

Server-to-server API for verified conversions, refunds, programs, affiliates, links, analytics, commissions, payouts and webhooks. All amounts are integers in the currency's minor unit. Test-mode keys (sk_test_…) only see and create test data, which is never payable.

Machine-readable: /api/v1/openapi.json (OpenAPI 3.1.0).

Conventions

Authentication
Authorization: Bearer sk_live_… or sk_test_…. Secret keys are server-side only; each has scopes and can expire or be rotated.
Money
Integers in the currency's minor unit (4990 = 49.90 USD, 1500 = ¥1500). Conversion endpoints also accept a decimal string in amount. Floats are never accepted.
Idempotency
Send Idempotency-Key on POST requests; replays return the original result. Conversions are also unique per (type, external_id); refunds per refund_id. Payouts require the header.
Pagination
List endpoints return { object: "list", has_more, data } newest first. Pass ?limit=1–100 and ?starting_after=<last id>.
Errors
{ error: { type, message, details? }, request_id }. Types: authentication_error (401), permission_error (403), invalid_request (400), not_found (404), validation_error (422), rate_limit_error (429), internal_error (500).
Rate limits
600 requests per minute per key. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; 429 responses include Retry-After.
Test mode
Test keys only read and write test data. Test commissions are never payable; payouts cannot be created with test keys.
Public endpoints
/tracking/* use the website's publishable key and accept requests only from that website's origin. They record analytics, never money.

Scopes

  • conversions:write — Submit conversions, refunds and cancellations
  • conversions:read — Read conversions
  • programs:read — Read programs
  • programs:write — Create and update programs
  • affiliates:read — Read affiliates
  • affiliates:write — Invite affiliates
  • links:write — Create referral links for affiliates
  • analytics:read — Read analytics
  • commissions:read — Read commissions
  • payouts:write — Create payouts
  • webhooks:write — Manage webhook endpoints
  • integrations:read — Read integration status

POST/api/v1/conversions

Record a verified conversion

Attributes the conversion (click ids → coupon → referral code → subscription/customer lineage) and calculates the commission from the current rule version. Commissions start as pending and become payable after the program's hold period.

Auth: secret key with scope conversions:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/conversions \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"purchase","external_id":"order_1001","amount":"149.00","currency":"USD","click_id":"AbCdEfGhIjKlMnOpQrStUv","customer_id":"cus_42"}'

GET/api/v1/conversions

List conversions

Auth: secret key with scope conversions:read

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/conversions \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

POST/api/v1/conversions/refund

Report a refund, cancellation or chargeback

Reverses commission proportionally to the refunded share. Already-paid commissions are clawed back from future payouts.

Auth: secret key with scope conversions:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/conversions/refund \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"external_id":"order_1001","refund_id":"rf_1","amount_minor":5000}'

GET/api/v1/programs

List programs

Auth: secret key with scope programs:read

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/programs \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

POST/api/v1/programs

Create a draft program

Publishing requires a verified website and is done in the dashboard.

Auth: secret key with scope programs:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/programs \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Partners","currency":"USD","default_landing_url":"https://shop.example.com/"}'

GET/api/v1/affiliates

List affiliate memberships

Contact details are not available through the API.

Auth: secret key with scope affiliates:read

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/affiliates \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

POST/api/v1/affiliates/invite

Invite affiliates

Auth: secret key with scope affiliates:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/affiliates/invite \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"program_id":"<uuid>","emails":["partner@example.com"]}'

POST/api/v1/links

Create a tracking link for an affiliate

The destination must match the program's allowed destinations.

Auth: secret key with scope links:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/links \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"membership_id":"<uuid>","name":"Spring newsletter","utm":{"source":"newsletter"}}'

GET/api/v1/analytics

Aggregate performance

Clicks, unique clicks, conversions, attributed revenue and commissions by status — money per currency. The period defaults to the last 30 days and can span at most 366 days.

Auth: secret key with scope analytics:read

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/analytics \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

GET/api/v1/commissions

List commissions

Auth: secret key with scope commissions:read

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/commissions \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

POST/api/v1/payouts

Create a payout batch

Moves each membership's available balance into processing payouts. Pay outside the platform, then mark paid in the dashboard. Idempotency-Key is required. Not available to test keys.

Auth: secret key with scope payouts:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/payouts \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

GET/api/v1/webhooks

List webhook endpoints

Auth: secret key with scope webhooks:write

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/webhooks \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

POST/api/v1/webhooks

Create a webhook endpoint

Auth: secret key with scope webhooks:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/webhooks \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hooks/afflux","events":["commission.created","payout.paid"]}'

DELETE/api/v1/webhooks/{id}

Delete a webhook endpoint

Auth: secret key with scope webhooks:write

curl -X DELETE https://YOUR-AFFLUX-HOST/api/v1/webhooks/{id} \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

POST/api/v1/webhooks/{id}/test

Send a test.ping event

Auth: secret key with scope webhooks:write

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/webhooks/{id}/test \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

GET/api/v1/integrations/status

Integration health

Website verification, SDK last-seen and provider integration status.

Auth: secret key with scope integrations:read

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/integrations/status \
  -H "Authorization: Bearer $AFFLUX_SECRET_KEY"

POST/api/v1/tracking/click

Register a ?ref= visit (JavaScript SDK)

Public, authenticated by publishable key and CORS-restricted to the website origin. Returns a click id for the first-party cookie. Never creates commissions.

Auth: publishable key (website origin only)

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/tracking/click

POST/api/v1/tracking/event

Page view / custom event / SDK ping

Accepts text/plain JSON so navigator.sendBeacon works. Analytics only.

Auth: publishable key (website origin only)

curl -X POST https://YOUR-AFFLUX-HOST/api/v1/tracking/event

GET/api/v1/tracking/config

SDK configuration

Auth: publishable key (website origin only)

curl -X GET https://YOUR-AFFLUX-HOST/api/v1/tracking/config

POST/api/v1/integrations/{provider}/{integrationId}

Inbound provider webhook (Shopify, WooCommerce, Stripe)

Signed by the provider over the raw body (X-Shopify-Hmac-Sha256, X-WC-Webhook-Signature, Stripe-Signature). Deduplicated by provider event id.

Auth: provider signature over the raw body

Outgoing webhook payloads

Events: conversion.created, conversion.refunded, commission.created, commission.approved, commission.rejected, commission.reversed, payout.paid, payout.failed, affiliate.applied, affiliate.approved, affiliate.suspended, test.ping. See Webhooks for signature verification and retries.