TrackReward Logo

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/* with account_id in the JSON body and X-API-Key from 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
POST /api/third-party/v1/tracker/get-data

Resolve an affiliate code and return campaign tracking details.

POST /api/third-party/v1/tracker/track-visit

Record a referral visitor and receive tracking cookie data.

POST /api/third-party/v1/tracker/track-signup

Record a lead or signup.

POST /api/third-party/v1/tracker/track-sale

Record a SaaS sale and calculate its commission.

POST /api/third-party/v1/tracker/track-charge

Record 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.

ParameterTypeRequiredDescription
account_idstringYesMerchant Account ID from Profile → Settings.
account_urlURLYesMerchant website URL, for example https://store.example.com.
affiliate_codestringYesAffiliate 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.

ParameterTypeRequiredDescription
account_idstringYesMerchant Account ID.
affiliate_codestringYesAffiliate promotion code.
page_urlstringYesURL visited by the visitor.
refferrer_urlstringYesReferring URL. The API uses this existing spelling.
track_idstringNoYour unique visitor or session tracking ID.
domainstringNoVisitor website domain.
cookie_ref_idstringNoPreviously stored referral cookie value.
cookie_track_idstringNoPreviously 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.

ParameterTypeRequiredDescription
account_idstringYesMerchant Account ID.
affiliate_codestringRequired unless coupon is sentAffiliate promotion code.
track_idstringRequired unless coupon is sentTrack ID returned or created during visit tracking.
page_urlstringYesSignup page URL.
refferrer_urlstringYesReferring URL.
customer_emailemailRequired if customer_uid is absentCustomer email address.
customer_uidstringRequired if customer_email is absentCustomer ID in your platform.
planstringNoPlan selected by the customer.
couponstringNoCoupon 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.

ParameterTypeRequiredDescription
account_idstringYesMerchant Account ID.
affiliate_codestringRequired unless coupon is sentAffiliate promotion code.
track_idstringRequired unless coupon is sentVisitor tracking ID.
customer_emailemailRequired if customer_uid is absentCustomer email address.
customer_uidstringRequired if customer_email is absentCustomer ID in your platform.
planstringYesPurchased plan or product name.
amountdecimalYesSale amount, minimum 0.50, with two decimal places.
eventstringYesUnique sale or transaction event ID.
quantityintegerNoNumber of items or subscriptions.
couponstringNoCoupon 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.

ParameterTypeRequiredDescription
account_idstringYesMerchant Account ID.
affiliate_codestringRequired unless coupon is sentAffiliate promotion code.
track_idstringRequired unless coupon is sentVisitor tracking ID.
customer_emailemailYesCustomer email address.
customer_uidstringNoCustomer ID in your platform.
page_urlstringYesCheckout or order page URL.
refferrer_urlstringYesReferring URL.
amountnumberYesCharge amount, minimum 0.50.
eventstringYesUnique charge or order event ID.
quantityintegerNoNumber of purchased items.
couponstringNoCoupon 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."
}