Skip to main content
Solved

Subscribe Profile and add custom properties using latest Klaviyo API


Forum|alt.badge.img+2

Using this endpoint:

https://developers.klaviyo.com/en/reference/subscribe_profiles

 

Is it possible to subscribe a profile to a list and also add custom properties to that profile in one request? This was possible with the previous API version but now I’m not sure.

 

My request works without adding custom properties, but when I tried adding ‘newKey’ => ‘value’ to the Profile’s object and I got this error:

newKey' is not a valid field for the resource 'profile' 

 

Thank you

Best answer by Kim Strauch

Hi @acavdev and @dmiradakis,
@zmyers’ workflow is the recommended workflow. 
 

zmyers wrote:

I stumbled upon this thread when trying to see how to add custom profiles properties when subscribing. Its not as great as the single post to create a profile and add to a list as before but with the new api you should be able to create/update a profile using 

https://developers.klaviyo.com/en/reference/create_or_update_profile

This will return the profile object after created and then you can subscribe using the profile id in the new endpoint 

https://developers.klaviyo.com/en/reference/subscribe_profiles

I included both the email and the id when subscribing and it seems to work.

 

 

Apologize for the delay and any confusion here. Also, we recognize that this may not be the most convenient workflow. Our team is considering ways to make this common use case easier going forward.

That’s a great callout that we can improve the Subscribe Profiles API documentation to clarify how to achieve this use case. We appreciate your feedback!

View original
Did this topic or the replies in the thread help you find an answer to your question?

18 replies

Brian Turcotte
Forum|alt.badge.img+37

Hi @acavdev!

I’m going to check on this with Engineering and I’ll update the thread ASAP!

Best,

Brian


Forum|alt.badge.img+2
  • Author
  • Problem Solver I
  • 9 replies
  • October 4, 2023

Thank you!


Forum|alt.badge.img+2
  • Author
  • Problem Solver I
  • 9 replies
  • October 11, 2023

Hi Brian,

 

Did the engineering team have any feedback on this one? Thank you!


Forum|alt.badge.img
  • Contributor I
  • 1 reply
  • October 16, 2023

Hey Brian, any update on this?

We’re moving to the new API and facing this same issue of not being able to set custom properties in the same request.


Brian Turcotte
Forum|alt.badge.img+37

Hi @adil.naqvi!

My sincere apologies for the delay here! It’s true that you can no longer add custom properties to a profile using this endpoint, which is intended only to identify and subscribe the profile to a list. 

 

Instead, you would have to make two calls, one to subscribe and one to update the profile with the custom properties using the Update Profile endpoint.

 

Best,

Brian

 


Forum|alt.badge.img+2
  • Author
  • Problem Solver I
  • 9 replies
  • October 31, 2023

Hi Brian,

 

Thank you. Is it possible after sending the first request to subscribe to get the Primary key/ID of the user as response from that request?

 

Thank you


Forum|alt.badge.img
  • Contributor I
  • 1 reply
  • November 6, 2023
Brian Turcotte wrote:

Hi @adil.naqvi!

My sincere apologies for the delay here! It’s true that you can no longer add custom properties to a profile using this endpoint, which is intended only to identify and subscribe the profile to a list. 

 

Instead, you would have to make two calls, one to subscribe and one to update the profile with the custom properties using the Update Profile endpoint.

 

Best,

Brian

 

Has anyone been able to get this to work?  I have tried to add properties but they dont appear or update.  I have tried using the meta object but the values appear in [] brackets as if the value is an array element - seems like the API mis-interprets the json structure - even though I followed the documentation 


Forum|alt.badge.img+2
  • Author
  • Problem Solver I
  • 9 replies
  • December 15, 2023

Is it possible after sending the Subscribe request , to then get the User ID of the user as response from that request?

In order to subscribe and then update I assume I would need to have the subscribed users ID

Thanks!


Forum|alt.badge.img+2
  • Author
  • Problem Solver I
  • 9 replies
  • December 29, 2023

@ur.co.uk I have not been able to get this to work still. If anyone has figured it out , please let me know!


  • Contributor I
  • 1 reply
  • March 27, 2024

Can someone explain why this is so complex? I’m stuck using your identify endpoint because the new update documentaiton is terrible.


Forum|alt.badge.img+2
  • Author
  • Problem Solver I
  • 9 replies
  • April 1, 2024

@Colton From what I figured out with some help from my team, the working order of API operations is:
 

Add to list

https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs/

 

Create/Update profile

https://a.klaviyo.com/api/profile-import/


  • Contributor II
  • 4 replies
  • April 27, 2024

I’m having issues with this as well.

Before, I could subscribe the user and update custom properties in one request.

Now, with the new API, I need to make 3 requests to do this.

1. Subscribe the user

2. Get profile id, since the subscribe endpoint does not send a response id (ridiculous)

3. Update profile

But here’s the problem... If I do this synchronously, the 2nd step (finding the profile id) doesn’t work because it can’t find the profile id yet since it’s probably just been created. It will work a few seconds later but I need this to happen immediately.

Lmk if there’s another way?


  • Contributor II
  • 4 replies
  • May 9, 2024

Follow up on this...


  • Contributor I
  • 1 reply
  • May 28, 2024

I’m also curious about a follow up on this. I want to subscribe and add a custom attribute to a profile, but if we have to make 2 calls synchronously, I need the profile id from the first call which isn’t in the response. 


  • Contributor I
  • 1 reply
  • May 30, 2024

I stumbled upon this thread when trying to see how to add custom profiles properties when subscribing. Its not as great as the single post to create a profile and add to a list as before but with the new api you should be able to create/update a profile using 

https://developers.klaviyo.com/en/reference/create_or_update_profile

This will return the profile object after created and then you can subscribe using the profile id in the new endpoint 

https://developers.klaviyo.com/en/reference/subscribe_profiles

I included both the email and the id when subscribing and it seems to work.

 


  • Contributor I
  • 2 replies
  • June 18, 2024

I’m having the same issue here. I guess I’ll try doing what @zmyers has done:

  1. Make a call to create/update the profiles first.
  2. Then subscribe the profiles to the list.

I don’t know how else to get the new profile IDs.

What Klaviyo SHOULD do is provide us a status endpoint when we mass subscribe emails to a list. That way we can periodically check the status endpoint, and once the async and out-of-process operation is finished on Klaviyo’s side, then the status endpoint could give us a list of profile IDs - or something along those lines.

Klaviyo’s dev team needs to take notes from Shopify, this is how Shopify processes GraphQL mutations in their API infrastructure. They do it async and out-of-process, but they give the API caller a status endpoint to check where the final results are returned.

@Brian Turcotte :

  • We would really appreciate you following up on this thread and responding.
  • Also, your doc page (https://developers.klaviyo.com/en/reference/subscribe_profiles) makes no mention of this being a restriction (where we can’t add custom properties), your devs need to update this doc page to be more accurate.
  • Your initial answer is not correct, we cannot update a profile in the Klaviyo API without first having the profile ID. What you suggested is not possible.

Kim Strauch
Klaviyo Employee
Forum|alt.badge.img+9
  • Klaviyo Employee
  • 91 replies
  • Answer
  • June 25, 2024

Hi @acavdev and @dmiradakis,
@zmyers’ workflow is the recommended workflow. 
 

zmyers wrote:

I stumbled upon this thread when trying to see how to add custom profiles properties when subscribing. Its not as great as the single post to create a profile and add to a list as before but with the new api you should be able to create/update a profile using 

https://developers.klaviyo.com/en/reference/create_or_update_profile

This will return the profile object after created and then you can subscribe using the profile id in the new endpoint 

https://developers.klaviyo.com/en/reference/subscribe_profiles

I included both the email and the id when subscribing and it seems to work.

 

 

Apologize for the delay and any confusion here. Also, we recognize that this may not be the most convenient workflow. Our team is considering ways to make this common use case easier going forward.

That’s a great callout that we can improve the Subscribe Profiles API documentation to clarify how to achieve this use case. We appreciate your feedback!


  • Contributor I
  • 2 replies
  • September 16, 2024

Hi is there any API with which we can get all the custom fields associated with a account