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
Your Trackly SMS API key. Format: trk_[32-char-hex].
Body Parameters
The 8-character message ID returned when the message was sent. This is the same value passed via the {{sendId}} macro.
Revenue amount to attribute. Must be greater than or equal to 0.
How the revenue was attributed. One of: sale, click, or send.
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.
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
Whether the revenue was recorded successfully.
The unique ID of the created revenue record.
The message ID the revenue was attributed to.
The revenue amount that was recorded.
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"
}'
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())
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 );
201 - Success
400 - Validation Error
400 - Not Found
{
"success" : true ,
"revenue_id" : "67a1b2c3d4e5f6a7b8c9d0e1" ,
"message_id" : "a1b2c3d4" ,
"revenue" : 24.99
}
Error Codes
HTTP Status Error Code Description 400 missing_message_idThe message_id field is required. 400 missing_revenueThe revenue field is required. 400 missing_attribution_typeThe attribution_type field is required. 400 invalid_revenueRevenue must be a number greater than or equal to 0. 400 invalid_attribution_typeMust be one of: sale, click, or send. 400 message_not_foundNo message exists with the given ID.
Next Steps
Revenue Tracking Track and attribute revenue
Send Message Send messages to drive revenue