Count segment members
Number of people matching the segment. Readable with either key type. Attribute-only segments are computed live against the person graph. Segments with events are served from the materialized run and the response says when it was computed.
curl -X GET "https://mythic-analytics.gulp.workers.dev/builder/segments/123e4567-e89b-12d3-a456-426614174000/count?location_id=acme-retail" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
import requests
import json
url = "https://mythic-analytics.gulp.workers.dev/builder/segments/123e4567-e89b-12d3-a456-426614174000/count?location_id=acme-retail"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch("https://mythic-analytics.gulp.workers.dev/builder/segments/123e4567-e89b-12d3-a456-426614174000/count?location_id=acme-retail", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://mythic-analytics.gulp.workers.dev/builder/segments/123e4567-e89b-12d3-a456-426614174000/count?location_id=acme-retail", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://mythic-analytics.gulp.workers.dev/builder/segments/123e4567-e89b-12d3-a456-426614174000/count?location_id=acme-retail')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
response = http.request(request)
puts response.body
{
"count": 128,
"computed_at": "2024-12-25T10:00:00Z",
"stale": true
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Unprocessable Entity",
"message": "The request was well-formed but contains semantic errors",
"code": 422,
"details": [
{
"field": "password",
"message": "Password must be at least 8 characters long"
}
]
}
/segments/{id}/countTarget server for requests. Edit to use your own host.
Builder key as a bearer token. Use an agency key for full CRUD (Bearer ak_...) or a viewer key for read-only access (Bearer sk_...). Scoped keys (mcp_) are accepted too and need segments:read or segments:write. See Using an mcp_ key over HTTP.
Bearer ak_...) or a viewer key for read-only access (Bearer sk_...). Scoped keys (mcp_) are accepted too and need segments:read or segments:write. See Using an mcp_ key over HTTP.Segment UUID.
Client location to scope the request to. Required when authenticating with an agency key (ak_). Ignored for viewer keys (sk_).
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. Builder key as a bearer token. Use an agency key for full CRUD (Bearer ak_...) or a viewer key for read-only access (Bearer sk_...). Scoped keys (mcp_) are accepted too and need segments:read or segments:write. See Using an mcp_ key over HTTP.
Path Parameters
Segment UUID.
Query Parameters
Client location to scope the request to. Required when authenticating with an agency key (ak_). Ignored for viewer keys (sk_).
acme-retailResponses
Segments with events only. When the served membership run was computed.
Segments with events only. true when the run is older than 15 minutes and a recompute was started in the background.