statsig Segments API

Manage user segments for targeting rules across gates, configs, and experiments.

Operations 5

GET /segments List all segments #
POST /segments Create a segment #
GET /segments/{id} Get a segment #
PATCH /segments/{id} Partially update a segment #
DELETE /segments/{id} Delete a segment #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/statsig-segments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

statsig-segments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Statsig Console Segments API
  description: The Statsig Console API enables developers to programmatically manage their Statsig project configuration.
  version: '20240601'
  contact:
    name: Statsig Support
    url: https://statsig.com/support
  termsOfService: https://statsig.com/terms
servers:
- url: https://statsigapi.net/console/v1
  description: Statsig Console API Server
security:
- consoleApiKey: []
tags:
- name: Segments
  description: Manage user segments for targeting rules across gates, configs, and experiments.
paths:
  /segments:
    get:
      operationId: listSegments
      summary: List all segments
      description: Retrieves a list of all user segments in the project.
      tags:
      - Segments
      parameters:
      - $ref: '#/components/parameters/ApiVersion'
      - $ref: '#/components/parameters/Limit'
      - $ref: '#/components/parameters/Page'
      responses:
        '200':
          description: List of segments
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Segment'
                  pagination:
                    $ref: '#/components/schemas/Pagination'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createSegment
      summary: Create a segment
      description: Creates a new user segment in the project for targeting rules.
      tags:
      - Segments
      parameters:
      - $ref: '#/components/parameters/ApiVersion'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentCreate'
      responses:
        '201':
          description: Segment created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /segments/{id}:
    get:
      operationId: getSegment
      summary: Get a segment
      description: Retrieves the full configuration of a specific user segment.
      tags:
      - Segments
      parameters:
      - $ref: '#/components/parameters/ApiVersion'
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The name or identifier of the segment.
      responses:
        '200':
          description: Segment details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      operationId: partiallyUpdateSegment
      summary: Partially update a segment
      description: Updates specific fields of a user segment.
      tags:
      - Segments
      parameters:
      - $ref: '#/components/parameters/ApiVersion'
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The name or identifier of the segment.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentCreate'
      responses:
        '200':
          description: Segment updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      operationId: deleteSegment
      summary: Delete a segment
      description: Permanently deletes a user segment from the project.
      tags:
      - Segments
      parameters:
      - $ref: '#/components/parameters/ApiVersion'
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The name or identifier of the segment.
      responses:
        '200':
          description: Segment deleted successfully
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error message describing what was wrong with the request.
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error message indicating the resource was not found.
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error message describing the authentication failure.
  parameters:
    Limit:
      name: limit
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 100
      description: Maximum number of items to return per page.
    ApiVersion:
      name: STATSIG-API-VERSION
      in: header
      required: false
      schema:
        type: string
        default: '20240601'
      description: The Console API version. Currently the only version is 20240601.
    Page:
      name: page
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
      description: Page number for paginated results.
  schemas:
    SegmentCreate:
      type: object
      description: Request body for creating a new user segment.
      required:
      - name
      - type
      properties:
        name:
          type: string
          description: The name of the segment to create.
        description:
          type: string
          description: A human-readable description.
        type:
          type: string
          description: The type of segment.
        rules:
          type: array
          items:
            $ref: '#/components/schemas/Rule'
          description: The rules defining segment membership.
        tags:
          type: array
          items:
            type: string
          description: Tags to associate with the segment.
    Pagination:
      type: object
      description: Pagination metadata for list responses.
      properties:
        total:
          type: integer
          description: Total number of items available.
        page:
          type: integer
          description: Current page number.
        limit:
          type: integer
          description: Number of items per page.
        hasMore:
          type: boolean
          description: Whether more pages are available.
    Segment:
      type: object
      description: A user segment defining a group of users for targeting.
      properties:
        id:
          type: string
          description: The unique identifier of the segment.
        name:
          type: string
          description: The name of the segment.
        description:
          type: string
          description: A human-readable description of the segment.
        type:
          type: string
          description: The type of segment (e.g., id_list, rule_based).
        rules:
          type: array
          items:
            $ref: '#/components/schemas/Rule'
          description: The rules defining segment membership.
        tags:
          type: array
          items:
            type: string
          description: Tags associated with the segment.
        createdTime:
          type: integer
          format: int64
          description: Timestamp when the segment was created.
    Rule:
      type: object
      description: A targeting rule that defines conditions under which a gate passes or a config returns specific values.
      properties:
        id:
          type: string
          description: The unique identifier of the rule.
        name:
          type: string
          description: The name of the rule.
        passPercentage:
          type: number
          minimum: 0
          maximum: 100
          description: The percentage of users matching conditions who pass the rule.
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/Condition'
          description: The conditions that must be met for this rule to apply.
        returnValue:
          type: object
          description: The value returned when this rule matches, for dynamic configs.
        environments:
          type: array
          items:
            type: string
          description: Environments where this rule is active.
    Condition:
      type: object
      description: A condition within a targeting rule that evaluates user properties against specified criteria.
      properties:
        type:
          type: string
          enum:
          - user_id
          - email
          - ip_address
          - country
          - app_version
          - custom_field
          - browser_name
          - browser_version
          - os_name
          - os_version
          - passes_gate
          - fails_gate
          - environment
          - passes_segment
          - fails_segment
          - time
          - unit_id
          description: The type of condition to evaluate.
        targetValue:
          description: The value or values to compare against.
        operator:
          type: string
          enum:
          - any
          - none
          - str_starts_with_any
          - str_ends_with_any
          - str_contains_any
          - str_contains_none
          - str_matches
          - gt
          - gte
          - lt
          - lte
          - version_gt
          - version_gte
          - version_lt
          - version_lte
          - before
          - after
          - true
          description: The comparison operator to use.
  securitySchemes:
    consoleApiKey:
      type: apiKey
      in: header
      name: STATSIG-API-KEY
      description: Console API Key created in Project Settings > API Keys tab. Required for all Console API requests.
externalDocs:
  description: Statsig Console API Documentation
  url: https://docs.statsig.com/console-api/