TransaktDocs
API referenceMetered usage

Report metered usage

POST
/api/v1/metered-usage

Report usage on the custom meter dimensions of flat-rate Microsoft Marketplace plans: 1 to 100 records, each for one tenant, product, dimension and UTC hour. Each record is checked and saved on its own; the answer has one result per record, in the order sent. An Idempotency-Key header is honoured but not required, because each hour of each dimension is reported once. Scope usage:write (app role Usage.Write.All).

Errors: request.validation_failed, api_client.scope_not_allowed, metering.window_not_ended, metering.subscription_not_found, metering.subscription_ambiguous, metering.window_already_reported, metering.subscription_not_active, metering.marketplace_subscription_missing, metering.not_metered, metering.unknown_dimension, metering.window_too_old, auth.credentials_invalid, auth.forbidden, request.rate_limited.

Authorization

headerAuthorizationBearer <token>

A Microsoft Entra client-credentials token for the Transakt API (scope api://{apiAppId}/.default), issued in the tenant recorded on the API client credential, with the app role matching the operation: Entitlement.Read.All, Catalogue.Read.All or Usage.Write.All.

Scope: api://{apiAppId}/.default

Request Body

application/json
  1. body

ReportUsageRequest (P-07): 1 to 100 usage records.

records*|array<>
Items1 <= items <= 100

Response Body

OK

application/json
  1. response

UsageBatchResult (P-07): one result per record, in the order sent.

recorded*integer
Formatint32
refused*integer
Formatint32
results*array<>
curl -X POST "https://example.com/api/v1/metered-usage" \  -H "Content-Type: application/json" \  -d '{    "records": null  }'
{  "recorded": 0,  "refused": 0,  "results": [    {      "index": 0,      "outcome": "string",      "reportId": null,      "subscriptionId": null,      "status": null,      "dimension": null,      "quantity": null,      "usageStartAt": null,      "usageEndAt": null,      "error": null    }  ]}