Skip to contentSkip to navigationSkip to topbar

Fetch a computed trait definition


(new)

Beta

Twilio Cohorts is currently available as a Private Beta product and the information contained in this document is subject to change. You acknowledge and agree that your use of Twilio Cohorts is subject to the terms of the Services in Private Beta(link takes you to an external page). This means that some features are not yet implemented and others may be changed before the product is declared as Generally Available. Private Beta products are not covered by the Twilio Support Terms or Twilio Service Level Agreement.

(warning)

Not a HIPAA Eligible Service or PCI Compliant

Twilio Cohorts is not a HIPAA Eligible Service or PCI compliant and should not be enabled in workflows that are subject to HIPAA or PCI.

GET/preview/ComputedTraitDefinitions/{computedTraitDefinitionId}

Base url: https://audiences.twilio.com (base url)

Used to read parameterSchema before instantiating, so a caller knows which parameters are overridable, within what bounds, and their defaults.


Request

fetch-computed-trait-definition-request page anchor

Path parameters

fetch-computed-trait-definition-path-parameters page anchor
Property nameTypeRequiredDescription
computedTraitDefinitionIdstring
required

The computedTraitDefinitionId identifier


200401403404429500

OK - The computed trait definition

SchemaExample
Property nameTypeRequiredDescriptionChild properties
idstring
read-only

Optional

Identifier of a Twilio-authored computed trait definition: a human-readable slug, stable across environments.

Example: twilio.frequency_capPattern: ^twilio\.[a-z0-9_]+$Max length: 128

displayNamestring

Optional

Human-readable name of the definition

Example: Frequency capMax length: 128

descriptionstring

Optional

What the definition computes

Example: Whether the profile has reached its marketing send cap within the window.Max length: 1024

tagsobject

Optional

Tags for organizing and categorizing resources as key-value pairs.

  • Maximum of 10 key-value pairs
  • Maximum size of a tag key is 128 characters
  • Maximum size of a tag value is 256 characters
  • Keys and values must be non-empty and URL-safe: only unreserved characters (A-Z, a-z, 0-9, -, ., _, ~) are allowed. Tags are echoed back in the tags query parameter of the list endpoints, so anything you can store here can also be filtered on.
  • Keys cannot use the reserved twilio__ prefix
Example: {"environment":"production","campaign":"q1-2026"}Max properties: 10

traitKeystring

Optional

Fully qualified trait key, TraitGroup.traitName. Its format is checked against the store's trait schema rather than a local pattern, so it follows whatever names the store allows.

Example: SendIntelligence.weeklyCapMax length: 256

valueTypeenum<string>

Optional

Type of the value written to the trait. Must match the trait key's type in the store schema.

Example: NUMBERPossible values:
STRINGINTEGERNUMBERBOOLEAN

parameterSchemaarray[object]

Optional

The parameters a computed trait may override, each with its type, bounds, and defaultValue

Max items: 32
Fetch a computed trait definitionLink to code sample: Fetch a computed trait definition
1
curl -X GET "https://audiences.twilio.com/preview/ComputedTraitDefinitions/computedTraitDefinitionId" \
2
-u $TWILIO_API_KEY:$TWILIO_API_SECRET

Response

Note about this response
1
{
2
"id": "twilio.frequency_cap",
3
"displayName": "Frequency cap",
4
"description": "Whether the profile has reached its marketing send cap within the window.",
5
"tags": {},
6
"traitKey": "SendIntelligence.frequencyCapped",
7
"valueType": "BOOLEAN",
8
"parameterSchema": [
9
{
10
"slug": "windowDays",
11
"description": "Rolling window the sends are counted over, in days",
12
"dataType": "NUMBER",
13
"validationRule": {
14
"ruleType": "NUMBER",
15
"min": 1,
16
"max": 365
17
},
18
"required": false,
19
"defaultValue": 7
20
},
21
{
22
"slug": "maxSends",
23
"description": "Sends allowed within the window",
24
"dataType": "NUMBER",
25
"validationRule": {
26
"ruleType": "NUMBER",
27
"min": 1,
28
"max": 100
29
},
30
"required": false,
31
"defaultValue": 5
32
}
33
]
34
}