Solved

API endpoint to know what are the scopes of the API key?

  • 1 December 2022
  • 3 replies
  • 299 views

Badge +1

Hello,

First, congrats on the new API release, I’m excited to work with it!

Since we are now dealing with API scopes attached to API keys, I was wondering if there was an API that would tell me what are the scopes attached to an API key? I can’t seem to find any in the doc/OpenAPI spec.

Perhaps something like :

curl --request GET \
--url 'https://a.klaviyo.com/api/key-scopes'
--header 'Authorization: Klaviyo-API-Key {my-private-api-key}'


That would answer with :

{
  "data": ["Catalogs Read", "Catalogs Write"]
}



Thanks!

icon

Best answer by Brian Turcotte 1 December 2022, 19:25

View original

3 replies

Userlevel 7
Badge +36

Hi @SmashPops and welcome back to the Community!

 

This is great question! At this time, there’s no supported endpoint to retrieve the scope of an API key. However, another Community member asked a similar question here, so I will definitely submit a request with our product team, as I agree that this would be a great feature!

 

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

- Brian

Badge +1

Hello Brian,

Oops, sorry for the duplicate content!

And thank you for your answer. Well, for now I’ll use a workaround then : calling an endpoint that requires some scopes and see if I’m rejected with a 403 HTTP status code (instead of a 400 for instance), which would mean that my token doesn’t have the required scopes.

Anyway, thanks again!
William

Badge +1

any updates?

 

Reply