List filter fields
curl --request GET \
--url https://api.upstackdata.com/db-mgmt/api/filters \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>'import requests
url = "https://api.upstackdata.com/db-mgmt/api/filters"
headers = {
"x-api-key": "<api-key>",
"x-pixel-id": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>', 'x-pixel-id': '<api-key>'}};
fetch('https://api.upstackdata.com/db-mgmt/api/filters', 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.upstackdata.com/db-mgmt/api/filters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-pixel-id: <api-key>"
],
]);
$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.upstackdata.com/db-mgmt/api/filters"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-pixel-id", "<api-key>")
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.upstackdata.com/db-mgmt/api/filters")
.header("x-api-key", "<api-key>")
.header("x-pixel-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstackdata.com/db-mgmt/api/filters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
request["x-pixel-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"fields": [
{
"field": "orders.source_name",
"label": "Order source",
"valueType": "string",
"supportedOperators": [
"equals",
"not_equals",
"in",
"not_in",
"contains",
"not_contains",
"starts_with",
"ends_with"
],
"applicableContexts": [
"query_measures",
"cohort_analysis",
"products_report",
"attribution"
]
},
{
"field": "orders.value",
"label": "Order value",
"valueType": "number",
"supportedOperators": [
"equals",
"not_equals",
"greater_than",
"less_than",
"greater_than_or_equals",
"less_than_or_equals",
"in",
"not_in"
],
"applicableContexts": [
"query_measures",
"cohort_analysis",
"products_report",
"attribution"
]
},
{
"field": "events.event_name",
"label": "Event name",
"description": "Scope tracked-event measures to a single event name.",
"valueType": "string",
"supportedOperators": [
"equals",
"not_equals",
"in",
"not_in",
"contains",
"not_contains",
"starts_with",
"ends_with"
],
"applicableContexts": [
"query_measures"
]
}
]
}CATALOG
List filter fields for analytics queries
List every field you can filter analytics queries by, with its value type, the operators it accepts, and the query endpoints that support it.
GET
/
db-mgmt
/
api
/
filters
List filter fields
curl --request GET \
--url https://api.upstackdata.com/db-mgmt/api/filters \
--header 'x-api-key: <api-key>' \
--header 'x-pixel-id: <api-key>'import requests
url = "https://api.upstackdata.com/db-mgmt/api/filters"
headers = {
"x-api-key": "<api-key>",
"x-pixel-id": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>', 'x-pixel-id': '<api-key>'}};
fetch('https://api.upstackdata.com/db-mgmt/api/filters', 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.upstackdata.com/db-mgmt/api/filters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-pixel-id: <api-key>"
],
]);
$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.upstackdata.com/db-mgmt/api/filters"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-pixel-id", "<api-key>")
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.upstackdata.com/db-mgmt/api/filters")
.header("x-api-key", "<api-key>")
.header("x-pixel-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upstackdata.com/db-mgmt/api/filters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
request["x-pixel-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"fields": [
{
"field": "orders.source_name",
"label": "Order source",
"valueType": "string",
"supportedOperators": [
"equals",
"not_equals",
"in",
"not_in",
"contains",
"not_contains",
"starts_with",
"ends_with"
],
"applicableContexts": [
"query_measures",
"cohort_analysis",
"products_report",
"attribution"
]
},
{
"field": "orders.value",
"label": "Order value",
"valueType": "number",
"supportedOperators": [
"equals",
"not_equals",
"greater_than",
"less_than",
"greater_than_or_equals",
"less_than_or_equals",
"in",
"not_in"
],
"applicableContexts": [
"query_measures",
"cohort_analysis",
"products_report",
"attribution"
]
},
{
"field": "events.event_name",
"label": "Event name",
"description": "Scope tracked-event measures to a single event name.",
"valueType": "string",
"supportedOperators": [
"equals",
"not_equals",
"in",
"not_in",
"contains",
"not_contains",
"starts_with",
"ends_with"
],
"applicableContexts": [
"query_measures"
]
}
]
}Required scope:
On the attribution endpoint,
analytics:read
Call this before you build a filters body. For each field it tells you which
endpoints accept it (applicableContexts), which operators it supports, and whether
value is a string or a number. A filter that breaks any of those rules is rejected
before the query runs.
The catalog is the same for every pixel and doesn’t depend on your data, so you can
cache it.
Building a filter from the catalog
- The top level of
filtersis always a group:and,or, ornot. Wrap even a single condition in one. - Each condition is
{ "field", "op", "value" }, using afieldfrom this list and anopfrom itssupportedOperators. in,not_in, and thearray_includes*operators take an array with at least one item. Other operators take a single value. Empty strings are rejected.- Groups nest up to three levels deep.
{
"and": [
{ "field": "orders.customer_type", "op": "equals", "value": "new_customer" },
{ "not": { "field": "orders.source_name", "op": "in", "value": ["pos"] } }
]
}
Which endpoints accept a field
applicableContexts value | Endpoint |
|---|---|
query_measures | Run an analytics query |
cohort_analysis | Run a cohort analysis |
attribution | Run an attribution query |
channel_details | List channel entities |
query_ads | List ads with metrics |
attribution.* fields run as exact matches whatever
operator you send, so use equals or in there. See
Filtering results.
Related
- List available measures, the matching catalog for measure ids.
upstack filtersprints this catalog from the CLI.
Was this page helpful?