Skip to main content
GET
/
{brand_id}
/
sites
/
{site_id}
/
agent-traffic
Get Agent Traffic
curl --request GET \
  --url https://api.scrunchai.com/v1/{brand_id}/sites/{site_id}/agent-traffic \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.scrunchai.com/v1/{brand_id}/sites/{site_id}/agent-traffic"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.scrunchai.com/v1/{brand_id}/sites/{site_id}/agent-traffic', 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}/sites/{site_id}/agent-traffic",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$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.scrunchai.com/v1/{brand_id}/sites/{site_id}/agent-traffic"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

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.scrunchai.com/v1/{brand_id}/sites/{site_id}/agent-traffic")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.scrunchai.com/v1/{brand_id}/sites/{site_id}/agent-traffic")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "meta": {
    "start_date": "2023-12-25",
    "end_date": "2023-12-25"
  },
  "data": [
    {
      "requests": 123,
      "date": "<string>",
      "site": "<string>",
      "path": "<string>",
      "agent_source": "<string>",
      "agent_type": "<string>"
    }
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

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
site_id
required

The unique identifier of the site to retrieve agent traffic for.

Required string length: 26
Pattern: [0-7][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{25}

Query Parameters

start_date
string<date>
required

Start date for the query range (inclusive). Format: YYYY-MM-DD.

end_date
string<date>
required

End date for the query range (inclusive). Format: YYYY-MM-DD.

fields
string | null

Comma-separated list of dimensions to include in the response. Available dimensions: date, site, path, agent_source, agent_type. If not specified, returns aggregated totals.

time_bucket
enum<string>
default:day

Time aggregation bucket for grouping results. Options: day, week, month. Defaults to day.

Available options:
day,
week
path
string | null

Filter results to a specific URL path or path prefix.

limit
integer
default:10000

Maximum number of rows to return. Use with offset for pagination.

Required range: 1 <= x <= 100000
offset
integer
default:0

Number of rows to skip before returning results. Use with limit for pagination.

Required range: x >= 0

Response

Successful Response

Response containing agent traffic data with metadata and aggregated traffic records.

meta
AgentTrafficMeta · object
required

Query metadata including fields and date range.

data
AgentTrafficRow · object[]
required

Array of agent traffic records matching the query criteria.