Skip to Content
Segments

Create Segment

POST
/v0/projects/{idOrSlug}/segments

Authorization

apiKeyAuth
headerx-api-key<token>

FastStats API key. Pass it in the x-api-key header or as a Bearer token in the Authorization header.

Path Parameters

idOrSlug*string

Request Body

application/json
  1. body
key*string
name*string
description?string|null|null
type*string
Value in"dynamic""static"
definition*
members*array<>

Response Body

SegmentRecord

application/json
  1. response
id*string
projectId*string
key*string
name*string
description*string|null
type*string
Value in"dynamic""static"
definition*
members*array<>
flagCompatible*boolean
usedBy*
createdAt*string
updatedAt*string
Example Request
curl -X POST 'https://api.faststats.dev/v0/projects/string/segments' \
  -H 'Content-Type: application/json' \
  -d '{
  "key": "string",
  "name": "string",
  "type": "dynamic",
  "definition": {
    "type": "group",
    "match": "all",
    "negate": true,
    "children": [
      {}
    ]
  },
  "members": [
    {
      "kind": "identifier",
      "value": "string",
      "excluded": true
    }
  ]
}'
Example Response
{
  "id": "string",
  "projectId": "string",
  "key": "string",
  "name": "string",
  "description": "string",
  "type": "dynamic",
  "definition": {
    "type": "group",
    "match": "all",
    "negate": true,
    "children": [
      {}
    ]
  },
  "members": [
    {
      "kind": "identifier",
      "value": "string",
      "excluded": true
    }
  ],
  "flagCompatible": true,
  "usedBy": {
    "segments": [
      "string"
    ],
    "flags": [
      "string"
    ]
  },
  "createdAt": "string",
  "updatedAt": "string"
}