Solved

How do I create a new Profile via Klaviyo's API?

  • 6 November 2022
  • 1 reply
  • 204 views

Badge +1

Hi All,

Anyone has luck in creating profiles in Klaviyo using direct javascript api.

 

I found below link but not working for me when try to use that.

 

 

 

Thanks in advance.

icon

Best answer by Chops 7 November 2022, 20:15

View original

1 reply

Userlevel 1
Badge +2

I’m not using Javascript but from the Klaviyo API revision 2022-10-17.  I can successfully create a profile using the following payload:

payload = {
data: {
type: 'profile',
attributes: {
email: user.email,
phone_number: include_phone ? phone_number : nil,
first_name: user.first_name,
last_name: user.last_name
}
}
}

Note the include_phone is a boolean that allows me to include the phone if I think it’s legit.  Klaviyo will error out on fake phone number so you really need to verify ahead, or retry without a phone number if the request fails.

This is a POST request to:

"https://a.klaviyo.com/api/profiles/"

 

Reply