PlunkPlunk
API ReferenceSegments

Create segment

Create a new audience segment

POST
/segments

Authorization

ApiKeyAuth

AuthorizationBearer <token>

API Key authentication. Secret keys (sk_*) are required for all endpoints except /v1/track. Public keys (pk_*) only work with the /v1/track endpoint for client-side event tracking. The project is automatically derived from the key.

In: header

Request Body

application/json

name*string
filters*object

Filter conditions

trackMembership?boolean
Defaultfalse

Response Body

application/json

curl -X POST "https://next-api.useplunk.com/segments" \  -H "Content-Type: application/json" \  -d '{    "name": "Premium Users",    "filters": {      "operator": "AND",      "conditions": [        {          "field": "data.plan",          "operator": "equals",          "value": "premium"        }      ]    },    "trackMembership": true  }'
{
  "success": true,
  "data": {
    "id": "string",
    "name": "string",
    "filters": {},
    "trackMembership": true,
    "memberCount": 0
  }
}