---
title: "Query contacts"
method: POST
path: "/v1/contacts/query"
tags: ["Contacts"]
---

# Query contacts

`POST /v1/contacts/query`

## Request

- Base URL: `https://api.squarespace.com`
- URL: `https://api.squarespace.com/v1/contacts/query`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/squarespace/apis/commerce-api/docs/v1/contacts/query/post.ts> (a function with typed inputs; its response is checked against the schema)

Returns a paginated list of contacts matching filters and sort options in the request body. Requires OAuth website scope website.contacts.read or website.contacts, or API key scope CONTACT_READONLY or CONTACT, or OAuth website scope website.profiles.read or website.profiles (OAuth only).

## Headers

- `Authorization` string, required
- `User-Agent` string, required

## Request body

- QueryContactsRequest
  - `acceptsMarketingWithDate` AcceptsMarketingWithDate: Contact's marketing settings with joined on date
    - `acceptsMarketing` boolean: If contact's email accepts marketing
    - `joinedOn` DateFilter: Object for filtering by before and after dates
      - `after` string, date-time: Filter out any dates after
      - `before` string, date-time: Filter out any dates before
  - `cursor` string: The cursor for the next page of results. Use the value of `pagination.nextPageCursor` from the previous response.
  - `donationAmount` IntegerFilter: Object for filtering by a min and max integer
    - `max` integer: Filter out any numbers greater
    - `min` integer: Filter out any numbers lower
  - `donationCount` IntegerFilter: Object for filtering by a min and max integer
    - `max` integer: Filter out any numbers greater
    - `min` integer: Filter out any numbers lower
  - `firstDonationOn` DateFilter: Object for filtering by before and after dates
    - `after` string, date-time: Filter out any dates after
    - `before` string, date-time: Filter out any dates before
  - `firstOrderOn` DateFilter: Object for filtering by before and after dates
    - `after` string, date-time: Filter out any dates after
    - `before` string, date-time: Filter out any dates before
  - `lastDonationOn` DateFilter: Object for filtering by before and after dates
    - `after` string, date-time: Filter out any dates after
    - `before` string, date-time: Filter out any dates before
  - `lastOrderOn` DateFilter: Object for filtering by before and after dates
    - `after` string, date-time: Filter out any dates after
    - `before` string, date-time: Filter out any dates before
  - `orderAmount` IntegerFilter: Object for filtering by a min and max integer
    - `max` integer: Filter out any numbers greater
    - `min` integer: Filter out any numbers lower
  - `orderCount` IntegerFilter: Object for filtering by a min and max integer
    - `max` integer: Filter out any numbers greater
    - `min` integer: Filter out any numbers lower
  - `pageSize` integer: The number of contacts to return per request.
  - `searchString` string: Search string for Name and Email address
  - `sortDirection` 'ASCENDING' | 'DESCENDING': Direction to sort results, ASCENDING or DESCENDING
  - `sortField` 'ID' | 'CREATED_ON' | 'EMAIL' | 'ACCEPTS_MARKETING_JOINED_ON' | 'FIRST_NAME' | 'LAST_NAME' | 'ORDER_COUNT' | 'LAST_ORDER_ON' | 'ORDER_AMOUNT' | 'DONATION_COUNT' | 'LAST_DONATION_ON' | 'DONATION_AMOUNT': Field to sort results by

## Response `200`

A paginated list of contacts matching the query.

- PaginatedQueryContactsResponse
  - `contacts` Contact[]: paginated list of contacts retrieved
    - `createdOn` string, date-time: The date and time when the contact was created.
    - `defaultShippingAddress` AddressBookEntry: An address book entry for a contact.
      - `address` ContactAddress: Address properties for a contact.
        - `city` string: Address' city
        - `countryCode` 'AF' | 'AX' | 'AL' | 'DZ' | 'AS' | 'AD' | 'AO' | 'AI' | 'AQ' | 'AG' | 'AR' | 'AM' | 'AW' | 'AU' | 'AT' | 'AZ' | 'BS' | 'BH' | 'BD' | 'BB' | 'BY' | 'BE' | 'BZ' | 'BJ' | 'BM' | 'BT' | 'BO' | 'BA' | 'BW' | 'BV' | 'BR' | 'IO' | 'BN' | 'BG' | 'BF' | 'BI' | 'BQ' | 'KH' | 'CM' | 'CA' | 'CV' | 'KY' | 'CF' | 'TD' | 'CL' | 'CN' | 'CX' | 'CC' | 'CO' | 'KM' | 'CG' | 'CD' | 'CK' | 'CR' | 'CI' | 'CW' | 'HR' | 'CU' | 'CY' | 'CZ' | 'DK' | 'DJ' | 'DM' | 'DO' | 'EC' | 'EG' | 'SV' | 'GQ' | 'ER' | 'EE' | 'ET' | 'FK' | 'FO' | 'FJ' | 'FI' | 'FR' | 'GF' | 'PF' | 'TF' | 'GA' | 'GM' | 'GE' | 'DE' | 'GH' | 'GI' | 'GR' | 'GL' | 'GD' | 'GP' | 'GU' | 'GT' | 'GG' | 'GN' | 'GW' | 'GY' | 'HT' | 'HM' | 'VA' | 'HN' | 'HK' | 'HU' | 'IS' | 'IN' | 'ID' | 'IR' | 'IQ' | 'IE' | 'IM' | 'IL' | 'IT' | 'JM' | 'JP' | 'JE' | 'JO' | 'KZ' | 'KE' | 'KI' | 'XK' | 'KP' | 'KR' | 'KW' | 'KG' | 'LA' | 'LV' | 'LB' | 'LS' | 'LR' | 'LY' | 'LI' | 'LT' | 'LU' | 'MO' | 'MF' | 'MK' | 'MG' | 'MW' | 'MY' | 'MV' | 'ML' | 'MT' | 'MH' | 'MQ' | 'MR' | 'MU' | 'YT' | 'MX' | 'FM' | 'MD' | 'MC' | 'MN' | 'ME' | 'MS' | 'MA' | 'MZ' | 'MM' | 'NA' | 'NR' | 'NP' | 'NL' | 'AN' | 'NC' | 'NZ' | 'NI' | 'NE' | 'NG' | 'NU' | 'NF' | 'MP' | 'NO' | 'OM' | 'PK' | 'PW' | 'PS' | 'PA' | 'PG' | 'PY' | 'PE' | 'PH' | 'PN' | 'PL' | 'PT' | 'PR' | 'QA' | 'RE' | 'RO' | 'RU' | 'RW' | 'BL' | 'SH' | 'KN' | 'LC' | 'PM' | 'VC' | 'WS' | 'SM' | 'ST' | 'SA' | 'SN' | 'RS' | 'SC' | 'SL' | 'SG' | 'SK' | 'SI' | 'SB' | 'SO' | 'SX' | 'ZA' | 'GS' | 'ES' | 'LK' | 'SD' | 'SR' | 'SJ' | 'SS' | 'SZ' | 'SY' | 'SE' | 'CH' | 'TW' | 'TJ' | 'TZ' | 'TH' | 'TL' | 'TG' | 'TK' | 'TO' | 'TT' | 'TN' | 'TR' | 'TM' | 'TC' | 'TV' | 'UG' | 'UA' | 'AE' | 'GB' | 'US' | 'UM' | 'UY' | 'UZ' | 'VU' | 'VE' | 'VN' | 'VG' | 'VI' | 'WF' | 'EH' | 'YE' | 'ZM' | 'ZW', required: ISO 3166 alpha-2 country code string.
        - `firstName` string: Contact's first name
        - `lastName` string: Contact's last name
        - `line1` string: First line of address
        - `line2` string: Second line of address
        - `phoneNumber` string: Contact's phone number
        - `postalCode` string: zip/postal code
        - `region` string: General region (State, Province, County, etc...)
      - `defaultShipping` boolean: Whether this entry is the current default shipping address. When the contact has any address book entries, exactly one entry has this value set to true.
      - `id` string: The address book entry's ID.
    - `firstName` string: The contact's first name.
    - `id` string: The contact's ID.
    - `lastName` string: The contact's last name.
    - `locale` string: The contact's locale.
    - `primaryEmail` Email: The contact's primary email.
      - `acceptsMarketing` AcceptsMarketing: Marketing subscription state for the contact's email.
        - `acceptsMarketing` boolean: Whether the contact accepts marketing email.
        - `joinedOn` string, date-time: The date and time the contact was added to the marketing list.The value returned in the creation response is a near-real-time estimate; the Get Contact endpoint should be used to verify the exact persisted timestamp.
        - `leftOn` string, date-time: The date and time the contact left Marketing list
      - `createdOn` string, date-time: The date and time when the email was created.
      - `email` string, email: The email address.
  - `pagination` object
    - `hasNextPage` boolean
    - `nextPageCursor` string
    - `nextPageUrl` string

## Other responses

- `400`: Invalid input or malformed JSON.
- `403`: Forbidden. Insufficient scope (OAuth or API key), or the requested resource is not accessible for the authenticated website.
- `429`: Too many requests. The rate limit for this endpoint has been exceeded.

---

[API](https://skmtc.dev/squarespace/apis/commerce-api.md) - [All operations](https://skmtc.dev/squarespace/apis/commerce-api/llms.txt) - [OpenAPI document](https://skmtc.dev/squarespace/apis/commerce-api/revisions/5dd4b1b7cd38?raw)
