curl --request GET \
--url https://api.portkey.ai/v1/analytics/groups/users \
--header 'x-portkey-api-key: <api-key>'import requests
url = "https://api.portkey.ai/v1/analytics/groups/users"
headers = {"x-portkey-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-portkey-api-key': '<api-key>'}};
fetch('https://api.portkey.ai/v1/analytics/groups/users', 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.portkey.ai/v1/analytics/groups/users",
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-portkey-api-key: <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.portkey.ai/v1/analytics/groups/users"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-portkey-api-key", "<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.portkey.ai/v1/analytics/groups/users")
.header("x-portkey-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.portkey.ai/v1/analytics/groups/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-portkey-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"object": "list",
"total": 123,
"data": [
{
"user": "<string>",
"requests": "<string>",
"cost": "<string>",
"object": "analytics-group"
}
]
}Get User Grouped Data
curl --request GET \
--url https://api.portkey.ai/v1/analytics/groups/users \
--header 'x-portkey-api-key: <api-key>'import requests
url = "https://api.portkey.ai/v1/analytics/groups/users"
headers = {"x-portkey-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-portkey-api-key': '<api-key>'}};
fetch('https://api.portkey.ai/v1/analytics/groups/users', 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.portkey.ai/v1/analytics/groups/users",
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-portkey-api-key: <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.portkey.ai/v1/analytics/groups/users"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-portkey-api-key", "<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.portkey.ai/v1/analytics/groups/users")
.header("x-portkey-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.portkey.ai/v1/analytics/groups/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-portkey-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"object": "list",
"total": 123,
"data": [
{
"user": "<string>",
"requests": "<string>",
"cost": "<string>",
"object": "analytics-group"
}
]
}Portkey is now PRISMA AIRS AI Gateway. See it in action.
Authorizations
Query Parameters
Workspace slug filter. If a workspace API key is being used, this filter will not be taken into consideration. If an organisation API key is used and no workspace slug is passed, default workspace will be used.
When true, returns data aggregated across all workspaces in the organisation. Only takes effect for organisation API keys; ignored for workspace API keys, which are already scoped to a single workspace. Do not combine with workspace_slug — if workspace_slug is present, it takes precedence and this parameter is ignored. One of workspace_slug, include_all_workspaces, or exclude_workspace_slugs is required.
Comma separated workspace slugs to exclude. Behaves like include_all_workspaces (aggregates across all workspaces) but filters out the listed slugs. Only takes effect for organisation API keys; ignored for workspace API keys. Do not combine with workspace_slug — if workspace_slug is present, it takes precedence and this parameter is ignored. One of workspace_slug, include_all_workspaces, or exclude_workspace_slugs is required.
Minimum time of generation in ISO8601 format (YYYY-MM-DDTHH:MM:SS±HH:MM).
"2026-02-23T14:20:31+05:30"
Maximum time of generation in ISO8601 format (YYYY-MM-DDTHH:MM:SS±HH:MM).
"2026-02-24T14:20:31+05:30"
Minimum total units (tokens)
x >= 0Maximum total units (tokens)
x >= 0Minimum cost (in cents)
x >= 0Maximum cost (in cents)
x >= 0Minimum number of prompt tokens
x >= 0Maximum number of prompt tokens
x >= 0Minimum number of completion tokens
x >= 0Maximum number of completion tokens
x >= 0Comma separated response status codes
Minimum weighted feedback score
-10 <= x <= 10Maximum weighted feedback score
-10 <= x <= 10Comma separated virtual key slugs
Comma separated config slugs
Comma separated API key UUIDs
Current page number
x >= 0Number of items per page
x >= 0Stringifed json object with key value metadata pairs
Comma separated ai provider and model combination. Double underscore (__) should be used as a separator for each provider and model combination
Comma separated list of deployment IDs (UUIDs) to filter by.
Comma separated trace IDs
Comma separated span IDs
Comma separated prompt slugs
Was this page helpful?

