Labels
Labels are key-value pairs that you attach to a Cohort or Snapshot to organize and categorize those resources. Twilio Cohorts does not interpret label values; you can use them operationally, for example, to tag resources by team, environment, or campaign.
1"labels": {2"team": "growth",3"environment": "production"4}
Labels are supported on Cohorts and Snapshots. Operations do not support labels.
Pass a labels object when you create a Cohort or Snapshot. You can update a Cohort's labels later. A Snapshot's labels are fixed upon creation, just like the rest of its immutable data.
The following constraints apply to labels:
- A resource can contain up to 10 label key-value pairs.
- Keys can contain up to 128 characters; values can contain up to 256 characters.
- Allowed characters: letters, numbers, periods (
.), underscores (_), tildes (~), and hyphens (-). - Label values must not be empty strings.
- Label keys must not begin with the
twilio__prefix, which is reserved. - If you omit
labelswhen you create a resource, the field is returned asnullin API responses. - To remove a label from a Cohort, set its value to
nullin an update request.
Pass a labels query parameter to List Cohorts or List Snapshots (see the Cohorts API reference) to filter results by one or more labels.
GET /preview/Cohorts?labels=team:growth,environment:production
Separate multiple labels with commas. When you specify more than one label, the results must match all of the specified criteria.
1curl -X GET 'https://audiences.twilio.com/preview/Cohorts?labels=team:growth,environment:production' \2-u $TWILIO_API_KEY:$TWILIO_API_SECRET
- Learn about Cohorts and Snapshots.
- See the Cohorts API reference.