Skip to main content
Contributor I
November 6, 2022
Solved

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

  • November 6, 2022
  • 1 reply
  • 300 views

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.

    This topic has been closed for replies.
    Best answer by Chops

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

     

    1 reply

    ChopsAnswer
    Problem Solver I
    November 7, 2022

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