---
title: "Create a Custom Event"
method: POST
path: "/projects/{project_id}/custom_events"
tags: ["Events"]
---

# Create a Custom Event

`POST /projects/{project_id}/custom_events`

Create a Custom Event in a provided Project

## Path parameters

- `project_id` integer, required

## Request body

- CustomEvent
  - `archived` boolean — Whether or not to archive this Event
  - `category` 'add_to_cart' | 'save' | 'search' | 'share' | 'purchase' | 'convert' | 'sign_up' | 'subscribe' | 'other'
  - `created` string, date-time — Creation date for this Event
  - `description` string — A description of this Event
  - `event_properties` EventProperty[] — A set of user-defined data elements for the event. Metrics can filter on particular values of these properties.
    - `data_type` 'boolean' | 'number' | 'string' — The type of data that can be accepted for this property.
    - `name` string — The name of the property.
  - `event_type` 'custom' — The type of this Event
  - `id` integer — The unique identifier of the Event
  - `is_classic` boolean — Whether or not this Event is a classic Event. If true, this Event is read-only
  - `is_editable` boolean — Whether or not this Event may be edited
  - `key` string, required — Unique string identifier for this Event within the Project
  - `name` string — A human readable name for this Event. If unspecified, defaults to the key
  - `project_id` integer — The ID of this Event's parent Project

## Response `201`

Return the created Custom Event

- CustomEvent
  - `archived` boolean — Whether or not to archive this Event
  - `category` 'add_to_cart' | 'save' | 'search' | 'share' | 'purchase' | 'convert' | 'sign_up' | 'subscribe' | 'other'
  - `created` string, date-time — Creation date for this Event
  - `description` string — A description of this Event
  - `event_properties` EventProperty[] — A set of user-defined data elements for the event. Metrics can filter on particular values of these properties.
    - `data_type` 'boolean' | 'number' | 'string' — The type of data that can be accepted for this property.
    - `name` string — The name of the property.
  - `event_type` 'custom' — The type of this Event
  - `id` integer — The unique identifier of the Event
  - `is_classic` boolean — Whether or not this Event is a classic Event. If true, this Event is read-only
  - `is_editable` boolean — Whether or not this Event may be edited
  - `key` string, required — Unique string identifier for this Event within the Project
  - `name` string — A human readable name for this Event. If unspecified, defaults to the key
  - `project_id` integer — The ID of this Event's parent Project

## Other responses

- `400` — Invalid request body supplied
- `401` — Invalid credentials
- `403` — You do not have access to the specified Project
- `default` — Unexpected error

---

[API](https://skmtc.dev/optimizely/apis/optimizely-api.md) · [All operations](https://skmtc.dev/optimizely/apis/optimizely-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/optimizely/optimizely-api/revisions/5151fe6a2297/schema)
