Skip to main content

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

Hi @acavdev!

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

Best,

Brian


Thank you!


Hi Brian,

 

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


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.


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

 


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


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 a] brackets as if the value is an array element - seems like the API mis-interprets the json structure - even though I followed the documentation 


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!


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


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


@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/


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?


Follow up on this...


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. 


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.

 


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.

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

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!


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


Reply