Create Segment

Reference for the POST /console/v1/segments endpoint of the Statsig API.

posthttps://statsigapi.net/console/v1/segments

Authorizations

STATSIG-API-KEYstringrequired

apiKey (header)

Body

application/json
namestringrequired

name of the segment

Constraints:min length: 3max length: 100pattern: ^[a-zA-Z0-9_\- ]*$
idstring

optional id of the segment (defaults to name)

Constraints:min length: 3max length: 100pattern: ^[a-zA-Z0-9_-]*$
descriptionstring

description of the segment

Constraints:max length: 1000
typestringrequired

type of the segment

Allowed values:id_listrule_basedanalysis_listuser_store_id_list
idTypestring

type of id

Default:userID
tagsstring[]

optional tags for categorization

creatorIDstring

the Statsig ID of the creator of this experiment

Constraints:nullable
creatorEmailstring

the email of the creator of this experiment

Constraints:nullable
teamstring

optional name identifier for the responsible team (enterprise only)

Constraints:nullable
teamIDstring

optional identifier for the responsible team (enterprise only)

Constraints:nullable
rulesobject[]

Rule Object

Show child attributes
namestringrequired

The name of this rule.

passPercentagenumberrequired

Of the users that meet the conditions of this rule, what percent should return true.

Constraints:min: 0max: 100
conditionsobject[]required
targetValueoneOf
Constraints:nullablestring[]number[]stringnumber
operatorstring
fieldstring
Constraints:nullable
customIDstring
Constraints:nullable
typestringrequired
Allowed values:app_versionbrowser_namebrowser_versioncountrycustom_fieldemailenvironment_tierfails_segmentip_addressos_nameos_versionpasses_segmentunit_iduser_id
environmentsstring[]

The environments this rule is enabled for.

Constraints:nullable
idstring

The Statsig ID of this rule.

baseIDstring

The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout

returnValueobject

The return value of the rule.

completedAutomatedRolloutsobject[]

Read-only: Automated rollout phases that have already completed.

timenumber
passPercentnumberrequired
pendingAutomatedRolloutsobject[]

Read-only: Automated rollout phases that are scheduled but not yet complete.

timenumber
passPercentnumberrequired

Response

application/json
201· Create Segment Success
messagestringrequired

A simple string explaining the result of the operation.

dataobjectrequired
Show child attributes
isEnabledbooleanrequired

Is the segment enabled.

typestringrequired
Allowed values:id_listrule_basedanalysis_listuser_store_id_list
countnumber

For id_list segments: the length of the ID list

Constraints:format: double
rulesobject[]

Rule Object

namestringrequired

The name of this rule.

passPercentagenumberrequired

Of the users that meet the conditions of this rule, what percent should return true.

Constraints:min: 0max: 100
conditionsobject[]required

An array of Condition objects.

targetValueoneOf
Constraints:nullablestring[]number[]stringnumber
operatorstring
fieldstring
Constraints:nullable
customIDstring
Constraints:nullable
typestringrequired
Allowed values:app_versionbrowser_namebrowser_versioncountrycustom_fieldemailenvironment_tierfails_gatefails_segmentip_addresslocaleos_nameos_versionpasses_gatepasses_segmentpublictimeunit_iduser_iduser_agenturljavascriptdevice_modeltarget_appexperiment_group
environmentsstring[]

The environments this rule is enabled for.

Constraints:nullable
idstring

The Statsig ID of this rule.

baseIDstring

The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout

returnValueobject

The return value of the rule.

tagsstring[]

Optional tags for categorization.

idstringrequired

ID

namestring

Optional name for the configuration.

idTypestringrequired

Type of ID

descriptionstringrequired

Detailed description of the configuration’s purpose.

lastModifierIDstringrequired

ID of the last modifier.

Constraints:nullable
lastModifiedTimenumberrequired

Time of the last modification.

Constraints:format: doublenullable
lastModifierEmailstringrequired

Email of the last modifier.

Constraints:nullable
lastModifierNamestringrequired

Name of the last modifier.

Constraints:nullable
creatorIDstringrequired

ID of the user who created the entity.

Constraints:nullable
createdTimenumberrequired

Timestamp when the entity was created.

Constraints:format: double
creatorNamestringrequired

Name of the creator.

Constraints:nullable
creatorEmailstringrequired

Email of the creator.

Constraints:nullable
targetAppsstring[]

List of target applications associated with this configuration.

holdoutIDsstring[]

Holdouts applied to this configuration.

teamstring

Optional name for the responsible team.

Constraints:nullable
teamIDstring

Optional ID of the responsible team.

Constraints:nullable
versionnumber

Version number

Constraints:format: double
401· This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx
statusintegerrequired
Allowed values:401
messagestringrequired

Was this helpful?