Skip to main content

Event Spec Reference

Full field reference for event spec YAML files.

File location

specs/<namespace>/<event_name>/<version>.yaml

Top-level fields

FieldTypeRequiredDescription
$schemastringYesSchema identifier. Use "https://event-spec.io/schemas/event/v1".
namestringYesMachine-readable event name in snake_case.
display_namestringYesHuman-readable name shown in the catalog.
versionstringYesSchemaVer string: MAJOR-MINOR-PATCH (e.g. 1-0-0).
statusstringYesLifecycle status: draft | active | deprecated | deleted.
namespacestringYesLogical grouping. Must match the directory name.
typestringYesAnalytics call type: track | identify | group | page | alias.
event_namestringYesThe exact string sent to analytics providers (e.g. "Product Viewed").
descriptionstringNoDocumentation string shown in the catalog.
propertiesmapNoProperty definitions (see below).
hooksobjectNoPer-event hook config overrides (see below).
tagslist[string]NoArbitrary tags for filtering in the registry.

Property fields

Each key in properties is the property name (in snake_case). The value is a property definition:

FieldTypeRequiredDescription
typestringYesstring | number | integer | boolean | object | array
requiredboolNoWhether the property must be present. Default: false.
descriptionstringNoDocumentation string.
enumlistNoAllowed values. Generated as typed enum constants.
patternstringNoRegex pattern (string type only).
minimumnumberNoMinimum value (number / integer types only).
maximumnumberNoMaximum value (number / integer types only).
defaultanyNoDefault value used in documentation and catalog. Not enforced at runtime.
aliaseslist[string]NoAlternative property names (for ingestion normalization).

Status lifecycle

Statusvalidate behaviorCodegenAudit
draftValidated (no warning)IncludedIncluded
activeValidated strictlyIncludedIncluded
deprecatedWarning emitted; error with --strictIncludedIncluded
deletedWarning emitted; error with --strictExcludedExcluded

Hook config

Per-event hook overrides — these override the hook's global defaults for this specific event:

hooks:
sampling:
strategy: user_id_hash # user_id_hash | random
rate: 0.5 # 0.0–1.0

validation:
mode: strict # strict | warn

SchemaVer bump rules

See Concepts — Event Contract for the full breaking-change table.

Complete example

$schema: "https://event-spec.io/schemas/event/v1"
name: checkout_completed
display_name: "Checkout Completed"
version: "2-1-0"
status: active
namespace: ecommerce
type: track
event_name: "Checkout Completed"
description: "Fired when a user completes the checkout flow and the order is confirmed."
tags: [revenue, critical]

properties:
order_id:
type: string
required: true
description: "Unique order identifier"
total:
type: number
required: true
minimum: 0
description: "Order total in the given currency"
currency:
type: string
required: false
default: "USD"
pattern: "^[A-Z]{3}$"
description: "ISO 4217 currency code"
items:
type: array
required: true
description: "Line items in the order"
payment_method:
type: string
required: false
enum: [credit_card, paypal, apple_pay, google_pay, bank_transfer]
coupon_code:
type: string
required: false

hooks:
validation:
mode: strict
sampling:
strategy: random
rate: 1.0 # always sample revenue events