Hi there,
I’m building an app and would like to know how can I fetch klaviyo account id where the user installed my app.
After we generate the URL and redirect the user in klaviyo, they see the popup in Klaviyo and then confirm/authorize the app to be installed on a specific account they have in Klaviyo. After the confirmation they are redirected in my url, with code and state parameters.
There is no accountId in this step, and how can I fetch which account id after I generate accessToken and refreshToken. Even if I fetch the list of accounts, how do I know on which account they installed my app?
Thank you.
Best regards.
Page 1 / 1
Hi
Assuming the integration is using OAuth and have the accounts:read permission, you can use the access token you received once the install is complete to make a request to Klaviyo to accounts
to get the Klaviyo ID, etc.
GET to
https://a.klaviyo.com/api/accounts
returns:
{
"data": t
{
"type": "account",
"id": "ACCOUNT_ID",
"attributes": {
"test_account": false,
"contact_information": {
"default_sender_name": "SENDER_NAME",
"default_sender_email": "byrne@klaviyo.com",
"website_url": "http://klaviyo.com",
"organization_name": "KLAVIYO_TEST",
"street_address": {
"address1": "125 Summer St",
"address2": "",
"city": "Boston",
"region": "MA",
"country": "United States",
"zip": "02210"
}
},
"industry": null,
"timezone": "America/New_York",
"preferred_currency": "USD",
"public_api_key": "API_KEY",
"locale": "en-US"
},
"links": {
"self": "https://a.klaviyo.com/api/accounts/ACCOUNT_ID/"
}
}
],
"links": {
"self": "https://a.klaviyo.com/api/accounts/",
"next": null,
"prev": null
}
}
Let me know if this makes sense.
Reply
Log in to the Community
Use your Klaviyo credentials
Log in with Klaviyo
Use your Klaviyo credentials
Log in with KlaviyoEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.