Skip to main content
POST
/
segments
/
{id}
cURL
curl -X POST https://api.growthbook.io/api/v1/segment/seg_123abc \
  -d '{"name":"User Region"}' \
  -u secret_abc123DEF456:
{
  "segment": {
    "id": "<string>",
    "owner": "<unknown>",
    "datasourceId": "<string>",
    "identifierType": "<string>",
    "name": "<string>",
    "dateCreated": "<string>",
    "dateUpdated": "<string>",
    "description": "<string>",
    "query": "<string>",
    "managedBy": "",
    "type": "SQL",
    "factTableId": "<string>",
    "filters": [
      "<string>"
    ],
    "projects": [
      "<string>"
    ]
  }
}

Documentation Index

Fetch the complete documentation index at: https://growthbook-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

If using Bearer auth, pass the Secret Key as the token:

curl https://api.growthbook.io/api/v1 \
-H "Authorization: Bearer secret_abc123DEF456"

Path Parameters

id
string
required

The id of the requested resource

Body

application/json
name
string

Name of the segment

description
string

Description of the segment

owner
any
datasourceId
string

ID of the datasource this segment belongs to

identifierType
string

Type of identifier (user, anonymous, etc.)

projects
string[]

List of project IDs for projects that can access this segment

managedBy
enum<string>

Where this Segment must be managed from. If not set (empty string), it can be managed from anywhere.

Available options:
,
api
type
enum<string>

GrowthBook supports two types of Segments, SQL and FACT. SQL segments are defined by a SQL query, and FACT segments are defined by a fact table and filters.

Available options:
SQL,
FACT
query
string

SQL query that defines the Segment. This is required for SQL segments.

factTableId
string

ID of the fact table this segment belongs to. This is required for FACT segments.

filters
string[]

Optional array of fact table filter ids that can further define the Fact Table based Segment.

Response

200 - application/json

Success

segment
object
required