import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
klaviyo_oauth: {
type: "app",
app: "klaviyo_oauth",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://a.klaviyo.com/api/accounts`,
headers: {
Authorization: `Bearer ${this.klaviyo_oauth.$auth.oauth_access_token}`,
"accept": `application/vnd.api+json`,
"revision": `2025-10-15`,
},
})
},
})
Klaviyo (Oauth) uses OAuth authentication. When you connect your Klaviyo (Oauth) account, Pipedream will open a popup window where you can sign into Klaviyo (Oauth) and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Klaviyo (Oauth) API.
Pipedream requests the following authorization scopes when you connect your account:
accounts:readcampaigns:readcampaigns:writeevents:readevents:writemetrics:readprofiles:readprofiles:writelists:readlists:writesegments:readsegments:writetags:readtags:writesubscriptions:readsubscriptions:writeGEThttps://www.klaviyo.com/oauth/authorize?client_id={{oauth.client_id}}&redirect_uri={{oauth.redirect_uri}}&state={{oauth.state}}&response_type=code&scope={{oauth.space_separated_scopes}}&code_challenge_method=S256&code_challenge={{oauth.token}}POSThttps://a.klaviyo.com/oauth/tokencontent-type: application/x-www-form-urlencodedaccept: application/jsonredirect_uri={{oauth.redirect_uri}}&grant_type=authorization_code&code={{oauth.code}}&code_verifier={{oauth.verifier}}POSThttps://a.klaviyo.com/oauth/tokencontent-type: application/x-www-form-urlencodedaccept: application/jsongrant_type=refresh_token&refresh_token={{oauth.refresh_token}}