Quickstart

Get up and running with the Anderro API in under 5 minutes.

Overview

The Anderro API lets you programmatically manage affiliates in your program. You can register new affiliates, remove them, and receive real-time webhook notifications when events occur.

Step 1: Get your API key

  1. Log in to your Anderro dashboard
  2. Go to Products and select your SaaS product
  3. Navigate to the Integration tab
  4. Copy your Secret Key (starts with sk_)

Keep your key secret

Never expose your secret key in client-side code or public repositories. It grants full API access to your product.

Step 2: Make your first API call

Register an affiliate using a simple POST request:

bash
curl -X POST https://anderro.com/api/v1/affiliates \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_your_secret_key" \
  -d '{
    "email": "[email protected]",
    "name": "Jane Smith"
  }'

You'll receive a response like this:

json
{
  "affiliate": {
    "id": "abc123",
    "email": "[email protected]",
    "name": "Jane Smith",
    "isNew": true
  },
  "partnership": {
    "id": "xyz789",
    "status": "active",
    "referralCode": "jane-smith"
  }
}

Step 3: Set up webhooks (optional)

To receive real-time notifications when affiliates sign up through referral links or generate commissions:

  1. Go to your product's Webhooks tab in the dashboard
  2. Enter your webhook endpoint URL
  3. Select the events you want to receive
  4. Copy the webhook secret for signature verification

See the Webhooks Overview for implementation details.

Record payments with POST /events

Send server-side signup and payment events to /events on your tracking service base URL from the Integration tab. This is separate from the /api/v1 management API. Authenticate with x-api-key: your live secret key records live events, while sk_test_ selects sandbox mode.

POST/events
ParameterTypeDescription
typerequired
stringsignup or payment.
visitorId
stringVisitor ID from the tracking integration. Provide this or customerEmail.
customerEmail
stringCustomer email, trimmed and lowercased. Provide this or visitorId.
amountCents
integerRequired for payments: 1 through 2,147,483,647 cents, inclusive.
externalId
stringYour stable transaction ID, up to 255 characters. Trimmed before use; reuse it for retries of the same payment.
isRenewal
booleanPayment only. true marks a renewal. On a one-time program the event is recorded and no commission is created. false, null, and omission leave commission rules unchanged. Ignored on signup.
bash
curl -X POST "$TRACKING_BASE_URL/events" \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_your_secret_key" \
  -d '{
    "type": "payment",
    "customerEmail": "[email protected]",
    "amountCents": 4900,
    "externalId": "order_123"
  }'

Set TRACKING_BASE_URL to your tracking service URL. A successful request returns 202 with {"ok":true} and queues the event for processing.

Payments with a non-empty externalId are deduplicated per product and mode (live or sandbox). Keep the same ID when retrying a payment; use a new ID for a distinct payment. Payments without externalId are not deduplicated on retry and can create duplicate records and commissions. The maximum accepted payment amount is 2,147,483,647 cents; larger amounts return 400.

Send isRenewal: true only for a renewal payment. On a one-time program that payment is stored and creates no commission. A recurring program still creates a commission. Paddle and SamCart renewals do not use this field.

Next steps