Get segments
curl --request GET \
--url https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments \
--header 'Authorization: <authorization>'import requests
url = "https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments', 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://appex.userpilot.io/api/v1/analytics/exports/lookups/segments",
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: <authorization>"
],
]);
$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://appex.userpilot.io/api/v1/analytics/exports/lookups/segments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": 101,
"title": "Active Users",
"usage": "all",
"category": "user_id",
"is_hidden": false,
"is_protected": false,
"status": "published"
}
],
"metadata": {
"cursor": {
"after": "...",
"before": null
},
"limit": 50,
"total_count": 1
}
}Lookups
Segments
List all user segments with their IDs and names for filtering analytics exports by specific audience groups.
GET
/
api
/
v1
/
analytics
/
exports
/
lookups
/
segments
Get segments
curl --request GET \
--url https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments \
--header 'Authorization: <authorization>'import requests
url = "https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments', 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://appex.userpilot.io/api/v1/analytics/exports/lookups/segments",
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: <authorization>"
],
]);
$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://appex.userpilot.io/api/v1/analytics/exports/lookups/segments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://appex.userpilot.io/api/v1/analytics/exports/lookups/segments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": 101,
"title": "Active Users",
"usage": "all",
"category": "user_id",
"is_hidden": false,
"is_protected": false,
"status": "published"
}
],
"metadata": {
"cursor": {
"after": "...",
"before": null
},
"limit": 50,
"total_count": 1
}
}Headers
API authentication token in the format: Token {{API_KEY}}. Obtain your API key from the Userpilot Environment Settings.
Was this page helpful?
āI