Skip to main content

using api v2024-02-15

POST https://a.klaviyo.com/api/profiles/
PATCH https://a.klaviyo.com/api/profiles/{id}/

Unable to add custom properties on existing profile and new create profile.

 

Proflie can be created but properties has not add to the profile.

 

postman example with POST https://a.klaviyo.com/api/profiles/

{

  "data": {

    "type": "profile",

    "attributes": {

      "email": "ptctech@gmail.com",

      "phone_number":"+61431111232",

      "first_name": "Peter123",

      "last_name": "Chai"

    },

            "properties": {

                "membership": "GOLD"

            }

  }

}

 

Return:

{

    "data": {

        "type": "profile",

        "id": "01HWVCVDZADCX4GF5HQY86EAFN",

        "attributes": {

            "email": "ptctech@gmail.com",

            "phone_number": "+61431111232",

            "external_id": null,

            "anonymous_id": null,

            "first_name": "Peter123",

            "last_name": "Chai",

            "organization": null,

            "title": null,

            "image": null,

            "created": null,

            "updated": null,

            "last_event_date": null,

            "location": {

                "longitude": null,

                "zip": null,

                "city": null,

                "address1": null,

                "country": null,

                "latitude": null,

                "region": null,

                "address2": null,

                "timezone": null,

                "ip": null

            },

            "properties": {}

        },

        "relationships": {

            "lists": {

                "links": {

                    "self": "https://a.klaviyo.com/api/profiles/01HWVCVDZADCX4GF5HQY86EAFN/relationships/lists/",

                    "related": "https://a.klaviyo.com/api/profiles/01HWVCVDZADCX4GF5HQY86EAFN/lists/"

                }

            },

            "segments": {

                "links": {

                    "self": "https://a.klaviyo.com/api/profiles/01HWVCVDZADCX4GF5HQY86EAFN/relationships/segments/",

                    "related": "https://a.klaviyo.com/api/profiles/01HWVCVDZADCX4GF5HQY86EAFN/segments/"

                }

            },

            "conversation": {

                "links": {

                    "self": "https://a.klaviyo.com/api/profiles/01HWVCVDZADCX4GF5HQY86EAFN/relationships/conversation/",

                    "related": "https://a.klaviyo.com/api/profiles/01HWVCVDZADCX4GF5HQY86EAFN/conversation/"

                }

            }

        },

        "links": {

            "self": "https://a.klaviyo.com/api/profiles/01HWVCVDZADCX4GF5HQY86EAFN/"

        }

    }

}

 

Hi @peterchai89!

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

- Brian


Thank you Brian.

do you have any update?


Hey @peterchai89,

You can definitely update custom properties using the new APIs. The problem you’re running into here is how you’re structuring your API request payload. You need properties to be nested under attributes for this to work properly. Here’s an updated payload example:

 

{

  "data": {

    "type": "profile",

    "attributes": {

      "email": "ptctech@gmail.com",

      "phone_number":"+61431111232",

      "first_name": "Peter123",

      "last_name": "Chai",

      "properties": {

        "membership": "GOLD"

      }

    }        

  }

}

There’s also an API endpoint you can use to create or update a profile in a single request here, if that’s desired: https://developers.klaviyo.com/en/reference/create_or_update_profile