---
updatedAt: 2026-09-04T14:37:34.000Z
---

# Get consent statuses for contacts

Use the `contacts` query to check contacts' consent statuses. The query format depends on the approach your marketing team pursues. Some teams add their contacts to consent groups, others manage consent on the per-channel basis.

# Option A: check statuses per consent group

In this example, we will check the presence in consent groups of the first two contacts. We will request the name, contact key, phone number and email address of each contact.

```graphql Query
query {
  contacts(first: 2) {
    nodes {
      attributes(
        selectByName: ["First Name", "Contact Key", "SMS Phone Number", "Email"]
      ) {
        name
        value
      }
      consent {
        consentGroups {
          id
          channels {
            channel
            status
          }
        }
      }
    }
  }
}
```
```json Response
{
  "data": {
    "contacts": {
      "nodes": [
        {
          "attributes": [
            {
              "name": "First Name",
              "value": "Alice"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242433"
            },
            {
              "name": "SMS Phone Number",
              "value": "+123456789009876"
            },
            {
              "name": "Email",
              "value": "alice@example.com"
            }
          ],
          "consent": {
            "consentGroups": [
              {
                "id": "97660d76-02d8-5fd6-1xx1-0000000000000",
                "channels": [
                  {
                    "channel": "SMS",
                    "status": "OPT_IN"
                  }
                ]
              },
              {
                "id": "97660d76-02d8-5fd6-1xx1-0000000000000",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN"
                  }
                ]
              },
              {
                "id": "97660d76-02d8-5fd6-1xx1-0000000000000",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN"
                  },
                  {
                    "channel": "SMS",
                    "status": "OPT_IN"
                  }
                ]
              },
              {
                "id": "97660d76-02d8-5fd6-1xx1-0000000000000",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN_UNVERIFIED"
                  }
                ]
              }
            ]
          }
        },
        {
          "attributes": [
            {
              "name": "First Name",
              "value": "Rich"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242409"
            },
            {
              "name": "SMS Phone Number",
              "value": "+123456789009876"
            },
            {
              "name": "Email",
              "value": "rich@example.com"
            }
          ],
          "consent": {
            "consentGroups": [
              {
                "id": "97660d76-02d8-5fd6-1xx1-0000000000000",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN"
                  },
                  {
                    "channel": "SMS",
                    "status": "OPT_OUT"
                  }
                ]
              },
              {
                "id": "97660d76-02d8-5fd6-1xx1-0000000000000",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN_UNVERIFIED"
                  }
                ]
              },
              {
                "id": "97660d76-02d8-5fd6-1xx1-0000000000000",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN_UNVERIFIED"
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  }
}
```

Here is how to get consent for a particular **consent group**:

1. Get the IDs of available consent groups if you don't have them yet. For more information, see [Query an audience](https://developer.goacoustic.com/acoustic-connect/reference/get-a-list-of-datasets).

```graphql Query
query {
  dataSets {
    nodes {
      consentGroups {
        name
        id
      }
    }
  }
}
```
```json Response
{
  "data": {
    "dataSets": {
      "nodes": [
        {
          "consentGroups": [
            {
              "name": "Newsletters",
              "id": "97660d76-02d8-5fd6-1aa1-000000000000"
            },
            {
              "name": "Promotions",
              "id": "97660d76-02d8-5fd6-1aa1-000000000000"
            },
            {
              "name": "Information",
              "id": "97660d76-02d8-5fd6-1aa1-000000000000"
            },
            {
              "name": "Custom",
              "id": "97660d76-02d8-5fd6-1aa1-000000000000"
            }
          ]
        }
      ]
    }
  }
}
```

2. Copy the ID of the consent group you need data for.
3. Run the `contacts` query. Submit the ID of the consent group as an argument (`selectById`). In the current example, we will limit the number of results to 2.

```graphql Query
query {
  contacts(first: 2) {
    nodes {
      attributes(
        selectByName: ["First Name", "Contact Key", "SMS Phone Number", "Email"]
      ) {
        name
        value
      }
      consent {
        consentGroups(selectById: ["64317b77-8c30-5fb3-9371-11111ddddd11", "64317b77-8c30-5fb3-9371-11111ddddd11"]) {
          id
          channels {
            channel
            status
          }
        }
      }
    }
  }
}
```
```json Response
{
  "data": {
    "contacts": {
      "nodes": [
        {
          "attributes": [
            {
              "name": "First Name",
              "value": "Alice"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242433"
            },
            {
              "name": "SMS Phone Number",
              "value": "+123456789009876"
            },
            {
              "name": "Email",
              "value": "alice@example.com"
            }
          ],
          "consent": {
            "consentGroups": [
              {
                "id": "64317b77-8c30-5fb3-9371-11111ddddd11",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN"
                  },
                  {
                    "channel": "SMS",
                    "status": "OPT_IN"
                  }
                ]
              },
              {
                "id": "64317b77-8c30-5fb3-9371-11111ddddd11",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN_UNVERIFIED"
                  }
                ]
              }
            ]
          }
        },
        {
          "attributes": [
            {
              "name": "First Name",
              "value": "Rich"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242409"
            },
            {
              "name": "SMS Phone Number",
              "value": "+123456789009876"
            },
            {
              "name": "Email",
              "value": "rich@example.com"
            }
          ],
          "consent": {
            "consentGroups": [
              {
                "id": "64317b77-8c30-5fb3-9371-11111ddddd11",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN_UNVERIFIED"
                  }
                ]
              },
              {
                "id": "64317b77-8c30-5fb3-9371-11111ddddd11",
                "channels": [
                  {
                    "channel": "EMAIL",
                    "status": "OPT_IN"
                  },
                  {
                    "channel": "SMS",
                    "status": "OPT_OUT"
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  }
}
```

# Option B: check consent statuses per channel

In the following example, we will check if the last two contacts in the audience have agreed to receive communication from us.

```graphql Query
query {
  contacts(last: 2) {
    nodes {
      attributes(
        selectByName: ["First Name", "Contact Key", "Email", "SMS Phone Number"]
      ) {
        name
        value
      }
      consent {
        channels {
          channel
          status
        }
      }
    }
  }
}
```
```json Response
{
  "data": {
    "contacts": {
      "nodes": [
        {
          "attributes": [
            {
              "name": "Email",
              "value": "alice@example.com"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242477"
            },
            {
              "name": "First Name",
              "value": "Alice"
            },
            
          ],
          "consent": {
            "channels": [
              {
                "channel": "SMS",
                "status": "OPT_OUT"
              },
              {
                "channel": "EMAIL",
                "status": "OPT_IN"
              }
            ]
          }
        },
        {
          "attributes": [
            {
              "name": "Email",
              "value": "diego@example.com"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242477"
            },
            {
              "name": "First Name",
              "value": "Diego"
            },
            {
              "name": "SMS Phone Number",
              "value": "+12345678900098"
            }
          ],
          "consent": {
            "channels": [
              {
                "channel": "EMAIL",
                "status": "OPT_IN"
              },
              {
                "channel": "SMS",
                "status": "OPT_IN"
              }
            ]
          }
        }
      ]
    }
  }
}
```

To get consent for a particular **channel**, you must submit the name of the channel as an argument. In the current example, we will limit the number of results to 3.

```graphql Query
query {
  contacts(last: 2) {
    nodes {
      attributes(selectByName: ["First Name", "Contact Key", "Email address"]) {
        name
        value
      }
      consent {
        channels(selectByChannel: EMAIL) {
          channel
          status
        }
      }
    }
  }
}
```
```json Response
{
  "data": {
    "contacts": {
      "nodes": [
        {
          "attributes": [
            {
              "name": "First Name",
              "value": "Anna"
            },
            {
              "name": "Email",
              "value": "anna@example.com"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242470"
            }
          ],
          "consent": {
            "channels": [
              {
                "channel": "EMAIL",
                "status": "OPT_IN"
              }
            ]
          }
        },
        {
          "attributes": [
            {
              "name": "First Name",
              "value": "Heather"
            },
            {
              "name": "Email",
              "value": "heather@example.com"
            },
            {
              "name": "Contact Key",
              "value": "PISCX-098724242699"
            }
          ],
          "consent": {
            "channels": [
              {
                "channel": "EMAIL",
                "status": "OPT_IN"
              }
            ]
          }
        }
      ]
    }
  }
}
```

# Arguments

Optional arguments supported by the `contacts` query:

<Table align={["left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Argument
      </th>

      <th>
        Nested field
      </th>

      <th>
        Values
      </th>

      <th>
        Definition
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `orderBy`
      </td>

      <td>
        `field`
      </td>

      <td>
        String
      </td>

      <td>
        Use this argument to sort contacts in the response.

        To get the list of all available contact attributes, use the [Get all contact attributes](https://developer.goacoustic.com/acoustic-connect/reference/get-a-list-of-attributes) query.
      </td>
    </tr>

    <tr>
      <td>

      </td>

      <td>
        `sort`
      </td>

      <td>
        Either of the following values:

        \- `ASC`<br />- `DESC`
      </td>

      <td>
        The sort order to use for contacts in the response
      </td>
    </tr>

    <tr>
      <td>
        `first`
      </td>

      <td>

      </td>

      <td>
        Integer
      </td>

      <td>
        If you don't need the full list of contacts, you can specify how many contacts to return from the beginning of the list.
      </td>
    </tr>

    <tr>
      <td>
        `last`
      </td>

      <td>

      </td>

      <td>
        Integer
      </td>

      <td>
        If you don't need the full list of contacts, you can specify how many contacts to return from the end of the list.
      </td>
    </tr>

    <tr>
      <td>
        `filter`
      </td>

      <td>
        `field`
      </td>

      <td>
        String
      </td>

      <td>
        The name of the contact attribute to use for filtering
      </td>
    </tr>

    <tr>
      <td>

      </td>

      <td>
        `in`
      </td>

      <td>
        Depends on the contact attribute
      </td>

      <td>
        "Is one of the following."
      </td>
    </tr>

    <tr>
      <td>

      </td>

      <td>
        `eq`
      </td>

      <td>
        Depends on the contact attribute
      </td>

      <td>
        "Equals."
      </td>
    </tr>
  </tbody>
</Table>

# Fields

Fields returned by the `contacts` query:

| Field   | Nested field | Required? | Values | Definition                                                                                          |
| :------ | :----------- | :-------- | :----- | :-------------------------------------------------------------------------------------------------- |
| `nodes` | `attributes` | Optional  | Array  | Various contact attributes. For more information, see [Get all contacts](https://developer.goacoustic.com/acoustic-connect/reference/get-list-of-contacts). |
|         | `consent`    | Optional  | Array  | Various consent-related settings                                                                    |

Fields nested into the `consent` field:

<Table align={["left","left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Field
      </th>

      <th>
        Nested field - level 1
      </th>

      <th>
        Nested field - level 2
      </th>

      <th>
        Values
      </th>

      <th>
        Definition
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `channels`
      </td>

      <td>
        `channel`
      </td>

      <td>

      </td>

      <td>
        Either of the following values:

        \- `EMAIL`<br />- `SMS`<br />- `WHATSAPP`<br />- `MOBILE`
      </td>

      <td>
        The type of communication channel
      </td>
    </tr>

    <tr>
      <td>

      </td>

      <td>
        `status`
      </td>

      <td>

      </td>

      <td>
        One of the following values:

        \- `OPT_IN`<br />- `OPT_OUT`<br />- `OPT_IN_UNVERIFIED`
      </td>

      <td>
        Indicates if the contact has agreed to receive communication through the channel.
      </td>
    </tr>

    <tr>
      <td>
        `consentGroups`
      </td>

      <td>
        `id`
      </td>

      <td>

      </td>

      <td>

      </td>

      <td>
        The ID of a consent group that the contact belongs to
      </td>
    </tr>

    <tr>
      <td>

      </td>

      <td>
        `channels`
      </td>

      <td>
        `channel`
      </td>

      <td>
        One of the following values:

        \- `EMAIL`<br />- `SMS`<br />- `WHATSAPP`<br />- `MOBILE`
      </td>

      <td>
        A media channel associated with the consent group
      </td>
    </tr>

    <tr>
      <td>

      </td>

      <td>

      </td>

      <td>
        `status`
      </td>

      <td>
        One of the following values:

        \- `OPT_IN`<br />- `OPT_OUT`<br />- `OPT_IN_UNVERIFIED`
      </td>

      <td>
        The contact's opt-in status in the media channel
      </td>
    </tr>
  </tbody>
</Table>

## Reading addressable values with sms, email, and whatsApp

The `sms`, `email`, and `whatsApp` fields let you read a contact's addressable value alongside its suppression flag — in a single query. These are the only fields that combine the addressable value with `doNotSend`.

```graphql Query
query {
  contacts(first: 2) {
    nodes {
      consent {
        email {
          address
          doNotSend
        }
        sms {
          address
          doNotSend
        }
        whatsApp {
          address
          doNotSend
        }
      }
    }
  }
}
```

Arguments supported by the `channels` field:

<Table align={["left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Argument
      </th>

      <th>
        Values
      </th>

      <th>
        Required?
      </th>

      <th>
        Definition
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `selectByChannel`
      </td>

      <td>
        One of the following values:

        \- `EMAIL`<br />- `SMS`<br />- `WHATSAPP`<br />- `MOBILE`
      </td>

      <td>
        Optional
      </td>

      <td>
        Use this argument to get consent for a particular **channel**
      </td>
    </tr>
  </tbody>
</Table>

Arguments supported by the `consentGroups` field:

<Table align={["left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Argument
      </th>

      <th>
        Values
      </th>

      <th>
        Required?
      </th>

      <th>
        Definition
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `selectById`
      </td>

      <td>
        ID
      </td>

      <td>
        Optional
      </td>

      <td>
        Use this argument to get consent for a particular **consent group**.

        To get all available IDs, use the [Query an audience](https://developer.goacoustic.com/acoustic-connect/reference/get-a-list-of-datasets) query.
      </td>
    </tr>
  </tbody>
</Table>

# Possible error messages

This operation can return several error codes. For the full list, with definitions and the operations each code applies to, see <Anchor target="_blank" href="https://developer.goacoustic.com/acoustic-connect/reference/error-codes">Error codes</Anchor>.