Skip to main content
Solved

How can I limit the number of results in API response?


Forum|alt.badge.img

I am using the get_lists API from the latest version with revision: 2024-02-15, and wondering why there is no option to limit the no of results I want in the API response. I nowhere found in documentation about how many results it will return by default. 
Ideally, the users should be allowed to put the batch size as per their requirement (under a max-batch size). 
Looking forward to hear back on this.
Thanks.

Best answer by DavidV

Hi @shubham773,

Welcome to the Klaviyo community!

The GET Lists API will return a maximum of 10 results, and the API supports pagination:

curl --request GET \
     --url 'https://a.klaviyo.com/api/lists/?page[cursor]=XXXXXXXXX' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/json' \
     --header 'revision: 2024-02-15'

You are also able to use filters.

I hope that helps!

Thanks
David

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

DavidV
Partner - Platinum
Forum|alt.badge.img+30
  • Champion & Partner
  • 207 replies
  • Answer
  • April 14, 2024

Hi @shubham773,

Welcome to the Klaviyo community!

The GET Lists API will return a maximum of 10 results, and the API supports pagination:

curl --request GET \
     --url 'https://a.klaviyo.com/api/lists/?page[cursor]=XXXXXXXXX' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/json' \
     --header 'revision: 2024-02-15'

You are also able to use filters.

I hope that helps!

Thanks
David


Forum|alt.badge.img
  • Author
  • Contributor I
  • 1 reply
  • April 15, 2024

Hi @DavidV , Thanks for the answer. How can I change it if I want to change the batch limit from 10 to a lesser number? Filtering and pagination options do not have any option to change it.


DavidV
Partner - Platinum
Forum|alt.badge.img+30
  • Champion & Partner
  • 207 replies
  • April 15, 2024

Hi @shubham773,

No worries! I don’t think you are able to change the batch limit unless there are less than 10 results or you are able to filter down the list based on the Name, ID, Created date or updated date. 

Hope that helps!

Thanks
David