# Get usage report

> Management API · Reports

```http
POST https://app.mk.io/api/v1/organization/reports/usage
```

Returns meter-level usage aggregated by set granularity over the specified date range.

- Can be filtered by `projectNames`, `paymentMethodIds` or `meterNames`.
- Maximum date range depends on granularity: 31 days (`hour`), 1 year (`day`), unlimited (`week`, `month`, `year`).
- Day boundaries use UTC; `startDate` is inclusive and `endDate` is exclusive (previously also inclusive).
- To get a monthly report for January, use `startDate=2026-01-01` and `endDate=2026-02-01`.
- The response include `date` and `date_processed` fields. `date` is the time when the usage happened, while `date_processed` is when the usage was ingested into our system and processed for billing purposes.
- Set `filterOnReportedDate=true` to filter by `date_processed` instead of `date`. This might include usage that occurred before the `startDate` if it was processed during the date range.
- Set `format=csv` and `download=true` to receive a file download.

RBAC Capability Required: `core.customer.get`

## Authentication

- `Authorization` header — Bearer authentication of the form `Bearer <token>`.

## Request body

Content type: `application/json`

- `download` · boolean · Optional · _Defaults to false_ — When true, sets response headers to prompt a browser file download.
- `endDate` · string · **Required** · _format: date_ — End date of the usage report (exclusive). This use to be inclusive. To get a full month of usage, set both startDate and endDate to the first of the month. Maximum range depends on granularity: 31 days for 'hour', 1 year for 'day', unlimited for 'week', 'month', or 'year'.",
- `filterOnReportedDate` · boolean · Optional · _Defaults to false_ — When true, filters usage by report_time (when the usage was charged) rather than sample_time (when it occurred). Useful for reconciling against invoice dates. Defaults to false.
- `format` · enum · Optional · _Defaults to json_ — Response format. Either 'json' or 'csv'. Defaults to 'json'.
  - Allowed values: `json`, `csv`
- `granularity` · enum · Optional · _Defaults to day_ — Time bucket for aggregation. Defaults to 'day'.
  - Allowed values: `year`, `month`, `week`, `day`, `hour`
- `groupBy` · list of strings · Optional — Fields to group results by. Only 'meter' is currently valid. Defaults to ['meter'].
  - Array items (string):
- `meterNames` · list of strings · Optional — Filter results to the specified meter names.
  - Array items (string):
- `paymentMethodIds` · list of strings · Optional — Filter results to the specified payment method IDs. Mutually exclusive with projectNames.
  - Array items (string):
- `projectNames` · list of strings · Optional — Filter results to the specified project names. Mutually exclusive with paymentMethodIds.
  - Array items (string):
- `startDate` · string · **Required** · _format: date_ — Start date of the usage report (inclusive).

## Example request

```bash
curl -X POST "https://app.mk.io/api/v1/organization/reports/usage" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "download": true,
  "endDate": "2025-04-01",
  "filterOnReportedDate": true,
  "format": "csv",
  "granularity": "hour",
  "paymentMethodIds": [
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  ],
  "startDate": "2025-03-01"
}'
```

## Responses

### 200 — OK

- `supplemental` · object · **Required** — Metadata pertaining to the query.
  - `download` · boolean · **Required** — Whether browser was indicated to download file
  - `end` · string · **Required** · _format: date_ — The end date of the query.
  - `filters` · object · **Required** — The filters applied to the query.
    - `meterNames` · list of strings · **Required** — Meter names the results were filtered to.
      - Array items (string):
    - `paymentMethodIds` · list of strings · **Required** — Payment method IDs the results were filtered to.
      - Array items (string):
    - `projectNames` · list of strings · **Required** — Project names the results were filtered to.
      - Array items (string):
  - `format` · string · **Required** — The output format. Either csv or json.
  - `granularity` · string · **Required** — The time bucket used for aggregation.
  - `groupBy` · list of strings · **Required** — The list of fields that the results are grouped by.
    - Array items (string):
  - `records` · integer · **Required** — The number of result records returned.
  - `start` · string · **Required** · _format: date_ — The start date of the query.
- `value` · list of objects · **Required** — The usage data per day per meter
  - Array items (object):
    - `cost` · string · **Required** — Monetary value of usage for this record, in the currency specified by the currency field. How this is charged depends on the entitlement type: for a license entitlement the amount is fully covered and nothing is billed; for cash, quantity, or pre-commitment entitlements this amount is deducted from the entitlement balance; with no entitlement the amount is billed directly.
    - `currency` · string · **Required** — The currency of the cost field.
    - `date` · string · **Required** · _format: date-time_ — The date and time of this usage record. Truncated to the granularity of the query (e.g. if granularity is 'day' then time will be 00:00:00).
    - `dateProcessed` · string or null · Optional · _format: date-time_ — The report_time truncated to the requested granularity. Null for usage that has not yet been charged. Comparing against date (sample_time) reveals late-reported data.
    - `entitlement` · string or null · Optional · _format: uuid_ — The ID of the entitlement applied to this usage. Can be joined against the /entitlements endpoint.
    - `entitlementType` · string or null · Optional — The type of entitlement applied to this usage, if any.
    - `family` · string · Optional — Product family this meter belongs to.
    - `meterName` · string · **Required** — The meter name.
    - `meterSku` · string or null · Optional — The SaaS SKU identifier for this meter.
    - `paymentMethod` · string · Optional · _format: uuid_ — The ID of the payment method associated with this usage.
    - `paymentMethodName` · string or null · Optional — The display name of the payment method associated with this usage.
    - `price` · double · Optional — Per-unit price for this record (cost / quantity).
    - `project` · string · Optional — The name of the project this usage belongs to.
    - `quantity` · double · **Required** — Total units accrued for this record.
    - `solution` · string · Optional — Solution within the product family this meter belongs to.
    - `unit` · string or null · Optional — The unit that this meter is reported in, e.g. 'gigabytes' or 'minutes'.

Example:

```json
{
  "supplemental": {
    "download": true,
    "end": "2024-01-01",
    "filters": {
      "meterNames": [
        "string"
      ],
      "paymentMethodIds": [
        "00000000-0000-0000-0000-000000000000"
      ],
      "projectNames": [
        "string"
      ]
    },
    "format": "string",
    "granularity": "string",
    "groupBy": [
      "string"
    ],
    "records": 0,
    "start": "2024-01-01"
  },
  "value": [
    {
      "cost": "string",
      "currency": "string",
      "date": "2024-01-01T00:00:00Z",
      "dateProcessed": "2024-01-01T00:00:00Z",
      "entitlement": "00000000-0000-0000-0000-000000000000",
      "entitlementType": "string",
      "family": "string",
      "meterName": "string",
      "meterSku": "string",
      "paymentMethod": "00000000-0000-0000-0000-000000000000",
      "paymentMethodName": "string",
      "price": 0,
      "project": "string",
      "quantity": 0,
      "solution": "string",
      "unit": "string"
    }
  ]
}
```

### 400 — Bad Request

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 401 — Unauthorized

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 403 — Forbidden

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 404 — Not Found

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 409 — Conflict

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 429 — Too Many Requests

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 500 — Internal Server Error

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

---

Source spec: `management-api` · operationId: `[post]_/api/v1/organization/reports/usage`
