curl --request POST \
--url https://api.upstackdata.com/db-mgmt/api/query-attribution \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>' \
--data '
{
"pixelId": "5f1e6a4f-...",
"dimension": "utm_source",
"dateRange": {
"start": "2026-04-01",
"end": "2026-04-30"
},
"attributionModel": "first_click",
"attributionWindow": 30
}
'{
"results": [
{
"dateRange": {
"start": "2026-04-01",
"end": "2026-04-30"
},
"dimension": "<string>",
"data": {
"primary": [
{
"dt": "<string>",
"start": "<string>",
"end": "<string>"
}
],
"compare": [
{
"dt": "<string>",
"start": "<string>",
"end": "<string>"
}
]
},
"measureDetails": [
{
"measure": "<string>",
"isAverage": true,
"isPercentage": true,
"calculatedAverage": true,
"success": true,
"primaryAvg": 123,
"compareAvg": 123,
"primarySum": 123,
"compareSum": 123,
"percentDiff": 123,
"hasPacing": true,
"preferredTrendDirection": "up"
}
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}Run an attribution query
Attribute conversions across marketing touchpoints. Supports first-click, last-click, and any-click models with a fixed-set lookback window.
Required scope: analytics:read.
curl --request POST \
--url https://api.upstackdata.com/db-mgmt/api/query-attribution \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>' \
--data '
{
"pixelId": "5f1e6a4f-...",
"dimension": "utm_source",
"dateRange": {
"start": "2026-04-01",
"end": "2026-04-30"
},
"attributionModel": "first_click",
"attributionWindow": 30
}
'{
"results": [
{
"dateRange": {
"start": "2026-04-01",
"end": "2026-04-30"
},
"dimension": "<string>",
"data": {
"primary": [
{
"dt": "<string>",
"start": "<string>",
"end": "<string>"
}
],
"compare": [
{
"dt": "<string>",
"start": "<string>",
"end": "<string>"
}
]
},
"measureDetails": [
{
"measure": "<string>",
"isAverage": true,
"isPercentage": true,
"calculatedAverage": true,
"success": true,
"primaryAvg": 123,
"compareAvg": 123,
"primarySum": 123,
"compareSum": 123,
"percentDiff": 123,
"hasPacing": true,
"preferredTrendDirection": "up"
}
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}{
"message": "<string>",
"errors": [
{
"message": "<string>",
"key": "<string>",
"path": [
"<string>"
]
}
]
}Authorizations
Your Upstack API key. Starts with upstack_.
The pixel id the request targets.
Body
Must match the x-pixel-id header.
Dimension to attribute by (e.g. utm_source).
Show child attributes
Show child attributes
first_click, last_click, any_click Attribution window in days. -1 means unlimited.
1, 7, 14, 30, 60, 90, -1 Canonical filter applied to the attribution result set.
attribution.utm_* fields and orders.* fields are valid
in this context — discover the full set via
GET /api/filters.
- All of (and)
- Any of (or)
- Not
Show child attributes
Show child attributes
ISO 4217 code to convert money measures to (e.g. EUR). Each
amount converts at the rate for the day it occurred.
Defaults to USD when omitted — if your store sells in
another currency, pass this explicitly.
Source of truth for conversion data.
orders, events Required when valueSource = events. Defaults to purchase
when valueSource = orders.
Order-level query settings — exclusion filters, pending/voided handling.
Show child attributes
Show child attributes
Response
Attribution results.
results is absent when the attribution query couldn't be run — the response is
then an empty object with a 200. Treat a missing results as "no answer", not
as "no conversions": an empty results array is the real no-data case.
Show child attributes
Show child attributes
Was this page helpful?