BillingUsageRecordResult billing.usage-record-result@1

Generated at from openvibe-contracts v0.86.0 and openvibe-sdk v0.26.0.

Version
1.0.0
Owner
billing
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/billing/usage-record-result.v1.json

billing.usage-record-result@1: answer of billing.usage.record on OpenVibe.Billing. POST /api/v1/usage → { record } (201 when stored; 200 with `Idempotent-Replayed: true` when the same reading was already stored under its idempotency_key). Storing a reading charges nothing.

Fields

FieldTypeRequiredDescriptionConstraints
recordobjectyes
record.idstringyes
record.idempotency_keystringyesThe reading's own idempotency_key
record.projectstring | null
record.subjectstring | null
record.servicestringyes
record.atstringyes
  • format date-time
record.received_atstringyes
  • format date-time
record.principalstringyesThe service principal that recorded the reading
record.readingplatform.usage-sampleyes

Examples

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

Valid: recorded
{
  "record": {
    "id": "1",
    "idempotency_key": "media:delivery:2",
    "project": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "subject": "user:usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "service": "media",
    "at": "2026-09-30T10:00:00.000Z",
    "received_at": "2026-09-30T10:00:01.000Z",
    "principal": "media",
    "reading": {
      "id": "use-2",
      "idempotency_key": "media:delivery:2",
      "service": "media",
      "project": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
      "subject": "user:usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
      "operation": "deliver",
      "quantity": 1.5,
      "unit": "GiB",
      "at": "2026-09-30T10:00:00Z",
      "source": "media.egress",
      "free_allowance_used": 1,
      "vibes_charged": 4
    }
  }
}
Rejected: reading-without-idempotency-key
{
  "record": {
    "id": "1",
    "idempotency_key": "media:delivery:2",
    "project": null,
    "subject": null,
    "service": "media",
    "at": "2026-09-30T10:00:00.000Z",
    "received_at": "2026-09-30T10:00:01.000Z",
    "principal": "media",
    "reading": {
      "id": "use-2",
      "service": "media",
      "operation": "deliver",
      "quantity": 1.5,
      "unit": "GiB",
      "at": "2026-09-30T10:00:00Z",
      "source": "media.egress"
    }
  }
}

Validate

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