Skip to main content
Contributor I
June 8, 2023
Solved

Why is sending only the $id when creating an Event not documented?

  • June 8, 2023
  • 6 replies
  • 456 views

Hello!

 

I’m working on a Klaviyo integration for a client, and I was testing the Events API to try out some structure for the structure (which Klaviyo recommends against) of sending some events anonymously, prior to having an $email for the user. https://developers.klaviyo.com/en/reference/create_event

 

The API says that the Profile must contain an identifier of $email or $phone_number:

 

I tested out just sending the external ID in the `$id` field in the profile part of the request, and found that the API does accept that as an identifier as well, and creates a profile that doesn’t have an email (which is the feature that I was looking for).

 

Is this a known feature of this endpoint? Can this be added to the documentation?

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

    @jballo919 I'm not a developer but I know that Klaviyo does allow you to use your own identifiers instead of email. 

    They do advise against using them, or better said to use email as an identifier and if you do want to use id's you're responsible for the identity management.

    I suggest to read this part of the documentation about this.

    https://developers.klaviyo.com/en/v1-2/docs/custom-integration-faqs#should-i-use-email-or-id-as-my-unique-identifier

     

    Does that help?

     

    Regards,

    Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

    We help with e-commerce growth through CRO, Klaviyo and CVO

    6 replies

    KeviSunshine
    Expert Problem Solver III
    Expert Problem Solver III
    June 8, 2023

    For what it’s worth, this sounds like a helpful feature with an obvious use case, and the documentation should reflect that a profile’s ID can also be used as an identifier. 

    @jballo919 what did your request body look like? 

    Something like this?

    {
      "data": {
        "type": "event",
        "attributes": {
          "profile": {
            "id": "{klaviyoProfileId}"
          },
          "metric": {
            "name": "{event name}"
          }
        }
      }
    }

    Cheers,

    Kevin.

    jballo919Author
    Contributor I
    June 8, 2023

     Ah sorry I should have used “External ID” as the keyword in my original post - I found that I can pass just an external identifier in the `$id` field of the `profile` part of the request body, and this will set the external ID on the profile.

     

    Example request:

    {
      "data": {
        "type": "event",
        "attributes": {
          "profile": {
            "$id": "{externalID}"
          },
          "metric": {
            "name": "{event name}"
          }
        }
      }
    }

    This will then create a new profile (with some Klaviyo Profile ID that gets set), and put the string I put in `$id` as the external ID of that profile.

     

    Example:

     

    In this example, I sent `$id` as `”c06b1996-d2fb-45a7-a834-8882a9f2f842”`

     

    I also found that if I send this on an event where I send the email of an existing profile, this will reset the External ID on the profile matching that email.

     

    It would be great if both of these are documented features of the API, so that I can confirm that I can build our integration with these assumptions in mind.

    jballo919Author
    Contributor I
    June 9, 2023

    @KeviSunshine any update on this topic? Is this a feature of the API that is supposed to exist, and can it be added to the documentation?

    KeviSunshine
    Expert Problem Solver III
    Expert Problem Solver III
    June 9, 2023

    Hey @jballo919,

    I wish I could help you more but I am not affiliated with Klaviyo in any official capacity! I am just a fellow developer that uses Klaviyo a lot and sometimes hangs out on the forums!

    Lets ping @David To on this one. He’s the community manager :)

     

    My opinion is that this functionality is intentional and will continue to be supported. 

    From my experience, Klaviyo doesn’t update their developer documentation very frequently and it’s often lacking options/examples/advanced scenarios.

     

    Cheers,

    Kevin.

    Brian Turcotte
    Klaviyo Alum
    June 16, 2023

    Hi @jballo919 and @KeviSunshine!

    Thanks for bringing this up! I’m going to check with Engineering to confirm this functionality and adjust the documentation if necessary, and then I’ll update the thread!

     

    Best,
    - Brian

    Omar
    Partner - Platinum
    OmarAnswer
    2025 Champion
    June 16, 2023

    @jballo919 I'm not a developer but I know that Klaviyo does allow you to use your own identifiers instead of email. 

    They do advise against using them, or better said to use email as an identifier and if you do want to use id's you're responsible for the identity management.

    I suggest to read this part of the documentation about this.

    https://developers.klaviyo.com/en/v1-2/docs/custom-integration-faqs#should-i-use-email-or-id-as-my-unique-identifier

     

    Does that help?

     

    Regards,

    Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

    We help with e-commerce growth through CRO, Klaviyo and CVO

    Helping E-commerce brands maximize Lifetime Value & Profits with Klaviyo, CRO & CVO - Get your free Audit - https://link.polarisgrowth.com/free-audit