TrackReward API Reference
Use this reference to connect a billing system, store, or backend service to a merchant’s TrackReward account without changing the existing API setup.
Base URL: https://trackreward.com
Authentication
- Third-party tracking APIs: use
/api/third-party/v1/tracker/*withaccount_idin the JSON body andX-API-Keyfrom Profile → Settings. - Do not send the API key in browser-side JavaScript. Use these endpoints from your server, billing provider, or backend integration.
Server-to-server tracking
These are separate third-party endpoints. They do not change the existing tracker routes or controller. Send the account ID in the JSON body and the API key from Profile → Settings in the X-API-Key header.
TrackReward uses the account ID to locate the merchant tenant and its configured domain before the request reaches the existing tracking logic. Your third-party service should call the TrackReward API base URL; it does not need to know the tenant database.
X-API-Key: <profile-api-key>
Content-Type: application/json/api/third-party/v1/tracker/get-dataResolve an affiliate code and return campaign tracking details.
/api/third-party/v1/tracker/track-visitRecord a referral visitor and receive tracking cookie data.
/api/third-party/v1/tracker/track-signupRecord a lead or signup.
/api/third-party/v1/tracker/track-saleRecord a SaaS sale and calculate its commission.
/api/third-party/v1/tracker/track-chargeRecord an e-commerce charge and calculate its commission.
API categories
Account and tenant resolution
Every request includes account_id. TrackReward uses it with the API key to locate the merchant, tenant database, and configured domain automatically.
POST /api/third-party/v1/tracker/get-data
Visitor tracking
Records a referral visit and returns the affiliate and tracking data needed for attribution.
POST /api/third-party/v1/tracker/track-visit
Lead and signup tracking
Creates or updates a lead/customer after signup. Identify the customer with email or UID.
POST /api/third-party/v1/tracker/track-signup
SaaS sales tracking
Records a SaaS sale and creates the affiliate commission for the campaign.
POST /api/third-party/v1/tracker/track-sale
E-commerce charge tracking
Records an e-commerce charge and creates the applicable affiliate commission.
POST /api/third-party/v1/tracker/track-charge
Other merchant APIs
Campaign, affiliate, payout, report, and settings APIs currently belong to the authenticated merchant dashboard and are not exposed through this API-key-only third-party layer.
Sales tracking example
Call this from your server after a successful payment. Use either customer_email or customer_uid, and use a unique event value for every sale.
curl -X POST 'https://trackreward.com/api/third-party/v1/tracker/track-sale' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <profile-api-key>' \
-d '{
"account_id": "<account-id>",
"customer_email": "buyer@example.com",
"plan": "pro",
"amount": "49.00",
"event": "order_12345",
"affiliate_code": "AFFILIATE_CODE",
"track_id": "TRACKING_ID",
"quantity": 1
}'Required sale fields are account_id, plan, amount, event, and either customer identifier. Use affiliate_code and track_id, or a valid coupon, to attribute the sale.
Tracking request fields
Get affiliate tracking data
POST /api/third-party/v1/tracker/get-data
Find the affiliate promotion for a merchant website and return campaign tracking details.
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | Merchant Account ID from Profile → Settings. |
account_url | URL | Yes | Merchant website URL, for example https://store.example.com. |
affiliate_code | string | Yes | Affiliate promotion code from the referral link. |
curl -X POST 'https://trackreward.com/api/third-party/v1/tracker/get-data' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <profile-api-key>' \
-d '{
"account_id": "<account-id>",
"account_url": "https://store.example.com",
"affiliate_code": "AFFILIATE_CODE"
}'Track a visit
POST /api/third-party/v1/tracker/track-visit
Record a visitor referred by an affiliate. Save the returned track_id for later signup or sale attribution.
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | Merchant Account ID. |
affiliate_code | string | Yes | Affiliate promotion code. |
page_url | string | Yes | URL visited by the visitor. |
refferrer_url | string | Yes | Referring URL. The API uses this existing spelling. |
track_id | string | No | Your unique visitor or session tracking ID. |
domain | string | No | Visitor website domain. |
cookie_ref_id | string | No | Previously stored referral cookie value. |
cookie_track_id | string | No | Previously stored tracking cookie value. |
curl -X POST 'https://trackreward.com/api/third-party/v1/tracker/track-visit' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <profile-api-key>' \
-d '{
"account_id": "<account-id>",
"affiliate_code": "AFFILIATE_CODE",
"page_url": "https://store.example.com/pricing",
"refferrer_url": "https://affiliate.example.com/review",
"track_id": "visitor_12345",
"domain": "store.example.com"
}'Track a signup
POST /api/third-party/v1/tracker/track-signup
Create a lead/customer record after a visitor registers. Use either customer_email or customer_uid.
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | Merchant Account ID. |
affiliate_code | string | Required unless coupon is sent | Affiliate promotion code. |
track_id | string | Required unless coupon is sent | Track ID returned or created during visit tracking. |
page_url | string | Yes | Signup page URL. |
refferrer_url | string | Yes | Referring URL. |
customer_email | Required if customer_uid is absent | Customer email address. | |
customer_uid | string | Required if customer_email is absent | Customer ID in your platform. |
plan | string | No | Plan selected by the customer. |
coupon | string | No | Coupon code used instead of affiliate_code/track_id attribution. |
curl -X POST 'https://trackreward.com/api/third-party/v1/tracker/track-signup' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <profile-api-key>' \
-d '{
"account_id": "<account-id>",
"affiliate_code": "AFFILIATE_CODE",
"track_id": "visitor_12345",
"page_url": "https://store.example.com/signup",
"refferrer_url": "https://affiliate.example.com/review",
"customer_email": "buyer@example.com",
"customer_uid": "customer_12345",
"plan": "pro"
}'Track a SaaS sale
POST /api/third-party/v1/tracker/track-sale
Record a SaaS subscription or product sale and create the campaign commission.
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | Merchant Account ID. |
affiliate_code | string | Required unless coupon is sent | Affiliate promotion code. |
track_id | string | Required unless coupon is sent | Visitor tracking ID. |
customer_email | Required if customer_uid is absent | Customer email address. | |
customer_uid | string | Required if customer_email is absent | Customer ID in your platform. |
plan | string | Yes | Purchased plan or product name. |
amount | decimal | Yes | Sale amount, minimum 0.50, with two decimal places. |
event | string | Yes | Unique sale or transaction event ID. |
quantity | integer | No | Number of items or subscriptions. |
coupon | string | No | Coupon code used for attribution. |
curl -X POST 'https://trackreward.com/api/third-party/v1/tracker/track-sale' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <profile-api-key>' \
-d '{
"account_id": "<account-id>",
"customer_email": "buyer@example.com",
"customer_uid": "customer_12345",
"plan": "pro",
"amount": "49.00",
"event": "order_12345",
"affiliate_code": "AFFILIATE_CODE",
"track_id": "visitor_12345",
"quantity": 1
}'Track an e-commerce charge
POST /api/third-party/v1/tracker/track-charge
Record an e-commerce payment and create the applicable campaign commission.
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | Merchant Account ID. |
affiliate_code | string | Required unless coupon is sent | Affiliate promotion code. |
track_id | string | Required unless coupon is sent | Visitor tracking ID. |
customer_email | Yes | Customer email address. | |
customer_uid | string | No | Customer ID in your platform. |
page_url | string | Yes | Checkout or order page URL. |
refferrer_url | string | Yes | Referring URL. |
amount | number | Yes | Charge amount, minimum 0.50. |
event | string | Yes | Unique charge or order event ID. |
quantity | integer | No | Number of purchased items. |
coupon | string | No | Coupon code used for attribution. |
curl -X POST 'https://trackreward.com/api/third-party/v1/tracker/track-charge' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <profile-api-key>' \
-d '{
"account_id": "<account-id>",
"customer_email": "buyer@example.com",
"customer_uid": "customer_12345",
"page_url": "https://store.example.com/checkout",
"refferrer_url": "https://affiliate.example.com/review",
"amount": 99.95,
"event": "order_12345",
"affiliate_code": "AFFILIATE_CODE",
"track_id": "visitor_12345",
"quantity": 2
}'Responses and errors
Successful tracking requests return HTTP 200 with a message. Invalid credentials return 401, an unknown account returns 404, and validation failures return 422 with Laravel’s validation error object.
{
"message": "Sales tracked successfully."
}