Segments
Create segment
Create a new segment.
post/api/v2/segments/{projectKey}/{environmentKey}
Path parameters
projectKeystring string required
The project key
The project key
environmentKeystring string required
The environment key
The environment key
Request body
Example request
{
"name": "Example segment",
"key": "segment-key-123abc",
"description": "Bundle our sample customers together",
"tags": [
"testing"
],
"unboundedContextKind": "device"
}Response
Segment response
Example response
{
"name": "Example segment",
"description": "Bundle our sample customers together",
"tags": [
"testing"
],
"key": "segment-key-123abc",
"included": [
"user-key-123abc"
],
"excluded": [
"user-key-123abc"
],
"rules": [
{
"_id": "1234a56b7c89d012345e678f",
"clauses": [
{
"_id": "12ab3c45de678910fab12345",
"attribute": "email",
"negate": false,
"op": "endsWith",
"values": [
".edu"
]
}
]
}
],
"version": 1,
"_access": {
"denied": [
{
"reason": {
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
],
"effect": "allow"
}
}
],
"allowed": [
{
"reason": {
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
],
"effect": "allow"
}
}
]
},
"_flags": [
{
"name": "Example flag",
"key": "flag-key-123abc"
}
],
"_external": "amplitude",
"_externalLink": "https://analytics.amplitude.com/org/1234/cohort/123abc"
}