.do
ApiAnalytics

EventSchema

A schema definition for Segment events that specifies required properties, data types, and validation rules for tracking consistency.

EventSchema

A schema definition for Segment events that specifies required properties, data types, and validation rules for tracking consistency.

Properties

  • id (string): Unique identifier for the event schema.
  • name (string): Name of the event (e.g., Product Viewed, Order Completed).
  • description (string): Description of what the event represents.
  • type (string): Schema type (track, identify, page, screen, group, alias).
  • version (string): Schema version number.
  • workspace (string): Workspace ID this schema belongs to.
  • trackingPlan ([[TrackingPlan]]): Tracking plan this schema is part of.
  • properties (object[]): Event property definitions with types and validation.
  • requiredProperties (string[]): List of required property names.
  • optionalProperties (string[]): List of optional property names.
  • traits (object[]): User trait definitions for identify calls.
  • context (object): Context property requirements.
  • createdAt (string): ISO 8601 timestamp when schema was created.
  • updatedAt (string): ISO 8601 timestamp when schema was last updated.
  • createdBy (string): User ID who created the schema.
  • status (string): Schema status (draft, published, deprecated).
  • metadata (object): Schema metadata and custom properties.
  • propertyTypes (object): Allowed data types for each property.
  • validationRules (object[]): Custom validation rules (regex, range, enum).
  • examples (object[]): Example events that match this schema.
  • violations (object[]): Recent schema violations detected.
  • tags (string[]): Tags for categorizing schemas.
  • deprecated (boolean): Whether this schema is deprecated.
  • deprecationDate (string): ISO 8601 timestamp when schema was deprecated.

Actions

create

Create a new event schema.

Input: [[EventSchema]]
Output: [[EventSchema]]

update

Update event schema definition.

Input: [[EventSchema]]
Output: [[EventSchema]]

delete

Delete an event schema.

Input: [[EventSchema]]
Output: [[EventSchema]]

publish

Publish schema for enforcement.

Input: [[EventSchema]]
Output: [[EventSchema]]

deprecate

Mark schema as deprecated.

Input: [[EventSchema]]
Output: [[EventSchema]]

validate

Validate event against schema.

Input: [[EventValidation]]
Output: [[ValidationResult]]

addProperty

Add property definition to schema.

Input: [[PropertyDefinition]]
Output: [[EventSchema]]

removeProperty

Remove property from schema.

Input: [[PropertyDefinition]]
Output: [[EventSchema]]

updateProperty

Update property definition.

Input: [[PropertyDefinition]]
Output: [[EventSchema]]

getViolations

Get schema violations for time period.

Input: [[ViolationQuery]]
Output: [[SchemaViolation]][]

generateCode

Generate SDK code for schema.

Input: [[CodeGeneration]]
Output: [[GeneratedCode]]

Events

  • created: Triggered when a schema is created.
  • updated: Triggered when schema is updated.
  • deleted: Triggered when a schema is deleted.
  • published: Triggered when schema is published.
  • deprecated: Triggered when schema is deprecated.
  • violated: Triggered when event violates schema.
  • propertyAdded: Triggered when property is added.
  • propertyRemoved: Triggered when property is removed.
  • propertyUpdated: Triggered when property is updated.