---
title: "Create event"
method: POST
path: "/events"
tags: ["events"]
---

# Create event

`POST /events`

## Request body

- CreateEventRequestBody
  - `backfill` boolean, nullable — Requires a secret API key, and trusted_client_clock. Import historical data without affecting billing.
  - `body` union
    - object
      - `company` object — Key-value pairs to identify company associated with track event
      - `event` string, required — The name of the type of track event
      - `lease_id` string — Credit lease ID this track event is redeeming against
      - `quantity` integer — Optionally specify the quantity of the event
      - `traits` object — A map of trait names to trait values
      - `user` object — Key-value pairs to identify user associated with track event
    - object
      - `company_id` string, nullable — Schematic company ID (starting with 'comp_') of the company evaluated, if any
      - `error` string, nullable — Report an error that occurred during the flag check
      - `flag_id` string, nullable — Schematic flag ID (starting with 'flag_') for the flag matching the key, if any
      - `flag_key` string, required — The key of the flag being checked
      - `reason` string, required — The reason why the value was returned
      - `req_company` object, nullable — Key-value pairs used to to identify company for which the flag was checked
      - `req_user` object, nullable — Key-value pairs used to to identify user for which the flag was checked
      - `rule_id` string, nullable — Schematic rule ID (starting with 'rule_') of the rule that matched for the flag, if any
      - `user_id` string, nullable — Schematic user ID (starting with 'user_') of the user evaluated, if any
      - `value` boolean, required — The value of the flag for the given company and/or user
    - object
      - `company` object — Information about the company associated with the user; required only if it is a new user
        - `keys` object, required — Key-value pairs to identify the company
        - `name` string — The display name of the company; required only if it is a new company
        - `traits` object — A map of trait names to trait values
      - `keys` object, required — Key-value pairs to identify the user
      - `name` string — The display name of the user being identified; required only if it is a new user
      - `traits` object — A map of trait names to trait values
  - `event_type` 'flag_check' | 'identify' | 'track', required
  - `idempotency_key` string, nullable — Optional client-supplied key. Duplicate events with the same key (scoped to the environment) are dropped for 24h.
  - `sent_at` string, date-time, nullable — Optionally provide a timestamp at which the event was sent to Schematic
  - `trusted_client_clock` boolean, nullable — Requires a secret API key and sent_at. Use sent_at as the effective timestamp.

## Response `201`

Created

- object
  - `data` RawEventResponseData, required
    - `captured_at` string, date-time, required
    - `event_id` string, nullable
    - `remote_addr` string, nullable
    - `remote_ip` string, required
    - `user_agent` string, required
  - `params` object, required — Input parameters

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not found
- `500` — Server error

## Changes

- **2026-06-25** `5eb95e8d48e1` — 1 breaking
  - the `body/oneOf[subschema #1: EventBodyTrack]/quantity` request property type/format changed from `integer`/`` to `integer`/`int64`
- **2026-05-23** `a8e995c63b8b` — 1 info
  - added the new optional request property `body/oneOf[subschema #1: EventBodyTrack]/lease_id`

[Change history](https://skmtc.dev/schematichq/apis/schematic-api/changes/events/post.md)

---

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