Skip to main content
Contributor I
May 2, 2024
Solved

New APIs and populating custom properties on profiles

  • May 2, 2024
  • 3 replies
  • 183 views

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"
        }
    }
}

    This topic has been closed for replies.
    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
    Klaviyo Employee
    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"
                }
            }
        }
    }

     

    MaxTAuthor
    Contributor I
    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
    Klaviyo Employee
    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"
    }
    }
    }
    }