Skip to main content

Add Consumption

POST /v1/consumption

Create one or more consumption records. The request body can be a single object or an array. Each record must include metadata (service, application) and data (at least one key). Consumption properties are added automatically as records with new property keys are created—you do not need to predefine properties.

You can only add consumption to tenants you have access to: your own tenant or, as a provider, your child tenants. If you omit tenant, records are added to your current (own) tenant. If you omit timestamp, the current server date and time is used.

Custom metadata keys are allowed but limited to 30 characters; values to 40 characters. Returns 201 Created on success; 207 Multi-Status on partial success (some records failed validation); 400 Bad Request if all records fail.

Request Body

{
"timestamp": "2024-02-06T12:00:00.000Z",
"metadata": {
"tenant": "6243089747d40e7229c9e071",
"service": "my-service",
"application": "my-app",
"target": "5035aa2950051155929e6d44",
"user": "user-id-optional"
},
"data": {
"protected_data": 1024000,
"targets": 3,
"count_jobs": 42
}
}

Response Example — Success

Status: 201

{
"consumptionProperties": [
{ "name": "protected_data", "label_name": "Protected data", "metadata": {} }
],
"consumption": [
{
"timestamp": "2024-02-06T12:00:00.000Z",
"metadata": { "tenant": "...", "service": "...", "application": "..." },
"data": { "protected_data": 1024000, "targets": 3, "count_jobs": 42 }
}
],
"failed": []
}

Response Example — Partial success

Status: 207

Same shape as 201; consumption and consumptionProperties contain succeeded records, failed contains rejected ones.

Response Example — Error

Status: 400 – Validation error (e.g. custom field too long, or all records invalid).

Status: 403 – User not allowed to write to one of the record tenants.