Skip to main content
POST
/
{brand_id}
/
ai-referrals
/
connections
/
{connection_id}
/
events
Push AI Referrals Events
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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

brand_id
integer
required

The unique identifier for the brand.

connection_id
string
required

The ULID of the AI Referrals connection.

Body

date
string<date>
required

UTC calendar day the metrics cover.

Example:

"2026-05-20"

raw_referrer_value
string
required

Raw referrer value as emitted by the source analytics tool (e.g. 'chatgpt.com'). Normalized server-side against the AI platform allow-list.

Required string length: 1 - 512
Example:

"chatgpt.com"

raw_page_value
string
required

Raw page identifier from the source tool (URL path for GA4-shape tools; page name for Adobe unless a URL eVar is configured).

Required string length: 1 - 2048
Example:

"/blog/launch-notes"

pageviews
integer | null
Required range: x >= 0
sessions
integer | null
Required range: x >= 0
transactions
integer | null
Required range: x >= 0
purchase_revenue
number | null
Required range: x >= 0
batch_id
string | null

Optional client-supplied batch identifier for traceability.

Maximum string length: 128

Response

Batch accepted.

Outcome of a push batch submission.

accepted
integer
required

Number of events accepted into the unified referrals store.

rejected
integer
required

Number of events dropped (e.g. referrer not on the AI platform allow-list).

errors
string[]

Per-row diagnostic messages, truncated.