# Bulk Create Events

Create a batch of events for one or more profiles.

Note that this endpoint allows you to create new profiles or update existing profile properties.

At a minimum, profile and metric objects should include at least one profile identifier (e.g., `id`, `email`, or `phone_number`) and the metric `name`, respectively.

Accepts up to 1,000 events per request. The maximum allowed payload size is 5MB.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`

**Scopes:**
`events:write`

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "title": "Events API",
    "version": "2024-10-15",
    "description": "The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.",
    "contact": {
      "name": "Klaviyo Developer Experience Team",
      "email": "developers@klaviyo.com",
      "url": "https://developers.klaviyo.com"
    },
    "termsOfService": "https://www.klaviyo.com/legal/api-terms",
    "license": {
      "name": "License",
      "url": "https://www.klaviyo.com/legal"
    }
  },
  "servers": [
    {
      "url": "https://a.klaviyo.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/event-bulk-create-jobs": {
      "post": {
        "operationId": "bulk_create_events",
        "summary": "Bulk Create Events",
        "description": "Create a batch of events for one or more profiles.\n\nNote that this endpoint allows you to create new profiles or update existing profile properties.\n\nAt a minimum, profile and metric objects should include at least one profile identifier (e.g., `id`, `email`, or `phone_number`) and the metric `name`, respectively.\n\nAccepts up to 1,000 events per request. The maximum allowed payload size is 5MB.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`\n\n**Scopes:**\n`events:write`",
        "parameters": [
          {
            "name": "revision",
            "in": "header",
            "description": "API endpoint revision (format: YYYY-MM-DD[.suffix])",
            "required": true,
            "schema": {
              "type": "string",
              "default": "2024-10-15"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.api+json": {
              "schema": {
                "$ref": "#/components/schemas/EventsBulkCreateJob"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success"
          },
          "4XX": {
            "$ref": "#/components/responses/ClientError"
          },
          "5XX": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "tags": [
          "Events"
        ],
        "x-klaviyo-operation-aliases": [
          "create_event_bulk_create_job"
        ],
        "x-klaviyo-pre-release": "None",
        "x-klaviyo-ratelimit": {
          "burst": "10/s",
          "steady": "150/m"
        },
        "x-klaviyo-scopes": [
          "events:write"
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "EventEnum": {
        "type": "string",
        "enum": [
          "event"
        ]
      },
      "ProfileEnum": {
        "type": "string",
        "enum": [
          "profile"
        ]
      },
      "MetricEnum": {
        "type": "string",
        "enum": [
          "metric"
        ]
      },
      "ProfileLocation": {
        "type": "object",
        "properties": {
          "address1": {
            "description": "First line of street address",
            "type": "string",
            "example": "89 E 42nd St"
          },
          "address2": {
            "description": "Second line of street address",
            "type": "string",
            "example": "1st floor"
          },
          "city": {
            "description": "City name",
            "type": "string",
            "example": "New York"
          },
          "country": {
            "description": "Country name",
            "type": "string",
            "example": "United States"
          },
          "latitude": {
            "description": "Latitude coordinate. We recommend providing a precision of four decimal places.",
            "example": "40.7128",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              }
            ]
          },
          "longitude": {
            "description": "Longitude coordinate. We recommend providing a precision of four decimal places.",
            "example": "74.0060",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              }
            ]
          },
          "region": {
            "description": "Region within a country, such as state or province",
            "type": "string",
            "example": "NY"
          },
          "zip": {
            "description": "Zip code",
            "type": "string",
            "example": "10017"
          },
          "timezone": {
            "description": "Time zone name. We recommend using time zones from the IANA Time Zone Database.",
            "type": "string",
            "example": "America/New_York"
          },
          "ip": {
            "description": "IP Address",
            "type": "string",
            "example": "127.0.0.1"
          }
        }
      },
      "MetricCreateQueryResourceObject": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/MetricEnum"
          },
          "attributes": {
            "properties": {
              "name": {
                "description": "Name of the event. Must be less than 128 characters.",
                "type": "string",
                "example": "Viewed Product"
              },
              "service": {
                "description": "This is for advanced usage. For api requests, this should use the default, which is set to api.",
                "type": "string"
              }
            },
            "required": [
              "name"
            ]
          }
        },
        "required": [
          "type",
          "attributes"
        ]
      },
      "ProfileMetaPatchProperties": {
        "type": "object",
        "properties": {
          "append": {
            "description": "Append a simple value or values to this property array",
            "type": "object",
            "example": {
              "skus": "92538"
            }
          },
          "unappend": {
            "description": "Remove a simple value or values from this property array",
            "type": "object",
            "example": {
              "skus": "40571"
            }
          },
          "unset": {
            "description": "Remove a key or keys (and their values) completely from properties",
            "type": "string",
            "example": "skus"
          }
        }
      },
      "OnsiteProfileMeta": {
        "type": "object",
        "properties": {
          "patch_properties": {
            "description": "Specify one or more patch operations to apply to existing property data",
            "example": {
              "append": {
                "skus": "92538"
              }
            },
            "$ref": "#/components/schemas/ProfileMetaPatchProperties"
          }
        }
      },
      "EventBulkCreateEnum": {
        "type": "string",
        "enum": [
          "event-bulk-create"
        ]
      },
      "OnsiteProfileCreateQueryResourceObject": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ProfileEnum"
          },
          "id": {
            "description": "Primary key that uniquely identifies this profile. Generated by Klaviyo.",
            "type": "string"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "email": {
                "description": "Individual's email address",
                "type": "string",
                "example": "sarah.mason@klaviyo-demo.com"
              },
              "phone_number": {
                "description": "Individual's phone number in E.164 format",
                "type": "string",
                "example": "+15005550006"
              },
              "external_id": {
                "description": "A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.",
                "type": "string"
              },
              "anonymous_id": {
                "type": "string"
              },
              "_kx": {
                "description": "Also known as the `exchange_id`, this is an encrypted identifier used for identifying a\nprofile by Klaviyo's web tracking.\n\nYou can use this field as a filter when retrieving profiles via the Get Profiles endpoint.",
                "type": "string"
              },
              "first_name": {
                "description": "Individual's first name",
                "type": "string",
                "example": "Sarah"
              },
              "last_name": {
                "description": "Individual's last name",
                "type": "string",
                "example": "Mason"
              },
              "organization": {
                "description": "Name of the company or organization within the company for whom the individual works",
                "type": "string",
                "example": "Example Corporation"
              },
              "locale": {
                "description": "The locale of the profile, in the IETF BCP 47 language tag format like (ISO 639-1/2)-(ISO 3166 alpha-2)",
                "type": "string",
                "example": "en-US"
              },
              "title": {
                "description": "Individual's job title",
                "type": "string",
                "example": "Regional Manager"
              },
              "image": {
                "description": "URL pointing to the location of a profile image",
                "type": "string",
                "example": "https://images.pexels.com/photos/3760854/pexels-photo-3760854.jpeg"
              },
              "location": {
                "$ref": "#/components/schemas/ProfileLocation"
              },
              "properties": {
                "description": "An object containing key/value pairs for any custom properties assigned to this profile",
                "type": "object",
                "example": {
                  "pseudonym": "Dr. Octopus"
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/OnsiteProfileMeta"
          }
        },
        "required": [
          "type",
          "attributes"
        ]
      },
      "BaseEventCreateQueryResourceObject": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/EventEnum"
          },
          "attributes": {
            "properties": {
              "properties": {
                "description": "Properties of this event. Any top level property (that are not objects) can be\nused to create segments. The $extra property is a special property. This records any\nnon-segmentable values that can be referenced later. For example, HTML templates are\nuseful on a segment but are not used to create a segment. There are limits\nplaced onto the size of the data present. This must not exceed 5 MB. This must not\nexceed 300 event properties. A single string cannot be larger than 100 KB. Each array\nmust not exceed 4000 elements. The properties cannot contain more than 10 nested levels.",
                "type": "object",
                "example": {
                  "Brand": "Kids Book",
                  "Categories": [
                    "Fiction",
                    "Children"
                  ],
                  "ProductID": 1111,
                  "ProductName": "Winnie the Pooh",
                  "$extra": {
                    "URL": "http://www.example.com/path/to/product",
                    "ImageURL": "http://www.example.com/path/to/product/image.png"
                  }
                }
              },
              "time": {
                "description": "When this event occurred. By default, the time the request was received will be used.\nThe time is truncated to the second. The time must be after the year 2000 and can only\nbe up to 1 year in the future.",
                "type": "string",
                "format": "date-time",
                "example": "2022-11-08T00:00:00+00:00"
              },
              "value": {
                "description": "A numeric, monetary value to associate with this event. For example, the dollar amount of a purchase.",
                "type": "number",
                "example": 9.99
              },
              "value_currency": {
                "description": "The ISO 4217 currency code of the value associated with the event.",
                "type": "string",
                "example": "USD"
              },
              "unique_id": {
                "description": "A unique identifier for an event. If the unique_id is repeated for the same\nprofile and metric, only the first processed event will be recorded. If this is not\npresent, this will use the time to the second. Using the default, this limits only one\nevent per profile per second.",
                "type": "string"
              },
              "metric": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/MetricCreateQueryResourceObject"
                  }
                },
                "required": [
                  "data"
                ]
              }
            },
            "required": [
              "properties",
              "metric"
            ]
          }
        },
        "required": [
          "type",
          "attributes"
        ]
      },
      "EventsBulkCreateQueryResourceObject": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/EventBulkCreateEnum"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "profile": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/OnsiteProfileCreateQueryResourceObject"
                  }
                },
                "required": [
                  "data"
                ]
              },
              "events": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/BaseEventCreateQueryResourceObject"
                    }
                  }
                },
                "required": [
                  "data"
                ]
              }
            },
            "required": [
              "profile",
              "events"
            ]
          }
        },
        "required": [
          "type",
          "attributes"
        ]
      },
      "EventBulkCreateJobEnum": {
        "type": "string",
        "enum": [
          "event-bulk-create-job"
        ]
      },
      "EventsBulkCreateJobResourceObject": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/EventBulkCreateJobEnum"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "events-bulk-create": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/EventsBulkCreateQueryResourceObject"
                    }
                  }
                },
                "required": [
                  "data"
                ]
              }
            },
            "required": [
              "events-bulk-create"
            ]
          }
        },
        "required": [
          "type",
          "attributes"
        ]
      },
      "EventsBulkCreateJob": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/EventsBulkCreateJobResourceObject"
          }
        },
        "required": [
          "data"
        ]
      }
    },
    "responses": {
      "ClientError": {
        "description": "Client Error",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "type": "object",
              "properties": {
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "code",
                      "title",
                      "detail"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "detail": {
                        "type": "string"
                      },
                      "source": {
                        "type": "object",
                        "properties": {
                          "pointer": {
                            "type": "string"
                          },
                          "parameter": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "required": [
                "errors"
              ]
            }
          }
        }
      },
      "ServerError": {
        "description": "Server Error",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "type": "object",
              "properties": {
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "code",
                      "title",
                      "detail"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "detail": {
                        "type": "string"
                      },
                      "source": {
                        "type": "object",
                        "properties": {
                          "pointer": {
                            "type": "string"
                          },
                          "parameter": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "required": [
                "errors"
              ]
            }
          }
        }
      }
    },
    "securitySchemes": {
      "Klaviyo-API-Key": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Private key authentication for /api/ endpoints is performed by setting the `Authorization` header to `Klaviyo-API-Key your-private-api-key`<br>For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#authentication",
        "x-default": "Klaviyo-API-Key your-private-api-key"
      }
    }
  },
  "tags": [
    {
      "name": "Events"
    }
  ],
  "security": [
    {
      "Klaviyo-API-Key": []
    }
  ],
  "x-readme": {
    "explorer-enabled": false,
    "proxy-enabled": true,
    "samples-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 103,
      "1": 14,
      "2": 199,
      "3": 71,
      "4": 109,
      "5": 224,
      "6": 147,
      "7": 0,
      "8": 82,
      "9": 88,
      "10": 175,
      "11": 34
    }
  }
}
```