curl --request POST \
--url https://app.trackplay.io/api/v1/conversions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"video_code": "9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34",
"session_code": "3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22",
"conversion_id": "order_10482",
"conversion_value": 297,
"conversion_currency": "USD",
"conversion_product_name": "Pro Annual",
"conversion_customer_email": "buyer@example.com"
}
'import requests
url = "https://app.trackplay.io/api/v1/conversions"
payload = {
"video_code": "9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34",
"session_code": "3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22",
"conversion_id": "order_10482",
"conversion_value": 297,
"conversion_currency": "USD",
"conversion_product_name": "Pro Annual",
"conversion_customer_email": "buyer@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
video_code: '9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34',
session_code: '3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22',
conversion_id: 'order_10482',
conversion_value: 297,
conversion_currency: 'USD',
conversion_product_name: 'Pro Annual',
conversion_customer_email: 'buyer@example.com'
})
};
fetch('https://app.trackplay.io/api/v1/conversions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trackplay.io/api/v1/conversions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'video_code' => '9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34',
'session_code' => '3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22',
'conversion_id' => 'order_10482',
'conversion_value' => 297,
'conversion_currency' => 'USD',
'conversion_product_name' => 'Pro Annual',
'conversion_customer_email' => 'buyer@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trackplay.io/api/v1/conversions"
payload := strings.NewReader("{\n \"video_code\": \"9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34\",\n \"session_code\": \"3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22\",\n \"conversion_id\": \"order_10482\",\n \"conversion_value\": 297,\n \"conversion_currency\": \"USD\",\n \"conversion_product_name\": \"Pro Annual\",\n \"conversion_customer_email\": \"buyer@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.trackplay.io/api/v1/conversions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"video_code\": \"9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34\",\n \"session_code\": \"3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22\",\n \"conversion_id\": \"order_10482\",\n \"conversion_value\": 297,\n \"conversion_currency\": \"USD\",\n \"conversion_product_name\": \"Pro Annual\",\n \"conversion_customer_email\": \"buyer@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trackplay.io/api/v1/conversions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_code\": \"9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34\",\n \"session_code\": \"3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22\",\n \"conversion_id\": \"order_10482\",\n \"conversion_value\": 297,\n \"conversion_currency\": \"USD\",\n \"conversion_product_name\": \"Pro Annual\",\n \"conversion_customer_email\": \"buyer@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"recorded": true,
"conversion_id": "order_10482",
"video_code": "<string>",
"attributed_to_split_test": true
}{
"error": "Video not found in this workspace.",
"video_code": "<string>"
}Record a conversion
Credit a sale to the video that caused it. Send session_code from the player so the conversion joins the play that produced it. Without it, the sale is recorded but cannot be attributed to a viewer.
Requires a token with the conversions:write scope.
Server: https://app.trackplay.io/api/v1
curl --request POST \
--url https://app.trackplay.io/api/v1/conversions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"video_code": "9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34",
"session_code": "3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22",
"conversion_id": "order_10482",
"conversion_value": 297,
"conversion_currency": "USD",
"conversion_product_name": "Pro Annual",
"conversion_customer_email": "buyer@example.com"
}
'import requests
url = "https://app.trackplay.io/api/v1/conversions"
payload = {
"video_code": "9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34",
"session_code": "3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22",
"conversion_id": "order_10482",
"conversion_value": 297,
"conversion_currency": "USD",
"conversion_product_name": "Pro Annual",
"conversion_customer_email": "buyer@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
video_code: '9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34',
session_code: '3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22',
conversion_id: 'order_10482',
conversion_value: 297,
conversion_currency: 'USD',
conversion_product_name: 'Pro Annual',
conversion_customer_email: 'buyer@example.com'
})
};
fetch('https://app.trackplay.io/api/v1/conversions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trackplay.io/api/v1/conversions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'video_code' => '9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34',
'session_code' => '3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22',
'conversion_id' => 'order_10482',
'conversion_value' => 297,
'conversion_currency' => 'USD',
'conversion_product_name' => 'Pro Annual',
'conversion_customer_email' => 'buyer@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trackplay.io/api/v1/conversions"
payload := strings.NewReader("{\n \"video_code\": \"9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34\",\n \"session_code\": \"3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22\",\n \"conversion_id\": \"order_10482\",\n \"conversion_value\": 297,\n \"conversion_currency\": \"USD\",\n \"conversion_product_name\": \"Pro Annual\",\n \"conversion_customer_email\": \"buyer@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.trackplay.io/api/v1/conversions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"video_code\": \"9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34\",\n \"session_code\": \"3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22\",\n \"conversion_id\": \"order_10482\",\n \"conversion_value\": 297,\n \"conversion_currency\": \"USD\",\n \"conversion_product_name\": \"Pro Annual\",\n \"conversion_customer_email\": \"buyer@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trackplay.io/api/v1/conversions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_code\": \"9f2c1a7e-4d3b-4a11-9e77-0b2c5d8e1f34\",\n \"session_code\": \"3b1e5c90-77aa-4f2d-8c31-6de0a9b41c22\",\n \"conversion_id\": \"order_10482\",\n \"conversion_value\": 297,\n \"conversion_currency\": \"USD\",\n \"conversion_product_name\": \"Pro Annual\",\n \"conversion_customer_email\": \"buyer@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"recorded": true,
"conversion_id": "order_10482",
"video_code": "<string>",
"attributed_to_split_test": true
}{
"error": "Video not found in this workspace.",
"video_code": "<string>"
}Authorizations
A scoped token minted in Settings → API tokens. Send it as Authorization: Bearer tplt_… or X-API-Key: tplt_….
Headers
Retry-safe key. The first response for a given key is cached for 24 hours and replayed on a repeat, with Idempotency-Replayed: true set. Send one on every call. A retried payment webhook without it will double count the sale.
Body
The video the sale is credited to. Required. A conversion with no video cannot be attributed to anything.
64The viewer's session. Optional, but without it the sale cannot be joined to the play that caused it, and your play-to-sale rate stays blind to it.
128What happened. Defaults to conversion.
64Your order ID. Defaults to a generated UUID if omitted.
128Sale amount.
x >= 0Three-letter currency code, e.g. USD.
312825525525564Any extra fields you want to keep with the sale.
Marks the row as a test so it can be excluded from reporting.
Send with split_test_variation_id or not at all. One without the other cannot identify an arm, and a half-attributed row looks valid while being wrong.
64Send with split_test_id or not at all.
64When the sale happened. Defaults to now.