Skip to main content

Event Payload Shape

v1.0.0

Event-envelope shape generator — CloudEvents v1, custom envelope, idempotency-key contract.

Event Payload Schema
// CloudEvents v1.0 envelope + typed payload

interface OrderPlacedEvent {
  // CloudEvents envelope
  specversion: "1.0";
  id: string;          // UUID
  source: "/order-service";
  type: "order.placed";
  datacontenttype: "application/json";
  time: string;        // ISO 8601
  dataschema?: string; // optional schema URL
  // Payload
  data: {
  orderId: string;
  customerId: string;
  totalAmount: number;
  items: Record<string, unknown>[];
  currency: string;
  };
}

// Example JSON:
{
  "specversion": "1.0",
  "id": "01234567-89ab-cdef-0123-456789abcdef",
  "source": "/order-service",
  "type": "order.placed",
  "datacontenttype": "application/json",
  "time": "2026-06-09T11:11:12.863Z",
  "data": {
    "orderId": "example",
    "customerId": "example",
    "totalAmount": 0,
    "items": [],
    "currency": "example"
  }
}