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
            }
          ]
        }
      ]
    }
  }
}

Arguments

Add the filter argument to your query. It must contain an object with the following fields.

FieldValuesDefinition
fieldString. Valid value: type.The field to filter
eqString. 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

Nested fieldValuesDefinition
attributesArray of objectsThere is an object for each contact attribute

Fields supported by objects within the attributes field

Nested field - level 1Nested field - level 2ValuesDefinition
nameString!The name of an attribute
typeOne of the following values:

- TEXT
- NUMBER
- BOOLEAN
- DATE
The data format of an attribute
decimalPrecisionInteger from 0 to 14.

For non-numeric fields, the value is null.
The number of decimal places displayed. Applies to numeric values only
category StringThe category that an attribute belongs to.

Query the dataSetAttributeCategories object to get all available attribute categories.
identifyAskeyBoolean

- 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.
channelsEither of the following values:

- EMAIL
- SMSApplies to attributes marked as addressable.
Communication channel. Applies to addressable attributes (the key value for them is false).