The structure of the audience is defined by its fields. In the Connect user interface they are called contact attributes. The maximum number of contact attributes within an audience is 2000.
query {
dataSets(filter: [{ field: "type", eq: "AUDIENCE" }]) {
nodes {
attributes {
name
type
category
identifyAs {
key
channels
}
}
}
}
}
{
"data": {
"dataSets": {
"nodes": [
{
"attributes": [
{
"name": "Unique ID",
"type": "TEXT",
"category": "Contact information",
"identifyAs": {
"key": true,
"channels": null
}
},
{
"name": "Email Address",
"type": "TEXT",
"category": "Contact information",
"identifyAs": {
"key": null,
"channels": [
"EMAIL"
]
}
},
{
"name": "SMS Phone Number",
"type": "TEXT",
"category": "Contact information",
"identifyAs": {
"key": null,
"channels": [
"SMS"
]
}
},
{
"name": "First Name",
"type": "TEXT",
"category": "Contact information",
"identifyAs": null
},
{
"name": "Opt-In Date",
"type": "DATE",
"category": "Demographic",
"identifyAs": null
}
]
}
]
}
}
}
Running the query
If you haven't used our API before, see Using the Connect API for instructions. It explains how to authenticate your calls and suggests some tools for testing.
Query structure
Arguments
Add the filter
argument to your query. It must contain an object with the following fields.
Field | Values | Definition |
---|---|---|
field | String. Valid value: type . | The field to filter |
eq | String. Valid value:AUDIENCE . | The value that the specified field must be equal to. |
⚠️If you omit this filter, the response will contain reference sets in addition to the audience.
Fields
The query returns the fields nested into the nodes
field
Field | Values | Definition |
---|---|---|
attributes | Array of objects | There is an object for each contact attribute. |
Fields supported by objects within the attributes
field
Field | Nested field | Values | Definition |
---|---|---|---|
name | String! | The name of an attribute | |
type | One of the following values: - TEXT - NUMBER - BOOLEAN - DATE | The data format of an attribute | |
decimalPrecision | Integer from 0 to 14. For non-numeric fields, the value is null . | The number of decimal places displayed. Applies to numeric values only. | |
category | String | The category that an attribute belongs to. Query the dataSetAttributeCategories object to get all available attribute categories. | |
identifyAs | key | Boolean. Valid values: - true . The attribute acts as a key value in the dataset.- false . The attribute is marked as addressable.- null . The attribute is neither a key value, nor an addressable. | Lets you check if an attribute acts as a key value in the dataset or is marked as addressable. 💡The only attribute that can serve as the key value is Contact key. 💡Addressable attributes are Email address and Phone number. A phone number can be associated with the SMS and WhatsApp channels. |
channels | Enumeration. Valid values: - EMAIL - SMS - WHATSAPP | Communication channel. Applies to addressable attributes. 💡A channel can be assigned to only one attribute. |