Skip to main content
Contributor I
September 14, 2023
Solved

Authenticating API calls for the newer API endpoints

  • September 14, 2023
  • 3 replies
  • 191 views

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?

    This topic has been closed for replies.
    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

    3 replies

    Brian Turcotte
    Klaviyo Alum
    September 15, 2023

    Hi @raztamim!

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

    Best,

    Brian

    raztamimAuthor
    Contributor I
    September 19, 2023

    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
    Klaviyo Alum
    September 24, 2023

    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