---
title: "Create an In-Page Event"
method: POST
path: "/pages/{page_id}/events"
tags: ["Events"]
---

# Create an In-Page Event

`POST /pages/{page_id}/events`

Create an Event that occurs in the context of a Page, such as measuring clicks

## Path parameters

- `page_id` integer, required

## Request body

- InPageEvent — An Event that can occur only within the context of a specific Page (allowed in Web Projects only)
  - `archived` boolean — Whether or not this Event is archived
  - `category` 'add_to_cart' | 'save' | 'search' | 'share' | 'purchase' | 'convert' | 'sign_up' | 'subscribe' | 'other'
  - `config` InPageEventConfig
    - `selector` string, required — CSS selector for the page element(s) that trigger an Event
  - `created` string, date-time — Creation date for this Event
  - `description` string — A description of this Event
  - `event_type` 'click', required — The type of this Event
  - `experiment_count` integer — Number of experiments that reference this Event across all statuses (running, paused, draft, archived). Computed by the upstream service.
  - `id` integer — The unique identifier of the Event
  - `is_classic` boolean — Whether or not this Event is a classic Event. If true, the Event is read-only
  - `is_editable` boolean — Whether or not this Event may be edited
  - `key` string — Unique string identifier for this Event within the Project
  - `last_modified` string, date-time — The last time the Event was modified
  - `name` string, required — A human readable name for this Event
  - `page_id` integer — The Page ID associated with this Event
  - `project_id` integer — The ID of this Event's parent Project
  - `variation_specific` boolean — Whether or not this Event is variation specific.

## Response `201`

Return the created In-Page event

- InPageEvent — An Event that can occur only within the context of a specific Page (allowed in Web Projects only)
  - `archived` boolean — Whether or not this Event is archived
  - `category` 'add_to_cart' | 'save' | 'search' | 'share' | 'purchase' | 'convert' | 'sign_up' | 'subscribe' | 'other'
  - `config` InPageEventConfig
    - `selector` string, required — CSS selector for the page element(s) that trigger an Event
  - `created` string, date-time — Creation date for this Event
  - `description` string — A description of this Event
  - `event_type` 'click', required — The type of this Event
  - `experiment_count` integer — Number of experiments that reference this Event across all statuses (running, paused, draft, archived). Computed by the upstream service.
  - `id` integer — The unique identifier of the Event
  - `is_classic` boolean — Whether or not this Event is a classic Event. If true, the Event is read-only
  - `is_editable` boolean — Whether or not this Event may be edited
  - `key` string — Unique string identifier for this Event within the Project
  - `last_modified` string, date-time — The last time the Event was modified
  - `name` string, required — A human readable name for this Event
  - `page_id` integer — The Page ID associated with this Event
  - `project_id` integer — The ID of this Event's parent Project
  - `variation_specific` boolean — Whether or not this Event is variation specific.

## Other responses

- `400` — Invalid Page ID or request body supplied
- `401` — Invalid credentials
- `403` — You do not have permission to add an In-Page event
- `default` — Unexpected error

## Changes

> 7 revisions in range; 3 could not be searched.

- **2026-08-04** `35d56dc0d1b9` — 2 info
  - added the new optional request property `variation_specific`
  - added the optional property `variation_specific` to the response with the `201` status

[Change history](https://skmtc.dev/optimizely/apis/optimizely-api/changes/pages/:page_id/events/post.md)

---

[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)
