Skip to main content

Conversions

/api/v1/conversions End Point - reads/writes conversions data from your cbsplit account and return as json data.

Make an api request to conversions endpoint#

http://YOUR_CBSPLIT_HOST/api/v1/conversions

Every request should provide API Key via X-API-Key header.

API will return 100 results per page. Use page param for pagination.

Response#

API will return a JSON object like bellow:

{ entries: [], totalEntries: Number, page: Number, totalPages: Number }

Every entry will have the following structure:

  • id: Integer
  • created_at: UTC Timestamp
  • cart_integration: String (One of clickbank, stickyio, konnektive, buygoods, digistore, svencart)
  • receipt: String
  • original_receipt: String
  • amount: Number
  • tax_amount: Number
  • shipping_amount: Number
  • products: JSON[] [ { "sku": "String", "price": "Number", "qty": "Integer" } ]
  • email: String
  • user_id: String
  • page_id: Integer
  • page_version: String (a to z)
  • upsell_flow_id: String
  • upsell_session: String
  • upsell_path: String
  • upsell_group: String
  • upsell_step: Number
  • country: String (Two letter country code, eg. US, CA)
  • mobile: Boolean (true for conversions from mobile devices)
  • affiliate: String
  • vendor: String
  • role: String
  • tracking_codes: String[] (An array of related tracking codes, eg. [ "easyway", "fundog" ])
  • referrer: String (Referrer URL user came from)
  • referrer_name: String (Referrer name, like Google, Facebook etc.)
  • referrer_medium: String (Referrer medium, like Email, Search, Social etc.)
  • joint_venture_order: String
  • currency: String (Three letter currency code, eg. USD, CAD, EUR)
  • hostname: String
  • utm_source: String
  • utm_medium: String
  • utm_campaign: String
  • utm_content: String
  • first_name: String
  • last_name: String
  • zip_code: String
  • payment_method: String (One of creditcard, paypal)
  • affiliate_payouts: Number[]

API Call Rate Limits#

Maximum 60 Requests Per Minute per IP Address. If limit reached 429 status code returned with an empty body.

Filters#

  • id
  • created_at
  • cart_integration
  • receipt
  • original_receipt
  • amount
  • tax_amount
  • shipping_amount
  • email
  • user_id
  • page_id
  • page_version
  • upsell_path
  • upsell_step
  • country
  • mobile
  • affiliate
  • vendor
  • tracking_codes
  • referrer_name
  • referrer_medium
  • joint_venture_order
  • currency
  • hostname
  • utm_source
  • utm_medium
  • utm_campaign
  • utm_content
  • first_name
  • last_name
  • zip_code
  • payment_method

By default any column will filter by exact value. e.g. { "created_at": "2020-02-03T17:16:00.485Z" } will return entries created at that exact timestamp.

To get entries created after specific time use gt/gte modifier: { "created_at.gt": "2020-02-03" } or { "created_at.gte": "2020-02-03" }

To get entries created before specific time use lt/lte modifier: { "created_at.lt": "2020-02-03" } or { "created_at.lte": "2020-02-03" }

To get entries created within specific timespan use between modifier, providing two comma separated values: { "created_at.between": "2020-02-03,2020-03-03" }

It's also possible to filter by multiple exact values by using in modifier and providing comma separated values: { "country.in": "US,CA" }

This same logic applies to all columns, except Boolean ones. To filter by Boolean columns use t for true and f for false. { "mobile": "t" } or { "mobile": "f" }

Filter Requests Examples#

/api/v1/conversions?created_at.gt=2020-02-03/api/v1/conversions?created_at.between=2020-02-03,2020-03-01/api/v1/conversions?country.in=US,CA&mobile=t

Code Samples#

cURL - Command Line#

Get first 100 results

curl -H "X-API-Key: XXXXXXXXXXXXXXXX" https://YOUR_CBSPLIT_HOST/api/v1/conversions

Get next 100 results

curl -H "X-API-Key: XXXXXXXXXXXXXXXX" https://YOUR_CBSPLIT_HOST/api/v1/conversions?page=2

NodeJs Code#

fetch("https://YOUR_CBSPLIT_HOST/api/v1/conversions", {  method: "get",  headers: {     'X-API-Key': 'XXXXXXXXXXXXXX',    'User-Agent': 'Mozilla/5.0 (compatible; cURL/7.68.0)'  }})  .then(res => res.json())  .then(data => console.log(data))  .catch(err => console.log(err))

PHP Code#

<?php
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://YOUR_CBSPLIT_HOST/api/v1/conversions");$headers = [    'X-API-Key: XXXXXXXXXXXXXX',];curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; cURL/7.68.0)');curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
if(curl_errno($ch)) {    echo "curl error: " . curl_error($ch);} else {    $data = json_decode($response, true);    print_r($data);}curl_close($ch);
?>

Python code#

import requests
url = "https://YOUR_CBSPLIT_HOST/api/v1/conversions"headers = {    "X-API-Key": "XXXXXXXXXXXX",    "User-Agent": "Mozilla/5.0 (compatible; cURL/7.68.0)"}
response = requests.get(url, headers=headers)if response.status_code == 200:    data = response.json()    for obj in data['entries']:        print (obj)else:    print(f"Error: {response.status_code}")

Ruby code#

require 'net/http'require 'uri'
url = URI.parse("https://YOUR_CBSPLIT_HOST/api/v1/conversions")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = (url.scheme == "https")
request = Net::HTTP::Get.new(url.path)request["X-API-Key"] = "xxxxxxxxxxx" # Replace with your actual API keyrequest["User-Agent"] = "Mozilla/5.0 (compatible; cURL/7.68.0)"
response = http.request(request)
puts response.body