Skip to main content
Contributor I
October 1, 2021
Solved

Is there a way to search for a profile by their email using the API ?

  • October 1, 2021
  • 14 replies
  • 4960 views

Hi,

 

I’m using the API to search for profiles using their email but it appears to be not available.

Why is that ? It doesn’t make sense that we don’t have CRUD operations on profiles….
 

 

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

    Hi @david.to , 

    Thanks for the answer. But the problem is that I don’t want to search for a profile in a list. Because If I have 400 lists and I’m looking for 1 profile, it wouldn’t make sense to loop in all 400 to just look for one profile, that’s very resource intensive and unfortunate.

    I just found out that we could use this endpoint

    "https://a.klaviyo.com/api/v2/people/search?api_key={key}&email={email}"

    But this isn’t documented, and I think it should.

    Cheers,
    Amrou.

    14 replies

    Contributor III
    April 28, 2022

    Hey, this endpoint doesn’t seem to work for me.
    I’ve tried the following with a valid email address that’s in my profiles:
    https://a.klaviyo.com/api/v2/people/search?api_key={api_key}&email={email}

    However, I get the following response: There is no profile matching the given parameters.
     

    Any idea?

    Remember that you have to URL encodethe email if it contains odd characters.


    I’d just like to point out one mighty sketchy thing with this endpoint.
    If there are multiple profiles with the same email this endpoint will still only return one id.
    And I have absolutely no idea if there is any rhyme or reason behind which user ID gets returned.

    David To
    Klaviyo Employee
    Klaviyo Employee
    April 28, 2022

    Hey @Henrik Sommerland,

    Are you by chance identifying your profiles/contacts with a custom identification method such as an external id ($id) property?

    Normally, there wouldn’t be multiple profiles with the same associated email address. Since the default identification method uses an email address (using the $email key), profiles would be de-duplicated. Natively, this de-duplicative process spans the whole of Klaviyo and stands even if contacts/profiles are added to your Klaviyo account from a variety of sources. This is, with the exception of using an alternate custom identification method using an $id key. 

    As called out in our Getting Started with Track and Identify APIs Developer Documents:

    If you choose to use a unique identifier via the $id key, you will be responsible for identity management within your Klaviyo account. You must ensure every call you make maps the correct $id to the associated $email. Calls sent with only an $id value will cause Klaviyo to create profiles without an associated $email. If a call then comes in for the same person, but only identifies them via their $email, a permanent duplicate profile will be created for the same person.

    The $id key should never be used to track profiles anonymously, as this has a high potential of creating multiple profiles for individuals in your account if not set up thoughtfully. Only use $id if a given person has a known $email and their associated ID will never change (eg. an account ID in your own system).

     

    This means that often times, one returning profile ID would be all you need as each email address would have a unique profile in Klaviyo. 

    David

     

    Contributor III
    April 29, 2022

    @David To 

    Thank you!!!!
    We have been scratching our heads about why we were having duplicate accounts in some cases :)
    Now we know what to look for!

    Contributor I
    March 5, 2023

    Since this post is still relevant for Google, I just want to mention, that you can simply use the new /api/profiles endpoint together with a filter parameter for the email address “?filter=equals(email,"jane@doe.com")”.

    See:
    https://developers.klaviyo.com/en/reference/get_profiles
    https://developers.klaviyo.com/en/docs/filtering_

    Kind regards