curl --request POST \
--url https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"date": "2026-05-20",
"raw_referrer_value": "chatgpt.com",
"raw_page_value": "/blog/launch-notes",
"pageviews": 1,
"sessions": 1,
"transactions": 1,
"purchase_revenue": 1,
"batch_id": "<string>"
}
]
'import requests
url = "https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events"
payload = [
{
"date": "2026-05-20",
"raw_referrer_value": "chatgpt.com",
"raw_page_value": "/blog/launch-notes",
"pageviews": 1,
"sessions": 1,
"transactions": 1,
"purchase_revenue": 1,
"batch_id": "<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([
{
date: '2026-05-20',
raw_referrer_value: 'chatgpt.com',
raw_page_value: '/blog/launch-notes',
pageviews: 1,
sessions: 1,
transactions: 1,
purchase_revenue: 1,
batch_id: '<string>'
}
])
};
fetch('https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events', 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.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events",
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([
[
'date' => '2026-05-20',
'raw_referrer_value' => 'chatgpt.com',
'raw_page_value' => '/blog/launch-notes',
'pageviews' => 1,
'sessions' => 1,
'transactions' => 1,
'purchase_revenue' => 1,
'batch_id' => '<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.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events"
payload := strings.NewReader("[\n {\n \"date\": \"2026-05-20\",\n \"raw_referrer_value\": \"chatgpt.com\",\n \"raw_page_value\": \"/blog/launch-notes\",\n \"pageviews\": 1,\n \"sessions\": 1,\n \"transactions\": 1,\n \"purchase_revenue\": 1,\n \"batch_id\": \"<string>\"\n }\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.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"date\": \"2026-05-20\",\n \"raw_referrer_value\": \"chatgpt.com\",\n \"raw_page_value\": \"/blog/launch-notes\",\n \"pageviews\": 1,\n \"sessions\": 1,\n \"transactions\": 1,\n \"purchase_revenue\": 1,\n \"batch_id\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events")
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 {\n \"date\": \"2026-05-20\",\n \"raw_referrer_value\": \"chatgpt.com\",\n \"raw_page_value\": \"/blog/launch-notes\",\n \"pageviews\": 1,\n \"sessions\": 1,\n \"transactions\": 1,\n \"purchase_revenue\": 1,\n \"batch_id\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"accepted": 123,
"rejected": 123,
"errors": [
"<string>"
]
}Push AI Referrals Events
Push a batch of pre-aggregated daily AI-referral events for a registered connection.
Accepts application/json (a JSON array of events) or application/x-ndjson (one event per line). The upsert key is (date, raw_referrer_value, raw_page_value) — re-sending the same tuple replaces the prior values, so backfills and corrections are safe to retry.
Limits:
- Maximum 10,000 events per batch.
- Maximum 5 MB request body.
curl --request POST \
--url https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"date": "2026-05-20",
"raw_referrer_value": "chatgpt.com",
"raw_page_value": "/blog/launch-notes",
"pageviews": 1,
"sessions": 1,
"transactions": 1,
"purchase_revenue": 1,
"batch_id": "<string>"
}
]
'import requests
url = "https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events"
payload = [
{
"date": "2026-05-20",
"raw_referrer_value": "chatgpt.com",
"raw_page_value": "/blog/launch-notes",
"pageviews": 1,
"sessions": 1,
"transactions": 1,
"purchase_revenue": 1,
"batch_id": "<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([
{
date: '2026-05-20',
raw_referrer_value: 'chatgpt.com',
raw_page_value: '/blog/launch-notes',
pageviews: 1,
sessions: 1,
transactions: 1,
purchase_revenue: 1,
batch_id: '<string>'
}
])
};
fetch('https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events', 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.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events",
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([
[
'date' => '2026-05-20',
'raw_referrer_value' => 'chatgpt.com',
'raw_page_value' => '/blog/launch-notes',
'pageviews' => 1,
'sessions' => 1,
'transactions' => 1,
'purchase_revenue' => 1,
'batch_id' => '<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.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events"
payload := strings.NewReader("[\n {\n \"date\": \"2026-05-20\",\n \"raw_referrer_value\": \"chatgpt.com\",\n \"raw_page_value\": \"/blog/launch-notes\",\n \"pageviews\": 1,\n \"sessions\": 1,\n \"transactions\": 1,\n \"purchase_revenue\": 1,\n \"batch_id\": \"<string>\"\n }\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.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"date\": \"2026-05-20\",\n \"raw_referrer_value\": \"chatgpt.com\",\n \"raw_page_value\": \"/blog/launch-notes\",\n \"pageviews\": 1,\n \"sessions\": 1,\n \"transactions\": 1,\n \"purchase_revenue\": 1,\n \"batch_id\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrunchai.com/v1/{brand_id}/ai-referrals/connections/{connection_id}/events")
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 {\n \"date\": \"2026-05-20\",\n \"raw_referrer_value\": \"chatgpt.com\",\n \"raw_page_value\": \"/blog/launch-notes\",\n \"pageviews\": 1,\n \"sessions\": 1,\n \"transactions\": 1,\n \"purchase_revenue\": 1,\n \"batch_id\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"accepted": 123,
"rejected": 123,
"errors": [
"<string>"
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier for the brand.
The ULID of the AI Referrals connection.
Body
UTC calendar day the metrics cover.
"2026-05-20"
Raw referrer value as emitted by the source analytics tool (e.g. 'chatgpt.com'). Normalized server-side against the AI platform allow-list.
1 - 512"chatgpt.com"
Raw page identifier from the source tool (URL path for GA4-shape tools; page name for Adobe unless a URL eVar is configured).
1 - 2048"/blog/launch-notes"
x >= 0x >= 0x >= 0x >= 0Optional client-supplied batch identifier for traceability.
128