Klaviyo API for creating Event

This API is used to create a new event to track a profile’s activity.

Note that this endpoint allows you to create a new profile or update an existing profile’s properties.

Method: Post

Endpoint: https://a.klaviyo.com/api/events/

curl --request POST 
   --url https://a.klaviyo.com/api/events/ 
   --header 'Authorization: Klaviyo-API-Key your-private-api-key' 
   --header 'accept: application/json' 
   --header 'content-type: application/json' 
   --header 'revision: 2024-06-15' 
   --data '
{
 "data": {
  "type": "event",
  "attributes": {
   "properties": {
    "newKey": "New Value"
   },
   "time": "2022-11-08T00:00:00+00:00",
   "value": 9.99,
   "value_currency": "USD",
   "metric": {
    "data": {
     "type": "metric",
     "attributes": {
      "name": "Viewed Product"
     }
    }
   },
   "profile": {
    "data": {
     "type": "profile",
     "attributes": {
      "phone_number": "+15005550006",
      "first_name": "Sarah",
      "last_name": "Mason",
      "organization": "Example Corporation",
      "title": "Regional Manager",
      "image": "https://images.pexels.com/photos/3760854/pexels-photo-3760854.jpeg",
      "location": {
       "address1": "89 E 42nd St",
       "address2": "1st floor",
       "city": "New York",
       "country": "United States",
       "region": "NY",
       "zip": "10017",
       "timezone": "America/New_York",
       "ip": "127.0.0.1"
      },
      "properties": {
       "newKey": "New Value"
      },
      "meta": {
       "patch_properties": {
        "append": {
         "newKey": "New Value"
        },
        "unappend": {
         "newKey": "New Value"
        },
        "unset": "skus"
       }
      },
      "email": "sarah.mason@klaviyo-demo.com"
     }
    }
   }
  }
 }
}
'

Leave a comment

Your email address will not be published. Required fields are marked *