Solved

Which API method can return Account details

  • 4 February 2023
  • 2 replies
  • 20 views

Badge +1

Hi

 

I am looking for an API method which returns information about the current account.

Sort of a ping method to ensure the key is valid, and what account it belongs to.

Is that possible?

icon

Best answer by Brian Turcotte 6 February 2023, 04:01

View original

2 replies

Userlevel 7
Badge +35

Hi @AxelAndersen and welcome to the Community!

 

Just to clarify, do you want to retrieve information about your individual Klaviyo Account, or a Profile(s) within your account? It might help myself and other Community members understand the issue better if you wouldn’t mind elaborating what you mean by “the current account”. 

 

When you make any API call, you have to supply a valid Private API Key to validate and direct the call. This, in itself, both ensures that the key is valid and also identifies the account. While there’s currently no way to determine the scope of an API key via an endpoint or otherwise, another Community member came up with a workaround that sounds similar to your use case:
 

[You can determine that they key is invalid] by calling an endpoint that requires some scopes and see if [you’re] rejected with a 403 HTTP status code (instead of a 400 for instance), which would mean that [your] token doesn’t have the required scopes.

 

Here’s that thread:

 

If you are attempting to query for a certain profile within your account, you can do so using the Get Profile API endpoint, in which you’d supply the profile ID in the call:

 

You can also include parameters to query for the profile’s list and segment memberships.

 

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

- Brian

 

Badge +1

Hi

I will try the /key_scopes and get back.

However, what I actually want is to know what account (not profile) the key belongs to.

I have more accounts, both for testing and production, so it was just a question whether there is a method to verify that the website configuration is setup correctly. (don’t want to make test tracking to a production environment)

Best regards,

Axel
 

Reply