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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
record | object | yes | ||
record.id | string | yes | ||
record.idempotency_key | string | yes | The reading's own idempotency_key | |
record.project | string | null | |||
record.subject | string | null | |||
record.service | string | yes | ||
record.at | string | yes |
| |
record.received_at | string | yes |
| |
record.principal | string | yes | The service principal that recorded the reading | |
record.reading | platform.usage-sample | yes |
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 }] }