Skip to main content
POST
cURL

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

The id of the requested resource

Body

application/json
name
string

Name of the segment

owner
string

The userId or email address of the owner. If an email address is provided, it will be used to look up the userId of the matching organization member. If an ID is provided, it will be validated as existing in the organization.

description
string

Description of the segment

Maximum string length: 10000
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

Resource created

segment
object
required