subscriber detail in customer rest api

shalukumari
Tourist
14 0 2

Hi Team,
I have a query related to rest API for customers' data.

How to fetch the subscriber customer list in the customer rest API?

I have used this API to fetch all the customer data from Shopify. But now, we need the requirement to fetch all the subscriber customers in Shopify.

Rest API

https://mydomain/admin/api/2022-07/customers.json

Any idea or suggestion to retrieve all subscriber lists of customers using rest API?

Thanks

Reply 1 (1)

Shayne
Shopify Staff
253 20 64

To fetch only the subscribers from the customer API, you can make use of the customers search endpoint and add the `query` parameter to filter customers by their acceptance of marketing. Here is an example endpoint that will return all customers who have accepted marketing:


https://mydomain/admin/api/2022-07/customers/search.json?query=accepts_marketing:true


This will return all customers who have accepted marketing, which should give you the list of subscribers that you are looking for. Note that you'll need to replace `mydomain` with your actual Shopify domain. I hope this helps! Let me know if you have any other questions.

Shayne | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog