List Campaign Orders
curl --request GET \
--url https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders \
--header 'x-auth-token: <api-key>'import requests
url = "https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders"
headers = {"x-auth-token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-auth-token': '<api-key>'}};
fetch('https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders', 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://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-auth-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-auth-token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders")
.header("x-auth-token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-auth-token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"_id": "507f1f77bcf86cd799439020",
"cms_id": "ord_12345",
"order_number": "1001",
"total": 89.99,
"items_number": 2,
"paid": true,
"createdAt": "2024-01-15T14:30:00.000Z",
"conversation": {
"_id": "507f1f77bcf86cd799439021",
"phone": "+393331234567"
}
}
],
"pagination": {
"total": 120,
"perPage": 10,
"page": 0
}
}
{
"data": [],
"pagination": {
"total": 0,
"perPage": 10,
"page": 0
}
}
{
"message": "Unauthorized"
}
Analytics API
List Campaign Orders
Get orders attributed to a specific campaign
GET
/
analytics
/
campaigns
/
{campaignId}
/
orders
List Campaign Orders
curl --request GET \
--url https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders \
--header 'x-auth-token: <api-key>'import requests
url = "https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders"
headers = {"x-auth-token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-auth-token': '<api-key>'}};
fetch('https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders', 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://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-auth-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-auth-token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders")
.header("x-auth-token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-ai.textyess.com/analytics/campaigns/{campaignId}/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-auth-token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"_id": "507f1f77bcf86cd799439020",
"cms_id": "ord_12345",
"order_number": "1001",
"total": 89.99,
"items_number": 2,
"paid": true,
"createdAt": "2024-01-15T14:30:00.000Z",
"conversation": {
"_id": "507f1f77bcf86cd799439021",
"phone": "+393331234567"
}
}
],
"pagination": {
"total": 120,
"perPage": 10,
"page": 0
}
}
{
"data": [],
"pagination": {
"total": 0,
"perPage": 10,
"page": 0
}
}
{
"message": "Unauthorized"
}
Overview
The list campaign orders endpoint returns a paginated list of orders attributed to a specific campaign. Use this to see which orders were driven by a given campaign, with optional date range and sorting.Authentication
This endpoint requires a valid JWT token in thex-auth-token header. You can find your token in the Developers section:
x-auth-token: your_jwt_token
Path Parameters
The unique identifier of the campaign (MongoDB ObjectId). Only orders attributed to this campaign are returned.
Query Parameters
Field to sort by:
createdAt, name, title, total_messages, cost, revenue, orders_number, campaign_conversion_rate, average_cart, roas.Response
The response has two top-level keys:data (array of order objects) and pagination. Each order in data includes order fields (e.g. cms_id, order_number, total, items_number, paid, createdAt) and a populated conversation when available.
{
"data": [
{
"_id": "507f1f77bcf86cd799439020",
"cms_id": "ord_12345",
"order_number": "1001",
"total": 89.99,
"items_number": 2,
"paid": true,
"createdAt": "2024-01-15T14:30:00.000Z",
"conversation": {
"_id": "507f1f77bcf86cd799439021",
"phone": "+393331234567"
}
}
],
"pagination": {
"total": 120,
"perPage": 10,
"page": 0
}
}
{
"data": [],
"pagination": {
"total": 0,
"perPage": 10,
"page": 0
}
}
{
"message": "Unauthorized"
}