---
title: "Returns messages usage history of the specified contract within defined period."
method: GET
path: "/runtime-quota-usages/contracts/{contract_id}/messages-usage/history"
tags: ["runtime quota usages"]
---

# Returns messages usage history of the specified contract within defined period.

`GET /runtime-quota-usages/contracts/{contract_id}/messages-usage/history`

Returns aggregated message counts per month for all workspaces of the contract. Only a corresponding contract member or a client with global usage read permission can be authorized to access this resource.
Returns aggregated message counts for the contract within the given period. By default the response is aggregated across all workspaces of the contract. When `per_workspace=true` is provided, the response contains per-workspace breakdown (each item includes `workspaceId`).

## Path parameters

- `contract_id` string, required

## Query parameters

- `from` string, required
- `to` string, required
- `group_by` string
- `per_workspace` string
- `workspace_ids` string[]

## Response `200`

OK

- object
  - `data` object[], required
    - `id` string, required — First day of the usage month (YYYY-MM-DD).
    - `messagesCount` integer, required — Total message count for the month across all contract workspaces.

## Other responses

- `400` — Bad Request (from and to query parameters are required)
- `401` — Unauthorized
- `404` — Not Found

---

[API](https://skmtc.net/elastic/apis/elastic-io-rest-api-documentation-v2.md) · [All operations](https://skmtc.net/elastic/apis/elastic-io-rest-api-documentation-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/elastic-io-rest-api-documentation-v2/revisions/411f9f98c01e/schema)
