Skip to main content

Segment membership API

Host: https://app.toggly.io. Authenticate with a Backend application key, not a dashboard OAuth token.

Send the key in Authorization as the raw value or Bearer <key> (same as identity mint).

Backend keys stay on the server

Never ship a Backend application key to a browser or public client. This API has CORS disabled.

Base path: /api/v2/segments

The key identifies the application. There is no applicationId in the route.

Endpoints​

MethodPathPurpose
GET/api/v2/segmentsSummaries the key may update (id, name, environment, itemCount)
GET/api/v2/segments/{segment}/items?skip=0&take=100Paged identifiers
POST/api/v2/segments/{segment}/itemsAdd or update identifiers
DELETE/api/v2/segments/{segment}/itemsRemove identifiers
PUT/api/v2/segments/{segment}/itemsReplace the whole set (max 500 members)

{segment} is the short list id, or a unique list name among lists this key can see. Duplicate names return 409. Unknown or out-of-scope lists return 404.

Request body​

{
"identifiers": ["user-123", "user-456"],
"items": [{ "identifier": "user-123", "description": "beta" }]
}

identifiers and items may be combined. Descriptions are optional. Identifiers are trimmed and stored as sent. Empty identifiers are rejected.

Limits​

LimitValue
Identifiers per request500
Identifiers per list10,000
Identifier length256
Page takemax 500, default 100
Body size512 KiB

Writes that would exceed 10,000 members return 400.

Environment restrictions​

  • Unrestricted Backend key: app-level lists and every environment list on that app.
  • Restricted key: only lists whose environment is in the key’s restriction set. App-level lists (environment null) return 404.

Status codes​

CodeMeaning
200Success
400Validation or limit
401Missing or unknown key
403Key is not Backend
404Segment not visible
409List name is not unique for this key
429Rate limited

Consistency​

Membership is copied into published feature definitions. SDKs see the new set on the next definitions refresh. See Syncing segment membership. Library-specific clients are on each server SDK page.