Refgrow

API Endpoints

Reference for the Refgrow API endpoints.

Overview

The Refgrow API allows you to integrate affiliate functionality directly into your application. This reference documents the available endpoints, required parameters, and response formats.

All API requests require authentication using your API key, which you can find in your program settings under the "API" tab.

Authentication

To authenticate API requests, include your API key in the request headers:

JSON
{
  "Authorization": "Bearer YOUR_API_KEY"
}

Base URL

All API endpoints use the following base URL:

Bash
https://refgrow.com/api/v1

Affiliate Endpoints

GET/affiliates - List Affiliates

Retrieves a list of all affiliates in your program.

Query Parameters

ParameterTypeDescription
limitintegerMaximum number of affiliates to return (default: 20, max: 100)
offsetintegerNumber of affiliates to skip (for pagination)
statusstringFilter affiliates by status (active, pending, blocked)

Response Example

JSON
{
  "success": true,
  "data": {
    "affiliates": [
      {
        "id": "aff_123456",
        "email": "affiliate@example.com",
        "name": "John Doe",
        "status": "active",
        "createdAt": "2023-06-15T10:30:00Z",
        "totalEarnings": 1250.75,
        "pendingEarnings": 350.25,
        "paidEarnings": 900.50,
        "conversionRate": 0.12,
        "clickCount": 1840,
        "conversionCount": 221
      }
    ],
    "total": 45,
    "limit": 20,
    "offset": 0
  }
}

GET/affiliates/:email - Get Affiliate Details

Retrieves detailed information about a specific affiliate by email address.

URL Parameters

ParameterTypeDescription
emailstringThe affiliate's email address

Response Example

JSON
{
  "success": true,
  "data": {
    "affiliate": {
      "id": "aff_123456",
      "email": "affiliate@example.com",
      "name": "John Doe",
      "status": "active",
      "createdAt": "2023-06-15T10:30:00Z",
      "totalEarnings": 1250.75,
      "pendingEarnings": 350.25,
      "paidEarnings": 900.50,
      "conversionRate": 0.12,
      "clickCount": 1840,
      "conversionCount": 221,
      "referralCode": "JOHNDOE10",
      "paymentMethod": "paypal",
      "paymentDetails": "affiliate@example.com"
    }
  }
}

POST/affiliates - Create Affiliate

Creates a new affiliate in your program.

Request Body Parameters

ParameterTypeRequiredDescription
emailstringYesThe affiliate's email address
namestringYesThe affiliate's full name
referralCodestringNoCustom referral code (if not provided, one will be generated)
customFieldsobjectNoAny additional custom data for the affiliate

Response Example

JSON
{
  "success": true,
  "data": {
    "affiliate": {
      "id": "aff_123456",
      "email": "affiliate@example.com",
      "name": "John Doe",
      "status": "active",
      "createdAt": "2023-06-15T10:30:00Z",
      "referralCode": "JOHNDOE10"
    }
  }
}

Referral Endpoints

GET/referrals - List Referrals

Retrieves a list of referrals in your program.

Query Parameters

ParameterTypeDescription
limitintegerMaximum number of referrals to return (default: 20, max: 100)
offsetintegerNumber of referrals to skip (for pagination)

Response Example

JSON
{
  "success": true,
  "data": {
    "referrals": [
      {
        "email": "referred@example.com",
        "referral_code": "JOHNDOE10",
        "affiliate_email": "affiliate@example.com",
        "created_at": "2023-06-18T14:25:30Z"
      }
    ],
    "total": 120,
    "limit": 20,
    "offset": 0
  }
}

POST/referrals - Create Referral

Creates a new referral attribution.

Request Body Parameters

ParameterTypeRequiredDescription
emailstringYesThe referred customer's email address
referral_codestringYesThe affiliate's referral code

Response Example

JSON
{
  "success": true,
  "data": {
    "referral": {
      "email": "referred@example.com",
      "referral_code": "JOHNDOE10",
      "created_at": "2023-06-18T15:10:45Z"
    }
  }
}

GET/referrals/:email - Get Referral by Email

Retrieves referral information for a specific email address.

URL Parameters

ParameterTypeDescription
emailstringThe referred customer's email address

Conversion Endpoints

GET/conversions - List Conversions

Retrieves a list of conversions (registrations and purchases) in your program.

Query Parameters

ParameterTypeDescription
limitintegerMaximum number of conversions to return (default: 20, max: 100)
offsetintegerNumber of conversions to skip (for pagination)

Response Example

JSON
{
  "success": true,
  "data": {
    "conversions": [
      {
        "id": 12345,
        "customer_email": "customer@example.com",
        "amount": 99.99,
        "commission_amount": 20.00,
        "status": "pending",
        "created_at": "2023-06-18T15:10:45Z",
        "referral_code": "JOHNDOE10"
      }
    ],
    "total": 32,
    "limit": 20,
    "offset": 0
  }
}

POST/conversions - Create Conversion

Creates a new conversion record.

Request Body Parameters

ParameterTypeRequiredDescription
customer_emailstringYesThe customer's email address
amountnumberYesThe purchase amount or value of the conversion
referral_codestringNoThe affiliate's referral code (used for attribution if no prior referral exists)

Response Example

JSON
{
  "success": true,
  "data": {
    "conversion": {
      "id": 12345,
      "customer_email": "customer@example.com",
      "amount": 99.99,
      "commission_amount": 20.00,
      "referral_code": "JOHNDOE10",
      "created_at": "2023-06-18T15:10:45Z"
    }
  }
}

Coupon Endpoints

GET/coupons - List Coupons

Retrieves a list of coupons in your program.

Response Example

JSON
{
  "success": true,
  "data": {
    "coupons": [
      {
        "id": 1,
        "code": "PARTNER20",
        "affiliate_email": "affiliate@example.com",
        "discount_type": "percentage",
        "discount_value": 20,
        "created_at": "2023-06-15T10:30:00Z"
      }
    ],
    "total": 10,
    "limit": 20,
    "offset": 0
  }
}

POST/coupons - Create Coupon

Creates a new coupon linked to an affiliate.

Request Body Parameters

ParameterTypeRequiredDescription
codestringYesThe coupon code
affiliate_emailstringYesThe email of the affiliate to link the coupon to

Response Example

JSON
{
  "success": true,
  "data": {
    "coupon": {
      "id": 1,
      "code": "PARTNER20",
      "affiliate_email": "affiliate@example.com",
      "created_at": "2023-06-15T10:30:00Z"
    }
  }
}

Error Responses

When an error occurs, the API will return an appropriate HTTP status code along with a JSON response containing error details:

JSON
{
  "success": false,
  "error": {
    "code": "invalid_request",
    "message": "Invalid affiliate ID format",
    "details": {
      "field": "affiliateId",
      "issue": "must be a string beginning with 'aff_'"
    }
  }
}

Common Error Codes

Error CodeHTTP StatusDescription
authentication_error401Invalid API key or authentication token
permission_denied403The authenticated user doesn't have permission for the requested operation
resource_not_found404The requested resource (affiliate, commission, etc.) doesn't exist
invalid_request400The request parameters are invalid or incomplete
rate_limit_exceeded429You've exceeded the API rate limit
server_error500An internal server error occurred

Next Steps

Start Free Trial
API Endpoints — Refgrow Docs