PilotFoxDocs

Create a segment

POST
/api/v1/sites/{siteId}/segments

A named set of filters for this site, or for every site of the organization (scope: org: for unrestricted members whose organization role grants segments:write, and API keys not limited to some sites), private to its creator or public to the organization. API keys create public segments only.

Requires segments:write on the site (an API key, or a signed-in member's role). Share links: 401.

Authorization

headerx-api-key<token>

An organization API key (ak_…), with the permissions and the sites it was created with. For servers and scripts: no cookie and no Origin check. Also accepted as Authorization: Bearer ak_… (apiKeyBearer). A request carries one credential: a key sent with a share token or a live session cookie is 400 (details.reason: ambiguous_credentials).

Scope: segments:write

Path Parameters

siteId*string

Request Body

application/json
  1. body
name*string
Length1 <= length <= 80
description?|null
filters*array<>
Items1 <= items <= 20
isPublic?boolean
Defaultfalse
scope?string
Default"site"
Value in"site""org"

Response Body

Created

application/json
  1. response
data*
Example Request
curl -X POST 'https://pilotfox.app/api/v1/sites/string/segments' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "filters": [    {      "dim": "string",      "op": "eq"    }  ]}'
Example Response201
{  "data": {    "id": "string",    "name": "string",    "description": "string",    "filters": [      {        "dim": "string",        "op": "eq",        "values": []      }    ],    "isPublic": true,    "scope": "site",    "createdBy": "string",    "createdAt": "string",    "updatedAt": "string"  }}