Skip to main content
Solved

New APIs and populating custom properties on profiles

  • May 2, 2024
  • 3 replies
  • 114 views

Forum|alt.badge.img+2
  • Contributor I
  • 7 replies

Using this endpoint: https://a.klaviyo.com/api/profile-import/

revision 2024-02-15

The profile gets created. But no custom properties are added to the profile. What am I doing wrong?

{
    "data": {
        "type": "profile",
        "attributes": {
            "email": "abc123xzy@someplacefake.com",
            "first_name": "TESTING",
            "last_name": "TEST"
        },
        "properties": {
            "Lead Source": "Cold Call",
            "Machine": "Scanner"
        }
    }
}

Best answer by Kim Strauch

Hey @MaxT! In this case, properties needs to be nested underneath attributes. Here is an updated payload c
 

{
    "data": {
        "type": "profile",
        "attributes": {
            "email": "abc123xzy@someplacefake.com",
            "first_name": "TESTING",
            "last_name": "TEST",
            "properties": {
                "Lead Source": "Cold Call",
                "Machine": "Scanner"
            }
        }
    }
}

 

3 replies

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

Hey @MaxT! In this case, properties needs to be nested underneath attributes. Here is an updated payload c
 

{
    "data": {
        "type": "profile",
        "attributes": {
            "email": "abc123xzy@someplacefake.com",
            "first_name": "TESTING",
            "last_name": "TEST",
            "properties": {
                "Lead Source": "Cold Call",
                "Machine": "Scanner"
            }
        }
    }
}

 


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 7 replies
  • May 2, 2024

@Kim Strauch Ahhhh! Thank you. When looking at the docs I never noticed that last curly bracket was closing the Location map and was not the end of the attributes grouping.

At least I am not the only dev who was stumped by the same!

While I am here, and not to push my luck… Is there a way in the same call to REMOVE a custom property from the profile?


Kim Strauch
Klaviyo Employee
Forum|alt.badge.img+9
  • Klaviyo Employee
  • 91 replies
  • May 6, 2024

@MaxT, yes, there is! For example, if you wanted to remove a custom property called “removeMe” from the profile in this call you could do this like so:  

{
"data": {
"type": "profile",
"attributes": {
"email": "abc123xzy@someplacefake.com",
"first_name": "TESTING",
"last_name": "TEST",
"properties": {
"Lead Source": "Cold Call",
"Machine": "Scanner"
}
},
"meta": {
"patch_properties": {
"unset": "removeMe"
}
}
}
}