Skip to main content
Problem Solver I
September 29, 2023
Solved

Subscribe Profile and add custom properties using latest Klaviyo API

  • September 29, 2023
  • 18 replies
  • 2165 views

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

    This topic has been closed for replies.
    Best answer by Kim Strauch

    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!

    18 replies

    acavdevAuthor
    Problem Solver I
    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
    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
    May 9, 2024

    Follow up on this...

    Contributor I
    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
    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
    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
    Klaviyo Employee
    June 25, 2024

    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!

    Contributor I
    September 16, 2024

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