Batch API - Segment from REST
This guide provides a walkthrough of how to pull website segments using Batch API
1
⚠️ Limitations
- Supported granularities: daily, monthly- Up to 100 websites / segment IDs / keywords per request
SHELL
curl --request POST \
--url https://api.similarweb.com/batch/v5/request-report \
--header 'accept: application/json' \
--header 'api-key: ADD_YOUR_API_KEY' \
--header 'content-type: application/json' \
--data '
{
"delivery_information": {
"delivery_method": "download_link",
"response_format": "csv"
},
"report_query": {
"tables": [
{
"vtable": "segments",
"start_date": "2022-01",
"end_date": "2022-01",
"granularity": "monthly",
"filters": {
"countries": ["WW"],
"segment_ids": [
"001ccf03-1bb3-468d-a204-b52c10dcd138",
"001ccf03-1bb3-468d-a204-b52c10ffff",
"$PS_1000196669"
]
},
"metrics": [
"segment_total_visits",
"segment_total_unique_visitors",
"segment_total_pages_per_visit",
"segment_total_visit_duration",
"segment_total_page_views",
"segment_total_bounce_rate",
"segment_total_share"
]
}
]
}
}'
2
Select vtable "segments"
SHELL
"vtable": "segments",
3
Add segment IDs
SHELL
"segment_ids": [
"001ccf03-1bb3-468d-a204-b52c10dcd138",
"001ccf03-1bb3-468d-a204-b52c10ffff",
"$PS_1000196669"
4
Select relevant metrics
SHELL
},
"metrics": [
"segment_total_visits",
"segment_total_unique_visitors",
"segment_total_pages_per_visit",
"segment_total_visit_duration",
"segment_total_page_views",
"segment_total_bounce_rate",
JSON
{
"report_id": "845d6440-79d1-4125-964e-eaef0d6923e5",
"status": "pending"
}
Was this section helpful?
On this page
- Batch API - Segment from REST