Skip to main content
Solved

Authenticating API calls for the newer API endpoints

  • September 14, 2023
  • 3 replies
  • 124 views

Forum|alt.badge.img+1

Hey for some reason when I try to access newer endpoints I get a 401 not_authenticated response. I try to make the call like this: https://a.klaviyo.com/api/lists?key={key}. 
When I try to do this with v1 or v2 endpoints it is working. I noticed that in the newer endpoints, the authorization is in the headers while in v1 and v2 it's inside the URL like I showed. I tried to put the key in the headers but I still get the not_authenticated response. 

So how should I make the request for it to work?

Best answer by Brian Turcotte

Hi @raztamim!

My apologies for the delay here - I actually addressed this in a different Community post here:

 

Essentially, you’re correct that calls to the new endpoints are no longer authenticated in the URL, but in the header. My intuition is that you may be missing the syntax ‘Klaviyo-API-Key your-private-api-key’ in the section you redacted in this screenshot.

 

So for example, if my API key was abcde12345, the Header would be:

Authorization: Klaviyo-API-Key abcde12345

 

Best,

Brian

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

Brian Turcotte
Forum|alt.badge.img+37

Hi @raztamim!

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

Best,

Brian


Forum|alt.badge.img+1
  • Contributor I
  • September 19, 2023
Brian Turcotte wrote:

Hi @raztamim!

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

Best,

Brian

Hey, any update? here is how I make the request: 

 


Brian Turcotte
Forum|alt.badge.img+37

Hi @raztamim!

My apologies for the delay here - I actually addressed this in a different Community post here:

 

Essentially, you’re correct that calls to the new endpoints are no longer authenticated in the URL, but in the header. My intuition is that you may be missing the syntax ‘Klaviyo-API-Key your-private-api-key’ in the section you redacted in this screenshot.

 

So for example, if my API key was abcde12345, the Header would be:

Authorization: Klaviyo-API-Key abcde12345

 

Best,

Brian