Solved

Get unlimited data from event by time-line API with Python

  • 23 November 2022
  • 4 replies
  • 32 views

Badge

Hi all,

 

I'm having trouble getting raw data from Klaviyo through the Python API. Data is limited to 100 rows. How can I get more than 100 rows in the result? 

My script:

url = "https://a.klaviyo.com/api/v1/metrics/timeline?since=2022-01-01?count=100&sort=asc&api_key=****"

headers = {"accept": "application/json"}

response = requests.get(url, headers=headers).json()

 

Please help!

icon

Best answer by Brian Turcotte 23 November 2022, 16:46

View original

4 replies

Userlevel 5
Badge +27

Hi @Advesacomunity and welcome to the Community!

 

This is a great question! There’s currently no way to get past the count limit of 100 per call that’s documented here. In order to get the following 100, 200, etc. results, you would have to paginate using the page param that starts at 0. 

 

Here are some more Community threads regarding the same topic:


I hope this helps to clarify, and thanks for using the Community!

 

- Brian

Badge

Hi @Advesacomunity and welcome to the Community!

 

This is a great question! There’s currently no way to get past the count limit of 100 per call that’s documented here. In order to get the following 100, 200, etc. results, you would have to paginate using the page param that starts at 0. 

 

Here are some more Community threads regarding the same topic:


I hope this helps to clarify, and thanks for using the Community!

 

- Brian

 

Thank you Brian,

 

But the page param is not supported to get “Events for all metrics” data (ref: https://developers.klaviyo.com/en/v1-2/reference/metrics-timeline). I tried to get data at contiguous times and remove duplicate values but it takes a lot of time and resources.


Are there any solutions to retrieve all historical data for this case?

Badge

Oh I found the solution via your Community threads. Thank you 😂

 

Thank you!

Userlevel 5
Badge +27

Hi @Advesacomunity,

 

I’m glad you got to the solution! Thanks for using the Community!!

 

- Brian

Reply