API Documentation

Integrate the AffiliateMango engine directly into your custom stack. Automate affiliate attribution, track specific click events, and ingest real-time payloads.

Quickstart

To start tracking clicks manually, you don't even need an API integration. Simply drop our JS SDK Snippet onto your frontend. The snippet automatically searches for ?ref= query parameters and stores attribution cookies.

API Authentication Motif

All endpoints require a Bearer token. Grab your Secret Key from the System settings in your Dashboard and send it in the Authorization header. Do not leak this offline.

Error Handling Motif

We return standard HTTP response codes to indicate success or failure.

  • 200 / 201: Success. Payload parsed correctly.
  • 400: Bad Request - Validation issue in the payload body.
  • 401: Unauthorized - Missing or invalid Bearer secret token.
GET/api/v1/referrals

Fetch a paginated list of all active affiliates and their conversion statistics.

POST/api/v1/events

Log an affiliate click/conversion event directly from your backend if you prefer server-side tracking over the client snippet.

cURL Example
curl -X POST https://partners.cleverpoly.store/api/v1/events \
  -H "Authorization: Bearer sk_live_exyz..." \
  -H "Content-Type: application/json" \
  -d '{
    "affiliate_id": "aff_xyz123",
    "event_type": "click",
    "metadata": { "source": "email_campaign" }
  }'

Webhook Integrations

Receive real-time payloads when commissions are generated or payouts are requested so you can process rewards offline.

// Example Payload (Commission Generated)

{
  "type": "commission.created",
  "data": {
    "id": "com_889",
    "stripe_charge_id": "ch_...123",
    "amount": 49.00,
    "affiliate": "aff_xyz123"
  }
}