NodeRings Docs

Record Usage

Record a single usage event (from Prometheus or other monitoring systems)

POST
/v1/usage/record
Authorization<token>

Bearer token

In: header

X-Organization-ID<token>

Tenant or organization identifier

In: header

subscriptionId?string
metricId?string
metricCode?string
quantity?string

Decimal as string

timestamp?string
Formatdate-time
eventId?string

For idempotent writes

properties?object
externalId?string

Response Body

application/json

curl -X POST "https://api.nrings.io/v1/usage/record" \  -H "Authorization: Bearer {your_token}" \  -H "X-Organization-ID: {your_org_id}" \  -H "Content-Type: application/json" \  -d '{  "subscriptionId": "string",  "metricId": "string",  "metricCode": "string",  "quantity": "string",  "timestamp": "string",  "eventId": "string",  "properties": null,  "externalId": "string"}'
{
  "usageRecord": {
    "id": "string",
    "quantity": "string",
    "timestamp": "2019-08-24T14:15:22Z",
    "billingPeriodStart": "2019-08-24T14:15:22Z",
    "billingPeriodEnd": "2019-08-24T14:15:22Z",
    "eventId": "string",
    "properties": {},
    "usageRecordStatus": "USAGE_RECORD_STATUS_UNSPECIFIED",
    "errorMessage": "string",
    "processedAt": "2019-08-24T14:15:22Z",
    "externalId": "string",
    "subscriptionId": "string",
    "metricId": "string",
    "invoiceId": "string",
    "invoiceLineId": "string",
    "subscriptionName": "string",
    "metricName": "string",
    "metricCode": "string",
    "metadata": {},
    "status": "STATUS_UNSPECIFIED",
    "timestamps": {
      "createTime": "2019-08-24T14:15:22Z",
      "updateTime": "2019-08-24T14:15:22Z"
    }
  },
  "isDuplicate": true
}