Skip to main content
POST
/
v2
/
revenue
{
  "success": true,
  "revenue_id": "67a1b2c3d4e5f6a7b8c9d0e1",
  "message_id": "a1b2c3d4",
  "revenue": 24.99
}
Record a single revenue event against a previously sent message. The message is looked up by its 8-character ID. If an offer is not explicitly provided, the system will attempt to resolve it from the message’s short link.

Authentication

X-Api-Key
string
required
Your Trackly SMS API key. Format: trk_[32-char-hex].

Body Parameters

message_id
string
required
The 8-character message ID returned when the message was sent. This is the same value passed via the {{sendId}} macro.
revenue
float
required
Revenue amount to attribute. Must be greater than or equal to 0.
attribution_type
string
required
How the revenue was attributed. One of: sale, click, or send.
offer_id
string
The offer ID this revenue is associated with. Can be either the externalId or the offer ID generated by TracklySMS. If omitted, the system will attempt to resolve the offer from the message’s short link.
timestamp
datetime
ISO 8601 timestamp for the revenue event. Assumed to be UTC if no timezone is provided. Defaults to the current time if omitted.

Response Fields

success
boolean
Whether the revenue was recorded successfully.
revenue_id
string
The unique ID of the created revenue record.
message_id
string
The message ID the revenue was attributed to.
revenue
float
The revenue amount that was recorded.
cURL
curl -X POST https://app.tracklysms.com/api/v2/revenue \
  -H "X-Api-Key: trk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "message_id": "a1b2c3d4",
    "revenue": 24.99,
    "offer_id": "offer_123",
    "attribution_type": "sale",
    "timestamp": "2026-02-08T12:00:00Z"
  }'
Python
import requests

response = requests.post(
    "https://app.tracklysms.com/api/v2/revenue",
    headers={
        "X-Api-Key": "trk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "message_id": "a1b2c3d4",
        "revenue": 24.99,
        "offer_id": "offer_123",
        "attribution_type": "sale",
        "timestamp": "2026-02-08T12:00:00Z",
    },
)

print(response.json())
Node.js
const response = await fetch("https://app.tracklysms.com/api/v2/revenue", {
  method: "POST",
  headers: {
    "X-Api-Key": "trk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    message_id: "a1b2c3d4",
    revenue: 24.99,
    offer_id: "offer_123",
    attribution_type: "sale",
    timestamp: "2026-02-08T12:00:00Z",
  }),
});

const data = await response.json();
console.log(data);
{
  "success": true,
  "revenue_id": "67a1b2c3d4e5f6a7b8c9d0e1",
  "message_id": "a1b2c3d4",
  "revenue": 24.99
}

Error Codes

HTTP StatusError CodeDescription
400missing_message_idThe message_id field is required.
400missing_revenueThe revenue field is required.
400missing_attribution_typeThe attribution_type field is required.
400invalid_revenueRevenue must be a number greater than or equal to 0.
400invalid_attribution_typeMust be one of: sale, click, or send.
400message_not_foundNo message exists with the given ID.

Next Steps

Revenue Tracking

Track and attribute revenue

Send Message

Send messages to drive revenue