Skip to main content
Question

Fetching More than 10500 products

  • April 24, 2025
  • 1 reply
  • 51 views

  • Conversation Starter

Hi everyone,  I want to fetch all the products (in order to collect all the SKUs). But there is an maximum offset value 10000 and limit is 500. So, the possible amount of products to be fetched via API is 10500. is there any way to overcome this? I want to fetch around 20K products (it might grow in the feature).

Fetching based on categories is not working as expected. It ended up in lot of duplicate, limit issue.

Note: Had the same issue with orders. But , fetching the orders based on the createdAt field solved the issue. Products have the same createdAt date.

Thank you and kind regards, 
Raja

  • Going Places
  • April 27, 2025

Hi  ​@Raja ,
Please follow the below instructions to get all products 

  • Send a request to get products with total .
  • Once you got the total number of products, you need to send the products request with sort by id desc with a simple pagination logic
  • curl --location 'https://api.australia-southeast1.gcp.commercetools.com/{project-KEY}/products/search?limit=1' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer XXXXXXXXXXXXXXX' \
    --data ''
  • Apply the simple pagination logic to set the correct offset value 
  • curl --location 'https://api.australia-southeast1.gcp.commercetools.com/{project-key}/products?where=id%3E%22128416c1-e351-41fe-a4fb-7cbffefd0d99%22&sort=id%20asc&limit=500&withTotal=false&skip=1000' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer XXXXXXXXX' \
    --data ''
  • Apply the proper where condition and set the correct skip values.

    Hope the above CURL will help you 

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings