EventsUsageRecordedPayload events.usage.recorded@1

Generated at from openvibe-contracts v0.76.0 and openvibe-sdk v0.20.1.

Version
1.0.0
Owner
events
Visibility
first-party
Status
active
Compatibility
backward
Decision
ADR-014
Schema
https://openvibe.network/contracts/events/payloads/events.usage.recorded.v1.json

events.usage.recorded v1 (roadmap WS-N task 4, OpenVibe.Events server/usage.js). One hour of a developer project's use of OpenVibe.Events in one environment: events.app.publish in unit events (quantity counts the events stored; errors the publish requests refused with a problem, such as 429 events.quota_exceeded or 403 events.type_not_allowed) and events.app.subscribe in unit deliveries (quantity counts webhook delivery attempts to the project's subscriptions; errors the attempts without a 2xx, as events.delivery.http_<status>, events.delivery.timeout or events.delivery.failed). Counted in the transaction that stores the events or records the attempt (a refusal right after it is answered); Events stores the rollup as its own event after the hour closes, in the same transaction that marks it sent. The payload is common.usage-recorded@1. Envelope: source events, subject { type: project, id: <project_id> }, visibility internal, priority low, actor service:events.

Fields

This schema has no named fields.

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: deliveries
{
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "env": "production",
  "capability": "events.app.subscribe",
  "unit": "deliveries",
  "window": "hour",
  "window_start": "2026-09-26T10:00:00.000Z",
  "window_end": "2026-09-26T11:00:00.000Z",
  "quantity": 12,
  "errors": 2,
  "error_codes": {
    "events.delivery.http_500": 1,
    "events.delivery.timeout": 1
  },
  "samples": [
    {
      "at": "2026-09-26T10:31:00.000Z",
      "code": "events.delivery.timeout",
      "trace_id": "0af7651916cd43dd8448eb211c80319c",
      "ref": "evt_01JAB2C3D4E5F6G7H8J9K0MNPT"
    },
    {
      "at": "2026-09-26T10:30:00.000Z",
      "code": "events.delivery.http_500",
      "status": 500,
      "trace_id": "0af7651916cd43dd8448eb211c80319c",
      "ref": "evt_01JAB2C3D4E5F6G7H8J9K0MNPT"
    }
  ]
}
Valid: publish-refused
{
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "env": "sandbox",
  "capability": "events.app.publish",
  "unit": "events",
  "window": "hour",
  "window_start": "2026-09-26T09:00:00.000Z",
  "window_end": "2026-09-26T10:00:00.000Z",
  "quantity": 1800,
  "errors": 61,
  "error_codes": {
    "events.quota_exceeded": 60,
    "events.type_not_allowed": 1
  },
  "samples": [
    {
      "at": "2026-09-26T09:59:58.120Z",
      "code": "events.quota_exceeded",
      "status": 429,
      "trace_id": "0af7651916cd43dd8448eb211c80319c"
    }
  ]
}
Rejected: carries-event-payload
{
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "env": "sandbox",
  "capability": "events.app.publish",
  "unit": "events",
  "window": "hour",
  "window_start": "2026-09-26T09:00:00.000Z",
  "window_end": "2026-09-26T10:00:00.000Z",
  "quantity": 1800,
  "errors": 61,
  "error_codes": {
    "events.quota_exceeded": 60,
    "events.type_not_allowed": 1
  },
  "samples": [
    {
      "at": "2026-09-26T09:59:58.120Z",
      "code": "events.quota_exceeded",
      "status": 429,
      "trace_id": "0af7651916cd43dd8448eb211c80319c"
    }
  ],
  "payload": {
    "type": "app.p01jab.order.created"
  }
}
Rejected: first-party-project
{
  "project_id": "live",
  "env": "sandbox",
  "capability": "events.app.publish",
  "unit": "events",
  "window": "hour",
  "window_start": "2026-09-26T09:00:00.000Z",
  "window_end": "2026-09-26T10:00:00.000Z",
  "quantity": 1800,
  "errors": 61,
  "error_codes": {
    "events.quota_exceeded": 60,
    "events.type_not_allowed": 1
  },
  "samples": [
    {
      "at": "2026-09-26T09:59:58.120Z",
      "code": "events.quota_exceeded",
      "status": 429,
      "trace_id": "0af7651916cd43dd8448eb211c80319c"
    }
  ]
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('events.usage.recorded@1', value);   // { valid, errors: [{ path, message }] }