Register an Event Schema
Register an Event Schema
Use Schemas (/schemas) or Admin → Schema Tools. Machine writes require
schemas.write; human roles are authorized separately. Use the API URL and token
from your configured integration.
Start with a payload such as {"example":true}. Compile-check the schema and
examples using POST /api/v1/schemas/validate; expect valid: true and
schemaValid: true. Inference at POST /api/v1/schemas/infer produces a draft
for explicit review. Check version conflicts with POST /api/v1/schemas/dry-run
before registration.
curl -sf -X POST "$API_URL/api/v1/schemas" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"slug": "page-view",
"name": "Page View",
"version": "1.0.0",
"jsonSchema": "{\"type\":\"object\",\"properties\":{\"example\":{\"type\":\"boolean\"}},\"required\":[\"example\"],\"additionalProperties\":true}",
"enabled": true,
"isActive": true
}'
Once active, events with eventTypeSlug: "page-view" and
schemaVersion: "1.0.0" validate against that schema.
Verify the registered version in Schemas and send one matching event. If validation fails, correct the server diagnostics before registering. On version conflict, inspect the existing definition and create an appropriate new version; do not silently change the meaning of an existing version.