Skip to main content
Solved

Klaviyo GET-Campaigns API failing when paginating


Forum|alt.badge.img+2

Klaviyo Get Campaigns API failure.

 

I am using the `2023-08-15` of Klaviyo API to get all the campaigns. 

(https://developers.klaviyo.com/en/reference/get_campaigns)

 

I am making paginated requests, using the “next” url in the “links” object. 

At one point, the API is failing with `400` status code & returns

{'errors': [{'id': 'a7fdaa68-1add-4536-91ff-63096728544a',
   'status': 400,
   'code': 'invalid',
   'title': 'Invalid input.',
   'detail': "'NoneType' object has no attribute 'tzinfo'",
   'source': {'pointer': 'options_static'},
   'meta': {}}]
}

 

I am able to get all the campaigns using the deprecated `v1-2` API, so the API keys is fine. 

(https://developers.klaviyo.com/en/v1-2/reference/get-campaigns)

 

Best answer by Kim Strauch

Hey @Eugene K , I checked in with the team and the issue should be fixed on your end. Can you please give it a go and confirm it’s working for you? 

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

12 replies

Brian Turcotte
Forum|alt.badge.img+37

Hi @vaibhavrai2446!

I’m going to check on this with Engineering and I’ll update the thread ASAP!

 

Best,
Brian


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 6 replies
  • September 20, 2023
Brian Turcotte wrote:

Hi @vaibhavrai2446!

I’m going to check on this with Engineering and I’ll update the thread ASAP!

 

Best,
Brian

 

Hey Brian,

 

Any updates?


Brian Turcotte
Forum|alt.badge.img+37

Hi @vaibhavrai2446!

My apologies for the delay here! 

 

This looks like a case where the 400 is representative of a bad cursor for the next page. Would you be able to provide the exact "next" url that causes a 400 failure? (With any sensitive information - API keys, etc. redacted)

 

This will allow us to gather more insight about the actual source of the error.

 

Best,

Brian


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 6 replies
  • September 25, 2023

Hey Brian,

 

Please find the details below:
URL: 

https://a.klaviyo.com/api/campaigns?filter=equals%28messages.channel%2C%27email%27%29&page%5Bcursor%5D=bmV4dDo6LXVwZGF0ZWQ6OjIwMjItMTAtMTMgMDI6MDA6NDcuNTUwNTY0KzAwOjAw

 

status-code: 400
response-json:

{'errors': [{'id': 'aa6e7f44-8f1b-409c-93e1-de912cb9c21e',
   'status': 400,
   'code': 'invalid',
   'title': 'Invalid input.',
   'detail': "'NoneType' object has no attribute 'tzinfo'",
   'source': {'pointer': 'options_static'},
   'meta': {}}]}

 


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 6 replies
  • October 13, 2023

Hey, 

Did you get a chance to take a look in this?


Forum|alt.badge.img+2
  • Contributor I
  • 3 replies
  • December 5, 2023

Hi @Brian Turcotte , we’ve faced the same exception with every revision (2023-06-15 -- 2023-10-15). 

URL:

https://a.klaviyo.com/api/campaigns?filter=greater-than%28updated_at%2C2022-01-01T00%3A00%3A00%2B00%3A00%29&sort=updated_at&page%5Bcursor%5D=bmV4dDo6dXBkYXRlZDo6MjAyMi0wOS0xOSAxODozOTo0MyswMDowMA

response:

{
   "errors":[
      {
         "id":"29e038e4-a97c-400b-987c-a5e280415ea7",
         "status":400,
         "code":"invalid",
         "title":"Invalid input.",
         "detail":"'NoneType' object has no attribute 'tzinfo'",
         "source":{
            "pointer":"options_static"
         },
         "meta":{
         }
      }
   ]
}

Any updated so far?


Kim Strauch
Klaviyo Employee
Forum|alt.badge.img+9
  • Klaviyo Employee
  • 91 replies
  • December 12, 2023

Hey @Eugene K and @vaibhavrai2446


Sorry for the delay. This appears to be a bug in our campaigns endpoint; this error was being mis-categorized as a 400 instead of a 500, so we weren’t aware it was happening.

Our engineering team is investigating the issue further and I’ll let you know when we have an ETA for the fix 


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 6 replies
  • December 13, 2023

Thanks @Kim Strauch . 
Just wanted to highlight that using the correct status-code would not be sufficient for our usecase. 

This is a major blocker for us since we are unable to get all the required details due to this error. 

@Brian Turcotte 

 

 


Brian Turcotte
Forum|alt.badge.img+37

Hi @vaibhavrai2446 & @Eugene K!

I’ll work with @Kim Strauch and the API to ensure that the thread will be notified when there is an update here!

Best,

Brian


Forum|alt.badge.img+2
  • Contributor I
  • 3 replies
  • January 17, 2024

HI @Brian Turcotte, @Kim Strauch,

Do you have any updates regarding the issue?


Kim Strauch
Klaviyo Employee
Forum|alt.badge.img+9
  • Klaviyo Employee
  • 91 replies
  • Answer
  • January 17, 2024

Hey @Eugene K , I checked in with the team and the issue should be fixed on your end. Can you please give it a go and confirm it’s working for you? 


Forum|alt.badge.img+2
  • Contributor I
  • 3 replies
  • January 24, 2024

Hi @Kim Strauch, confirming that issue is fixed.

Thanks!