Issues with Klaviyo PATCH

Setting up my first API to update Klaviyo profiles. My GET module is working fine but I can’t get the PATCH module to work to update the profiles. I keep getting a 401 not_authenticated" error even though I’m using the same credentials as in the GET module. Can someone help?

https://a.klaviyo.com/api/profiles/{{24.data[0].id}} - this data id is from a JSON parse located after the initial GET module

Authorization
Bearer PRIVATE-API-KEY

Content-Type
application/json

revision
2023-10-15

Accept
application/vnd.api+json

Body Type
Raw
JSON

{
“data”: {
“type”: “profile”,
“id”: “{{24.data[0].id}}”, – from the JSON parse after the GET module
“attributes”: {
“properties”: {
“has_registry”: true
}
}
}
}

Hey Elisabeth,

can you show screenshots of the module configurations?

Yes! Thank you!
I’m trying to update a Klaviyo profile or create new one with a custom property (has_registry: true) when a registry is created. Despite using a valid pk_ private API key and having confirmed headers and endpoints, the PATCH request to Klaviyo returns a 401 Unauthorized error. GET requests from Klaviyo work fine.

Flow:
(1) GET - from GiftReggie - output all registries
(6) JSON parse Gift Reggie data
(7) Iterator - registries
(23) Iterator - managers of registries
(19) GET - all matching registry emails from Klaviyo
(24) JSON parse Klaviyo data
(27) SET VARIABLE - Klaviyo email
(28) SET VARIABLE - Klaviyo id
(21) Router
(5) PATCH - has existing Klaviyo id (28) - update Klaviyo profile with has_registry: true - 401 error
(6) POST - doesn’t have existing Klaviyo id (28) - create new & add has_registry: true

Why arent you using the built in Klaviyo modules?

2 Likes

I had tried that but they weren’t working but now it works! Thanks, easy fix! :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.