Query reference sets

The dataSets object lets you get information about the reference sets in your Connect subscription (their names, IDs, the data sets they are linked to and the attributes they contain).

📘

Note

If you need reference set content, there is another query for it. See Get reference set content.

To get the list of all reference sets in your Connect subscription, use a filter based on the data set type.

query  {
  dataSets(filter: [{ field: "type", eq: "REFERENCE_SET" }]) {
    nodes {
      name
      dataSetId
      type
    }
  }
}
{
  "data": {
    "dataSets": {
      "nodes": [
        {
          "name": "Physical Store Clients",
          "dataSetId": "e83a688c-e53e-4a1c-8565-0000000001",
          "type": "REFERENCE_SET"
        },
        {
          "name": "Discount Coupons",
          "dataSetId": "90f06be3-e617-4dff-b1ca-0000000000001",
          "type": "REFERENCE_SET"
        },
        {
          "name": "Store Locations",
          "dataSetId": "271ae741-84b4-429d-abd4-0000000000003",
          "type": "REFERENCE_SET"
        },
        {
          "name": "Order History",
          "dataSetId": "0108995f-317c-43b7-b905-0000000000000",
          "type": "REFERENCE_SET"
        }
      ]
    }
  }
}

To query a particular reference set, add a filter by ID.

query  {
  dataSets(filter: [{ field: "dataSetId", eq: "e83a688c-e53e-4a1c-8565-0000000001" }]) {
    nodes {
      name
      dataSetId
      type
      tracking {
          createdBy
          createdAt
          lastModifiedBy
          lastModifiedAt
        }
      associations {
        to {
          dataSetId
          name
          type
        }
        mappings {
          toAttribute
          fromAttribute
        }
      }
      attributes {
        name
        type
        identifyAs {
          key
          index
        }
      }
    }
  }
}
{
  "data": {
    "dataSets": {
      "nodes": [
        {
          "name": "Order History",
          "dataSetId": "e83a688c-e53e-4a1c-8565-0000000001",
          "type": "REFERENCE_SET",
          "tracking": {
            "createdBy": "[email protected]",
            "createdAt": "2025-03-18T13:02:00.349Z",
            "lastModifiedBy": "[email protected]",
            "lastModifiedAt": "2025-09-09T13:58:53.345Z"
          },
          "associations": [
            {
              "to": {
                "dataSetId": "0108995f-317c-43b7-b905-0000000000000",
                "name": "Discount Coupons",
                "type": "REFERENCE_SET"
              },
              "mappings": [
                {
                  "toAttribute": "Coupon ID",
                  "fromAttribute": "Coupon Used"
                }
              ]
            }
          ],
          "attributes": [
            {
              "name": "Order ID",
              "type": "TEXT",
              "identifyAs": {
                "key": true,
                "index": 0
              }
            },
            {
              "name": "Client ID",
              "type": "TEXT",
              "identifyAs": null
            },
            {
              "name": "Amount",
              "type": "NUMBER",
              "identifyAs": null
            },
            {
              "name": "Date",
              "type": "DATE",
              "identifyAs": null
            },
            {
              "name": "Coupon Used",
              "type": "TEXT",
              "identifyAs": null
            },
            {
              "name": "Return",
              "type": "DATE",
              "identifyAs": null
            },
            {
              "name": "Return Amount",
              "type": "NUMBER",
              "identifyAs": null
            },
            {
              "name": "Online Purchase",
              "type": "BOOLEAN",
              "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's an array of objects.

FieldValuesDefinition
fieldString. Valid values:

- type
- dataSetId
The field to use for filtering
eq- For the type field, use
REFERENCE_SET.
- For the dataSetId field, use the ID of the reference set.
The value that the specified field must be equal to

If you omit the filter, the response will contain all data sets available in your Connect subscription (the audience, the product catalog and behavioral attributes).

Fields

The dataSets query has the nodes array at the top level. The array contains a separate object for each reference set. Here are the fields supported by the objects.

FieldValuesRequired?Description
associationsArray of objectsOptionalIf there are data sets linked to the current reference set, you will get a separate object for each of them.
attributesArray of objectsOptionalReturns a separate object for each attribute in the reference set
dataSetIdIDRequiredThe ID of the reference set (assigned automatically)
nameStringOptionalThe name of the reference set
sizeIntegerOptionalThe size of the reference set
trackingObjectOptionalReturns primary history records for the data set.
typeStringOptionalThe type of the data set

Fields supported by objects within the associations field. All of them are optional.

FieldNested fieldDefinition
todataSetIdThe ID of the data set connected to the current reference set
nameThe name of the data set set connected to the current reference set
typeThe type of the data set connected to the current reference set
mappingsfromAttributeThe attribute in the current reference set linking to the target reference set
toAttributeThe attribute in the target reference set linking to the current reference set

Fields supported by objects within the attributes field

FieldNested fieldValuesRequired?Definition
decimalPrecisionIntegerOptional The number of decimal places after the separator. Applies to numeric attributes.
identifyAskeyBooleanOptional If the value is true, it means this is the key attribute in the reference set.
nameStringRequiredThe name of the attribute
typeOne of the following values:

- TEXT
- NUMBER
- BOOLEAN
- DATE
Optional The data format of the attribute

Fields supported by the tracking object

FieldValuesDefinition
createdAtA date-time string at UTC, such as 2024-08-21T15:46:51.762Z.Shows when the reference set was added to Connect.
createdByStringReturns the name of the user that added the reference set to Connect.
lastModifiedAtA date-time string at UTC, such as 2024-08-21T15:46:51.762Z.Shows when the reference set was modified last time.
lastModifiedByStringReturns the name of the user that modified the reference set last time.