Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Issue in customer search REST API

Shopify Partner
8 1 2

Hello Community,


I found a very very weird behavior using  GET /admin/api/2022-10/customers/search.json? API calls


I have a few customers imported through the CSV file into my store all have accepts_marketing=yes,

When I create an API call passing accepts_marketing:0 or email_marketing_state:not_subscribed,

In both cases, I get few customers with accepts_marketing:true,
(please see below my Postman API calls)



Shouldn't I receive this customer because he has accepts_marketing: true?


And the interesting fact is if I go directly into the store and update this customer first put accepts_email_marketing:false and after accepts_email_marketing:true, then I don't receive this customer in these


Has somebody have this kind of situation am I am doing something wrong or the Shopify API is buggy? I would try to figure out it by myself but there's no documentation about this, which makes me disappointed in Shopify  :(.



Please let me know if you got this kind of scenario.


Thank you in advance.


Best regards,



Replies 3 (3)

Shopify Staff
1243 201 440

Hi @tinyemail 👋


As of API version 2022-04, the `accepts_marketing` property was deprecated in favour of the `email_marketing_consent` property. I'd recommend using something like the below request instead:


curl -L -X POST '' \
-H 'X-Shopify-Access-Token: ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
--data-raw '{
    "customer": {
        "first_name": "test",
        "last_name": "customer",
        "email": "",
        "verified_email": true,
        "email_marketing_consent": {
            "state": "subscribed",
            "opt_in_level": "confirmed_opt_in",
            "consent_updated_at": "2022-12-22T11:22:06-04:00"


Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit or the Shopify Web Design and Development Blog

Shopify Partner
8 1 2

Hello @ShopifyDevSup ,

thank you for your response and explanation. But as I mentioned before I want to apply a search filter to retrieve either Subscriber or NotSubscribed customers, for this in the deprecated version I use accepts_marketing: true/false but in the new version email_marketing_state:subscribed/not_subscribed. In both cases, the result is the same for not_subscribed I received customer with email_marketing_consent.state:subscribed.


Please advise how I should apply the filter to retrieve only subscribed/not_subscribed customers.

I need to count them for the system statistics.


Thank you in advance!!


Best regards,




Shopify Partner
1 0 2

I am also facing the same issue. could anyone please help 🙂