# Query user preferences (/docs/api-reference/preferences-server-side/get-v1-preferences)

Query preferences for multiple users

## POST /v1/preferences/{partition}/query

```json
{
  "servers": [
    {
      "url": "https://multi-tenant.sombra.transcend.io",
      "description": "Multi-tenant (EU)"
    },
    {
      "url": "https://multi-tenant.sombra.us.transcend.io",
      "description": "Multi-tenant (US)"
    },
    {
      "description": "Self-hosted",
      "url": "https://_yourOrganizationSombraURL_.com"
    },
    {
      "description": "Preference Store in Europe",
      "url": "https://consent.transcend.io"
    },
    {
      "description": "Preference Store in the U.S.",
      "url": "https://consent.us.transcend.io"
    },
    {
      "description": "Rules Automation webhook ingestion (EU)",
      "url": "https://rule-automation.transcend.io"
    },
    {
      "description": "Rules Automation webhook ingestion (US)",
      "url": "https://rule-automation.us.transcend.io"
    }
  ],
  "security": [
    {
      "Transcend_API_Key": [],
      "Sombra_Token": [],
      "Transcend_API_Key_If_Multitenant": []
    }
  ],
  "operation": {
    "summary": "Query user preferences",
    "description": "Query preferences for multiple users\n\n**Rate Limits**\n\n- 3000 requests per organization per minute (default).\n- This limit can be adjusted per organization upon request.\n\n**Rate Limiting Headers**\n\n- `X-RateLimit-Limit`: The maximum number of requests allowed in the current window.\n- `X-RateLimit-Remaining`: The number of requests remaining in the current window.\n- `X-RateLimit-Reset`: The time at which the current rate limit window resets in ISO 8601 format.\n- `Retry-After`: (on 429) The number of seconds to wait before making a new request.\n\n**Querying by Transcend ID**\n\n- Every preference record has a system-managed `transcend` identifier — a stable UUID automatically assigned by the system.\n- Use `{ \"name\": \"transcend\", \"value\": \"<uuid>\" }` in `filter.identifiers` to query by Transcend ID.\n- Transcend ID is returned in all query responses alongside other identifiers.\n- Query multiple records by providing multiple `transcend` entries in the `filter.identifiers` array.\n\n**Per-purpose timestamps**\n\n- Query responses include `purposes[].timestamp` as an ISO 8601 timestamp for each purpose value.\n\n**Source system**\n\n- Query responses may include `purposes[].sourceSystem` when the purpose was last updated with an external system tag for audit purposes.",
    "operationId": "get-v1-preferences",
    "parameters": [
      {
        "$ref": "#/components/parameters/authorization"
      },
      {
        "$ref": "#/components/parameters/x-sombra-authorization"
      },
      {
        "$ref": "#/components/parameters/content-type-application-json"
      },
      {
        "name": "partition",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "description": "The ID of the partition in the Preference Store."
        }
      }
    ],
    "requestBody": {
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "filter": {
                "description": "The filter to apply to the query.",
                "anyOf": [
                  {
                    "type": "object",
                    "description": "Filter by user identifiers",
                    "properties": {
                      "identifiers": {
                        "type": "array",
                        "description": "The list of identifiers, each corresponding to a unique user. Cannot be used in combination with timestampBefore and timestampAfter filters.",
                        "items": {
                          "type": "object",
                          "required": [
                            "value"
                          ],
                          "properties": {
                            "name": {
                              "type": "string",
                              "description": "The identifier name. Defaults to email when not provided.",
                              "default": "email"
                            },
                            "value": {
                              "type": "string",
                              "description": "The unique identifier value used to look up the preference record"
                            }
                          }
                        },
                        "maxItems": 1000
                      }
                    }
                  },
                  {
                    "type": "object",
                    "description": "Filter by when the preference was last updated",
                    "properties": {
                      "timestampAfter": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Filter for preferences updated after a given timestamp."
                      },
                      "timestampBefore": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Filter for preferences updated before a given timestamp."
                      }
                    }
                  },
                  {
                    "type": "object",
                    "description": "Filter by system metadata",
                    "properties": {
                      "system": {
                        "type": "object",
                        "description": "System metadata on the database record.",
                        "properties": {
                          "updatedAfter": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Filter for records updated after a given timestamp. This is when the database record was updated, and NOT when the preference was last updated."
                          },
                          "updatedBefore": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Filter for records updated before a given timestamp. This is when the database record was updated, and NOT when the preference was last updated."
                          }
                        }
                      }
                    }
                  }
                ]
              },
              "limit": {
                "type": "number",
                "description": "Max number of users to return.",
                "default": 10,
                "maximum": 50,
                "minimum": 1
              },
              "cursor": {
                "type": "string",
                "description": "Opaque pagination cursor returned in the `cursor` field of a previous response. Pass it back to fetch the next page of results."
              }
            }
          },
          "examples": {
            "Query for a single user's consent preferences": {
              "value": {
                "filter": {
                  "identifiers": [
                    {
                      "name": "email",
                      "value": "no-track@example.com"
                    }
                  ]
                }
              }
            },
            "Query for multiple users' consent preferences": {
              "value": {
                "filter": {
                  "identifiers": [
                    {
                      "name": "email",
                      "value": "no-track@example.com"
                    },
                    {
                      "name": "email",
                      "value": "pls-no-track@example.com"
                    },
                    {
                      "name": "email",
                      "value": "foo@example.com"
                    },
                    {
                      "name": "phone",
                      "value": "+11234567890"
                    }
                  ]
                }
              }
            },
            "Query for the first 10 users' consent preferences": {
              "value": {
                "limit": 10
              }
            },
            "Using cursor pagination": {
              "value": {
                "cursor": "VGhpcyBpcyBhbiBleGFtcGxlIG9mIGEg...",
                "limit": 10
              }
            },
            "Query for all preferences collected in a given partition during a 24 hours period": {
              "value": {
                "filter": {
                  "timestampAfter": "2023-06-26T21:39:31.677769",
                  "timestampBefore": "2023-06-27T21:39:31.677769"
                }
              }
            },
            "Query for preferences in a partition that were collected after a certain timestamp": {
              "value": {
                "filter": {
                  "timestampAfter": "2023-06-26T21:39:31.677769"
                }
              }
            },
            "Query for all preferences updated in a given partition during a 24 hours period": {
              "value": {
                "filter": {
                  "system": {
                    "updatedAfter": "2024-08-26T21:21:19.677769",
                    "updatedBefore": "2024-08-27T21:21:19.677769"
                  }
                }
              }
            },
            "Query for preferences in a partition that were updated after a certain timestamp": {
              "value": {
                "filter": {
                  "system": {
                    "updatedAfter": "2024-08-26T21:21:19.677769"
                  }
                }
              }
            },
            "Queries with updatedAt with pagination": {
              "value": {
                "filter": {
                  "system": {
                    "updatedBefore": "2024-08-27T21:21:19.677769"
                  }
                },
                "cursor": "VGhpcyBpcyBhbiBleGFtcGxlIG9mIGEg..."
              }
            },
            "Query by Transcend ID": {
              "value": {
                "filter": {
                  "identifiers": [
                    {
                      "name": "transcend",
                      "value": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                    }
                  ]
                }
              }
            },
            "Query by multiple Transcend IDs": {
              "value": {
                "filter": {
                  "identifiers": [
                    {
                      "name": "transcend",
                      "value": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                    },
                    {
                      "name": "transcend",
                      "value": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "security": [
      {
        "Transcend_API_Key": [
          "View Managed Consent Database Admin API"
        ]
      }
    ],
    "responses": {
      "200": {
        "description": "Returns a list of users' preferences",
        "content": {
          "application/json": {
            "schema": {
              "required": [
                "nodes"
              ],
              "type": "object",
              "properties": {
                "nodes": {
                  "type": "array",
                  "uniqueItems": true,
                  "description": "List of all user preference records that match the query filters.",
                  "minItems": 1,
                  "items": {
                    "type": "object",
                    "required": [
                      "identifiers",
                      "partition",
                      "timestamp",
                      "purposes"
                    ],
                    "properties": {
                      "identifiers": {
                        "type": "array",
                        "uniqueItems": true,
                        "items": {
                          "type": "object",
                          "required": [
                            "name",
                            "value"
                          ],
                          "description": "The identifiers associated with the user.",
                          "properties": {
                            "name": {
                              "type": "string",
                              "description": "The identifier name"
                            },
                            "value": {
                              "type": "string",
                              "description": "The identifier value"
                            }
                          }
                        }
                      },
                      "partition": {
                        "type": "string",
                        "description": "The database partition (by default, the ID of your Airgap bundle. You can find this value under Consent Management > Developer Settings)"
                      },
                      "timestamp": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Timestamp of when the preference was originally set by the user."
                      },
                      "purposes": {
                        "type": "array",
                        "description": "A list of all tracking (Consent Management), communication, marketing and custom purposes that the user has opted into or out of, along with any other preferences associated with each purpose.",
                        "items": {
                          "type": "object",
                          "required": [
                            "purpose",
                            "enabled"
                          ],
                          "properties": {
                            "purpose": {
                              "type": "string",
                              "description": "The slug (a unique identifer) of the purpose"
                            },
                            "enabled": {
                              "type": "boolean",
                              "description": "If the purpose was enabled by the user"
                            },
                            "timestamp": {
                              "type": "string",
                              "format": "date-time",
                              "description": "ISO 8601 timestamp for this purpose value.",
                              "examples": [
                                "2026-01-15T12:05:00.000Z"
                              ]
                            },
                            "sourceSystem": {
                              "type": "string",
                              "description": "Optional identifier of the external system that last updated this purpose preference (for example, a CRM or marketing automation platform). Present when the purpose was tagged for audit purposes.",
                              "examples": [
                                "salesforce",
                                "marketo",
                                "custom-crm"
                              ]
                            },
                            "preferences": {
                              "type": "array",
                              "description": "The list of any preferences associated with this purpose",
                              "items": {
                                "type": "object",
                                "required": [
                                  "topic",
                                  "choice"
                                ],
                                "properties": {
                                  "topic": {
                                    "type": "string",
                                    "description": "The slug (a unique identifier) of the preference topic"
                                  },
                                  "choice": {
                                    "type": "object",
                                    "description": "The choice made by the user for this preference topic",
                                    "properties": {
                                      "booleanValue": {
                                        "type": "boolean",
                                        "description": "The boolean value of the preference"
                                      },
                                      "selectValue": {
                                        "type": "string",
                                        "description": "The single select value of the preference"
                                      },
                                      "selectValues": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        },
                                        "description": "The select values (multi-select) of the preference"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "consentManagement": {
                        "type": "object",
                        "description": "Consent management metadata on the preference record.",
                        "properties": {
                          "airgapVersion": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "If this preference was set by the Transcend Consent Manager, Airgap, this is the Airgap.js version that set this preference."
                          },
                          "usp": {
                            "description": "For consent management purposes, the IAB US Privacy (USP) string",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "gpp": {
                            "description": "For consent management purposes, the IAB GPP String, encoding both USP and USNAT",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "tcf": {
                            "description": "For consent management purposes, the IAB TCF String",
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      },
                      "system": {
                        "type": "object",
                        "required": [
                          "decryptionStatus",
                          "updatedAt"
                        ],
                        "description": "System metadata on the database record.",
                        "properties": {
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Timestamp of when the record was last updated in the Preference Store. "
                          },
                          "decryptionStatus": {
                            "type": "string",
                            "enum": [
                              "DECRYPTED",
                              "ERROR"
                            ],
                            "description": "The decryption status of the identifiers field."
                          }
                        }
                      },
                      "metadata": {
                        "description": "The metadata associated with the preference record.",
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "description": "The metadata key"
                            },
                            "value": {
                              "type": "string",
                              "description": "The metadata value"
                            }
                          }
                        }
                      },
                      "metadataTimestamp": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Timestamp of when the metadata was last updated"
                      }
                    }
                  }
                },
                "cursor": {
                  "type": "string",
                  "description": "The cursor for the next page. This is an opaque value that our servers use to track the next page of results."
                }
              }
            },
            "examples": {
              "Response for multiple users' preferences - queried by timestamp": {
                "value": {
                  "nodes": [
                    {
                      "identifiers": [
                        {
                          "name": "transcend",
                          "value": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                        },
                        {
                          "name": "email",
                          "value": "no-track@example.com"
                        },
                        {
                          "name": "phone",
                          "value": "+11234567890"
                        }
                      ],
                      "partition": "ee1a0845-694e-4820-9d51-50c7d0a23467",
                      "timestamp": "2023-04-11T15:09:28.403Z",
                      "purposes": [
                        {
                          "purpose": "Advertising",
                          "enabled": true,
                          "timestamp": "2026-01-15T12:05:00.000Z"
                        },
                        {
                          "purpose": "Analytics",
                          "enabled": true,
                          "timestamp": "2026-01-15T12:05:00.000Z"
                        },
                        {
                          "purpose": "ProductUpdates",
                          "enabled": true,
                          "timestamp": "2026-01-15T12:05:00.000Z",
                          "preferences": [
                            {
                              "topic": "Frequency",
                              "choice": {
                                "selectValue": "Weekly"
                              }
                            },
                            {
                              "topic": "Channel",
                              "choice": {
                                "selectValues": [
                                  "Email",
                                  "Sms"
                                ]
                              }
                            },
                            {
                              "topic": "GoDigital",
                              "choice": {
                                "booleanValue": true
                              }
                            }
                          ]
                        }
                      ],
                      "consentManagement": {
                        "airgapVersion": null,
                        "usp": null,
                        "gpp": null,
                        "tcf": null
                      },
                      "system": {
                        "updatedAt": "2023-06-13T08:02:21.793Z",
                        "decryptionStatus": "DECRYPTED"
                      },
                      "metadata": [
                        {
                          "key": "version",
                          "value": "1.0.0"
                        },
                        {
                          "key": "confirmationTimestamp",
                          "value": "2023-06-13T07:03:12.621Z"
                        }
                      ],
                      "metadataTimestamp": "2023-06-13T08:02:21.793Z"
                    },
                    {
                      "identifiers": [
                        {
                          "name": "transcend",
                          "value": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
                        },
                        {
                          "name": "email",
                          "value": "no-track-pls@example.com"
                        },
                        {
                          "name": "phone",
                          "value": "+11234567891"
                        }
                      ],
                      "partition": "ee1a0845-694e-4820-9d51-50c7d0a23467",
                      "timestamp": "2023-05-11T15:09:28.403Z",
                      "purposes": [
                        {
                          "purpose": "SaleOfInfo",
                          "enabled": false,
                          "timestamp": "2026-01-15T12:05:00.000Z"
                        }
                      ],
                      "consentManagement": {
                        "airgapVersion": null,
                        "gpp": null,
                        "tcf": null,
                        "usp": "1YYN"
                      },
                      "system": {
                        "updatedAt": "2023-06-13T08:02:21.793Z",
                        "decryptionStatus": "DECRYPTED"
                      },
                      "metadata": [
                        {
                          "key": "version",
                          "value": "1.0.0"
                        },
                        {
                          "key": "confirmationTimestamp",
                          "value": "2023-06-13T07:03:12.621Z"
                        }
                      ],
                      "metadataTimestamp": "2023-06-13T08:02:21.793Z"
                    }
                  ]
                }
              },
              "Response for preferences - queried by updatedAt": {
                "value": {
                  "nodes": [
                    {
                      "identifiers": [
                        {
                          "name": "transcend",
                          "value": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                        },
                        {
                          "name": "email",
                          "value": "no-track@example.com"
                        },
                        {
                          "name": "phone",
                          "value": "+11234567892"
                        }
                      ],
                      "partition": "ee1a0845-694e-4820-9d51-50c7d0a23467",
                      "timestamp": "2023-04-11T15:09:28.403Z",
                      "purposes": [
                        {
                          "purpose": "Advertising",
                          "enabled": true,
                          "timestamp": "2026-01-15T12:05:00.000Z"
                        },
                        {
                          "purpose": "Analytics",
                          "enabled": true,
                          "timestamp": "2026-01-15T12:05:00.000Z"
                        },
                        {
                          "purpose": "ProductUpdates",
                          "enabled": true,
                          "timestamp": "2026-01-15T12:05:00.000Z",
                          "preferences": [
                            {
                              "topic": "Frequency",
                              "choice": {
                                "selectValue": "Weekly"
                              }
                            },
                            {
                              "topic": "Channel",
                              "choice": {
                                "selectValues": [
                                  "Email",
                                  "Sms"
                                ]
                              }
                            },
                            {
                              "topic": "GoDigital",
                              "choice": {
                                "booleanValue": true
                              }
                            }
                          ]
                        }
                      ],
                      "consentManagement": {
                        "airgapVersion": null,
                        "usp": null,
                        "gpp": null,
                        "tcf": null
                      },
                      "system": {
                        "updatedAt": "2023-06-13T08:02:21.793Z",
                        "decryptionStatus": "DECRYPTED"
                      },
                      "metadata": [
                        {
                          "key": "version",
                          "value": "1.0.0"
                        },
                        {
                          "key": "confirmationTimestamp",
                          "value": "2023-06-13T07:03:12.621Z"
                        }
                      ],
                      "metadataTimestamp": "2023-06-13T08:02:21.793Z"
                    }
                  ],
                  "cursor": "VGhpcyBpcyBhbiBleGFtcGxlIG9mIGEg..."
                }
              }
            }
          }
        }
      },
      "400": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "examples": [
                    "Missing consent identifier encryption key. Please ensure that your Sombra is configured correctly with a `CONSENT_IDENTIFIER_ENCRYPTION_KEY`.",
                    "Cannot query by more than one of timestamp, updated, or encryptedIdentifiers at the same time",
                    "Invalid value provided for the \"timestampBefore\" or \"timestampAfter\" parameters. Please ensure that the consent timestamps are valid ISO 8601 timestamps.",
                    "Invalid value provided for the \"updatedBefore\" or \"updatedAfter\" parameters. Please ensure that the updated timestamps are valid ISO 8601 timestamps.",
                    "\"startKey\" should have either \"updatedAt\" or \"timestamp\". Please ensure that the \"startKey\" parameter is formatted correctly.",
                    "Payload does not conform to the expected schema",
                    "invalid partition provided. Must be one of the following: [valid_partitions]",
                    "Invalid Preference choice for topic: [topic_name]",
                    "No preference topic found for purpose: [purpose] and topic: [topic]",
                    "Invalid preference type for preference topic: [topic] and purpose: [purpose]",
                    "Invalid preference choice: [choice] for topic: [topic] and purpose: [purpose]",
                    "Invalid preference choices: [choices] for topic: [topic] and purpose: [purpose]",
                    "Each consent preference must have an identifier field.",
                    "All records in the update request must belong to the same partition. Found multiple partitions with ids: [partition_ids]",
                    "[purpose] cannot be updated. Please log in to manage your preferences."
                  ]
                }
              }
            }
          }
        }
      },
      "401": {
        "description": "There was a problem authenticating your request. This may be an issue with the Transcend API key (\"authorization\" header), or the Sombra API key (\"x-sombra-authorization\" header used for self-hosted gateways only).",
        "headers": {},
        "content": {
          "application/json": {
            "schema": {
              "description": "",
              "type": "object",
              "properties": {}
            }
          }
        }
      },
      "413": {
        "description": "The request body is too large. JSON and raw bodies must be less than 50MB. URL encoded bodies must be less than 30MB.",
        "headers": {},
        "content": {
          "application/json": {
            "schema": {
              "description": "",
              "type": "object",
              "properties": {}
            }
          }
        }
      },
      "429": {
        "description": "You are sending requests too quickly and have hit our rate limit. If you hit this, you'll need to throttle your request velocity or try again later.",
        "headers": {
          "Retry-After": {
            "description": "The number of seconds to wait before retrying.",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Limit": {
            "description": "The maximum number of requests allowed in the time window.",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Remaining": {
            "description": "The number of requests remaining in the time window.",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Reset": {
            "description": "The time at which the rate limit will reset.",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "description": "",
              "type": "object",
              "properties": {}
            }
          }
        }
      },
      "500": {
        "description": "A 5xx error means there is either an issue with your self-hosted gateway, or a Transcend server is having issues. You check our system status at status.transcend.io. Please reach out to Transcend support if you're experiencing this error.",
        "headers": {},
        "content": {
          "application/json": {
            "schema": {
              "description": "",
              "type": "object",
              "properties": {}
            }
          }
        }
      },
      "502": {
        "description": "An upstream service on Transcend's side is having issues. You check our system status at status.transcend.io. Please reach out to Transcend support if you're experiencing this error.",
        "headers": {},
        "content": {
          "application/json": {
            "schema": {
              "description": "",
              "type": "object",
              "properties": {}
            }
          }
        }
      }
    },
    "tags": [
      "Preferences (Server-Side)"
    ]
  }
}
```