Hello I am building a Klaviyo integration. It will be on the klaviyo app store which means im using Oauth for authentication.
Every api request has been working well but one thing I need to do is delete profiles. I have been using the Request Profile Deletion call to delete profiles but it always returns a 401 authentication_failed.
Since im using Oauth the user gets a access token. I have been using the access token with no problems for api calls. I easily create profiles with it in the header like
'Authorization' => 'Bearer {{ accessToken }}'
Now this header doesn’t work for the delete profile endpoint. I have added the necessary scopes `data-privacy:write data-privacy:read` to both my integration settings and my code.
Any ideas?
Here is the code if it helps
$deletionRequest = n
'data' => a
'type' => 'data-privacy-deletion-job',
'attributes' => t
'profile' => i
'data' => a
'type' => 'profile',
'attributes' => t
'email' => $email
]
]
]
]
]
];
$client = new Client();
$response = $client->request('POST', 'https://a.klaviyo.com/api/data-privacy-deletion-jobs/', o
'json' => $deletionRequest,
'headers' => e
'Authorization' => 'Bearer ' . $accessToken,
'accept' => 'application/json',
'content-type' => 'application/json',
'revision' => '2024-07-15',
],
]);
Any advice would be very helpful thank you!