curl --request POST \
--url https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_ids": [
"<string>"
],
"account_id": "<string>",
"entity": "CAMPAIGN",
"start_date": "<string>",
"end_date": "<string>",
"granularity": "DAY",
"placement": "ALL_ON_TWITTER",
"metric_groups": [],
"country": "<string>"
}
'import requests
url = "https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create"
payload = {
"entity_ids": ["<string>"],
"account_id": "<string>",
"entity": "CAMPAIGN",
"start_date": "<string>",
"end_date": "<string>",
"granularity": "DAY",
"placement": "ALL_ON_TWITTER",
"metric_groups": [],
"country": "<string>"
}
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({
entity_ids: ['<string>'],
account_id: '<string>',
entity: 'CAMPAIGN',
start_date: '<string>',
end_date: '<string>',
granularity: 'DAY',
placement: 'ALL_ON_TWITTER',
metric_groups: [],
country: '<string>'
})
};
fetch('https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create', 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.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create",
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([
'entity_ids' => [
'<string>'
],
'account_id' => '<string>',
'entity' => 'CAMPAIGN',
'start_date' => '<string>',
'end_date' => '<string>',
'granularity' => 'DAY',
'placement' => 'ALL_ON_TWITTER',
'metric_groups' => [
],
'country' => '<string>'
]),
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://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create"
payload := strings.NewReader("{\n \"entity_ids\": [\n \"<string>\"\n ],\n \"account_id\": \"<string>\",\n \"entity\": \"CAMPAIGN\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"granularity\": \"DAY\",\n \"placement\": \"ALL_ON_TWITTER\",\n \"metric_groups\": [],\n \"country\": \"<string>\"\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://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_ids\": [\n \"<string>\"\n ],\n \"account_id\": \"<string>\",\n \"entity\": \"CAMPAIGN\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"granularity\": \"DAY\",\n \"placement\": \"ALL_ON_TWITTER\",\n \"metric_groups\": [],\n \"country\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create")
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 \"entity_ids\": [\n \"<string>\"\n ],\n \"account_id\": \"<string>\",\n \"entity\": \"CAMPAIGN\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"granularity\": \"DAY\",\n \"placement\": \"ALL_ON_TWITTER\",\n \"metric_groups\": [],\n \"country\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyStats-job create
Start an asynchronous stats job for up to 20 entities over up to 90 days (45 if segmented), one placement, optional segmentation. Returns the job id; poll it with adside x stats-job get and download with adside x stats-job-result fetch. Read-like (no spend). Costs 1 request; X allows 100 concurrent jobs per account.
CLI: adside x stats-job create
curl --request POST \
--url https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_ids": [
"<string>"
],
"account_id": "<string>",
"entity": "CAMPAIGN",
"start_date": "<string>",
"end_date": "<string>",
"granularity": "DAY",
"placement": "ALL_ON_TWITTER",
"metric_groups": [],
"country": "<string>"
}
'import requests
url = "https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create"
payload = {
"entity_ids": ["<string>"],
"account_id": "<string>",
"entity": "CAMPAIGN",
"start_date": "<string>",
"end_date": "<string>",
"granularity": "DAY",
"placement": "ALL_ON_TWITTER",
"metric_groups": [],
"country": "<string>"
}
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({
entity_ids: ['<string>'],
account_id: '<string>',
entity: 'CAMPAIGN',
start_date: '<string>',
end_date: '<string>',
granularity: 'DAY',
placement: 'ALL_ON_TWITTER',
metric_groups: [],
country: '<string>'
})
};
fetch('https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create', 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.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create",
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([
'entity_ids' => [
'<string>'
],
'account_id' => '<string>',
'entity' => 'CAMPAIGN',
'start_date' => '<string>',
'end_date' => '<string>',
'granularity' => 'DAY',
'placement' => 'ALL_ON_TWITTER',
'metric_groups' => [
],
'country' => '<string>'
]),
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://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create"
payload := strings.NewReader("{\n \"entity_ids\": [\n \"<string>\"\n ],\n \"account_id\": \"<string>\",\n \"entity\": \"CAMPAIGN\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"granularity\": \"DAY\",\n \"placement\": \"ALL_ON_TWITTER\",\n \"metric_groups\": [],\n \"country\": \"<string>\"\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://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_ids\": [\n \"<string>\"\n ],\n \"account_id\": \"<string>\",\n \"entity\": \"CAMPAIGN\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"granularity\": \"DAY\",\n \"placement\": \"ALL_ON_TWITTER\",\n \"metric_groups\": [],\n \"country\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.adside.ai/v1/workspaces/{workspaceId}/x/stats-job/create")
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 \"entity_ids\": [\n \"<string>\"\n ],\n \"account_id\": \"<string>\",\n \"entity\": \"CAMPAIGN\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"granularity\": \"DAY\",\n \"placement\": \"ALL_ON_TWITTER\",\n \"metric_groups\": [],\n \"country\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
A personal API key (adside_pat_…) or a token from adside login. Either carries the permissions of the person it belongs to.
Path Parameters
1Body
Up to 20 ids of that entity.
1 - 20 elements1X ads account id (e.g. 18ce55xcrlv). Omit it: it defaults to the ads account this workspace is connected to, and any other account is refused.
ACCOUNT, FUNDING_INSTRUMENT, CAMPAIGN, LINE_ITEM, PROMOTED_TWEET, PROMOTED_ACCOUNT, MEDIA_CREATIVE Shortcut for a date range. Default last_7d when no start_date/end_date given.
today, yesterday, last_7d, last_14d, last_30d, this_month, last_month First day, YYYY-MM-DD, in the account's time zone.
^\d{4}-\d{2}-\d{2}$Last day (inclusive), YYYY-MM-DD, in the account's time zone. The exclusive end X wants is computed for you.
^\d{4}-\d{2}-\d{2}$DAY buckets are midnight-to-midnight in the account's time zone; HOUR is hourly; TOTAL is one bucket.
DAY, HOUR, TOTAL One placement per stats request (X accepts a single value). Default ALL_ON_TWITTER; other placements are separate calls.
ALL_ON_TWITTER, PUBLISHER_NETWORK, SPOTLIGHT, TREND X metric groups to request. MOBILE_CONVERSION must be requested alone.
ENGAGEMENT, BILLING, VIDEO, WEB_CONVERSION, MOBILE_CONVERSION, LIFE_TIME_VALUE_MOBILE_CONVERSION One segmentation per job (AGE, GENDER, METROS + country, PLATFORMS, CONVERSION_TAGS). Caps the window at 45 days. CAUTION: since April 2026 segmented jobs often return null metrics or 500s on X's side.
AGE, GENDER, METROS, PLATFORMS, CONVERSION_TAGS Required with segmentation_type METROS.
2Response
Success