> ## Documentation Index
> Fetch the complete documentation index at: https://getlago.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve usage

> Find received events and check the quantities and amounts calculated for a Contract.

Find the events Lago received and review the quantities and amounts calculated for a Contract’s open billing periods.

## List events

Find received usage events to check your integration or investigate missing usage.

> [tab] Dashboard
>
> 1. Click **Developers** in the sidebar.
> 2. Open the **Events** tab.
> 3. Select an event to view its details and payload.
>
> ![Events tab in the Developers panel, with a received event selected and its properties and payload displayed](https://mintcdn.com/lago-docs/Snyz7mUAt1RvPH8B/v2/guide/events/images/list-events.png?fit=max\&auto=format\&n=Snyz7mUAt1RvPH8B\&q=85\&s=e0abf064d01f311d4a59a9bdd2db78c3)
>
> View received events in the Dashboard

> [tab] API
>
> Use `GET /events` to find events by Contract, billable metric, transaction ID or the time the usage happened. Your API key needs `event` read permission.
>
> The response is split into pages. Use the returned cursors to retrieve additional pages.
>
> | Query parameter | Effect |
> | - | - |
> | `external_contract_id` | Events for one Contract. |
> | `code` | Events for one billable metric code. |
> | `transaction_id` | Events with this transaction identifier. |
> | `timestamp_from` | Include events at or after this time. Use an ISO 8601 date or timestamp. A date without a time means midnight UTC. |
> | `timestamp_to` | Include events at or before this time. Use an ISO 8601 date or timestamp. A date without a time means midnight UTC. |
> | `limit` | Records per page. Values outside the supported range return `400`. |
> | `after`, `before` | Use the values returned in `next_cursor` or `prev_cursor` to navigate the results. |
> | `include_total_count` | Request `total_count` on the first page. If `total_count_estimated` is `true`, the count is an estimate. |
>
> ```bash Events for contract_example in January 2027 theme={"dark"}
> LAGO_URL="https://api.getlago.com"
> API_KEY="__YOUR_API_KEY__"
>
> curl --location --request GET "$LAGO_URL/api/v2/events?external_contract_id=contract_example&code=api_calls&timestamp_from=2027-01-01T00:00:00Z&timestamp_to=2027-01-31T23:59:59.999999Z&limit=100" \
>   --header "Authorization: Bearer $API_KEY"
> ```
>
> ```bash Find events by transaction ID theme={"dark"}
> LAGO_URL="https://api.getlago.com"
> API_KEY="__YOUR_API_KEY__"
>
> curl --location --request GET "$LAGO_URL/api/v2/events?transaction_id=api_20270114_customer_example_00001" \
>   --header "Authorization: Bearer $API_KEY"
> ```
>
> Both timestamp bounds are inclusive. Include fractional seconds in an end-of-day bound so you do not omit events received during the final second.
>
> ### Read the response
>
> Each event returns `transaction_id`, `external_contract_id`, `code`, `properties`, `precise_total_amount_cents` and `timestamp` (UTC, microsecond precision). The response also includes cursors for navigating the results.
>
> ```json Response (trimmed) theme={"dark"}
> {
>   "events": [
>     {
>       "transaction_id": "api_20270114_customer_example_00001",
>       "external_contract_id": "contract_example",
>       "code": "api_calls",
>       "precise_total_amount_cents": null,
>       "properties": {},
>       "timestamp": "2027-01-14T08:40:00.000000Z"
>     }
>   ],
>   "meta": {
>     "next_cursor": null,
>     "prev_cursor": null
>   }
> }
> ```
>
> ### Read additional pages
>
> 1. Copy `meta.next_cursor` from the response.
> 2. Send it as `after` in your next request, keeping the same filters.
> 3. Continue until there is no next cursor.
>
> Use the cursor exactly as returned. Do not build it from event fields.
>
> The order of results depends on the event store:
>
> * ClickHouse-based organizations return enriched events ordered by `timestamp`, `external_contract_id`, `code` and `transaction_id`, all descending.
> * PostgreSQL-based organizations order by creation time and identifier, both descending.
>
> See [Pagination](https://getlago.com/docs/v2/api-reference/pagination.md).
>
> ### If an event is missing
>
> 1. Check the response to your ingestion request. A `422` means the event was rejected.
> 2. Check that your retrieval filters match the event's `external_contract_id`, `code` and `transaction_id`.
> 3. Check that its `timestamp` falls within your `timestamp_from` and `timestamp_to` range.
> 4. Check the remaining result pages.
> 5. If the event was just accepted, wait and repeat the retrieval request. Newly accepted events may not appear immediately.

## Retrieve current usage

Review a Contract’s calculated quantities and amounts for its open billing periods, grouped by applied Rate Card. These values can change before invoicing.

> [tab] Dashboard
>
> 1. Open the Contract from the customer’s page or the Contract list.
> 2. Click the **Usage** tab.
> 3. Browse usage by Product category, if applicable.
> 4. Review the quantities, amounts and billing periods.
>
> ![Contract Usage tab showing total current usage and GPU compute usage with quantities, amounts and billing periods](https://mintcdn.com/lago-docs/Snyz7mUAt1RvPH8B/v2/guide/events/images/current-usage.png?fit=max\&auto=format\&n=Snyz7mUAt1RvPH8B\&q=85\&s=897670b0c66d8aaeafb953fa3a0cdd2a)
>
> Review a Contract’s current usage by Product category

> [tab] API
>
> Your API key needs `customer_usage` read permission.
>
> ```bash Current usage of contract_example theme={"dark"}
> LAGO_URL="https://api.getlago.com"
> API_KEY="__YOUR_API_KEY__"
>
> curl --location --request GET "$LAGO_URL/api/v2/contracts/contract_example/current_usage" \
>   --header "Authorization: Bearer $API_KEY"
> ```
>
> ```bash Metered products only theme={"dark"}
> LAGO_URL="https://api.getlago.com"
> API_KEY="__YOUR_API_KEY__"
>
> curl --location --request GET "$LAGO_URL/api/v2/contracts/contract_example/current_usage?product_type=metered" \
>   --header "Authorization: Bearer $API_KEY"
> ```
>
> ### Filter results
>
> | Query parameter | Effect |
> | - | - |
> | `rate_card_code` | One applied Rate Card. |
> | `product_code` | One Product. |
> | `product_filter_code` | One Product filter. |
> | `product_type` | `fixed` or `metered`. |
> | `apply_taxes` | Whether to apply taxes. Defaults to `true`. |
> | `contract_code` | Select a specific Contract when several share the external identifier. |
>
> ### Read the response
>
> Use `contract_code` when several Contracts share the `external_id`, for example `GET /contracts/contract_example/current_usage?contract_code=contract_example_2027`. Without it, an ambiguous identifier is rejected.
>
> * Pending and canceled Contracts have no current usage. Active and terminated Contracts can return usage while their billing windows remain open and the Contract has not passed its end time.
> * Totals cover the open billing windows of every applied Rate Card. Because each card follows its own timeline, totals may span several future invoices.
> * Amounts are in cents of the Contract's billing `currency`.
> * The data is provisional. The billing windows are still open and new events keep accruing.
>
> | Field | Meaning |
> | - | - |
> | `external_contract_id`, `external_customer_id` | The Contract and its customer. |
> | `currency` | Billing currency. |
> | `amount_cents` | Amount excluding tax. |
> | `taxes_amount_cents` | Tax amount. |
> | `total_amount_cents` | Amount including tax. |
> | `rate_cards[]` | One entry per applied Rate Card billing window. |
>
> For each `rate_cards[]` entry, check:
>
> | Field | Meaning |
> | - | - |
> | `rate_card_code`, `product_code`, `product_filter_code` | The applied Rate Card and the Product or Product filter it prices. |
> | `rate_phase_code`, `rate_source` | The phase and pricing source used for the window. |
> | `rate_model`, `rate_properties` | Pricing settings used in the calculation. |
> | `units` | Calculated quantity, as a decimal string. |
> | `events_count` | Number of matching events. This may differ from the measured quantity. |
> | `amount_cents` | Amount excluding tax for the window. |
> | `from_datetime`, `to_datetime` | Start and end of the billing window. |
>
> See the [API reference](https://getlago.com/docs/v2/api-reference/contracts/retrieve-current-usage.md) for the complete response.
>
> ### Example
>
> `contract_example` started on January 1, 2027 on Plan `api_monthly`. While January's billing period is still open, 2,000 matching `api_calls` events have been received. This example uses Count, so the measured quantity and event count are both 2,000. It illustrates full monthly prices in USD, with no tax, proration, spending minimum or other adjustment. The response below is illustrative and trimmed to the fields used in the reconciliation.
>
> > [accordion] View the response example
> >
> > ```json Response (illustrative, trimmed) theme={"dark"}
> > {
> >   "current_usage": {
> >     "external_contract_id": "contract_example",
> >     "external_customer_id": "customer_example",
> >     "currency": "USD",
> >     "amount_cents": 12000,
> >     "taxes_amount_cents": 0,
> >     "total_amount_cents": 12000,
> >     "rate_cards": [
> >       {
> >         "rate_card_code": "monthly_service_usd",
> >         "product_code": "monthly_service",
> >         "product_type": "fixed",
> >         "billable_metric_code": null,
> >         "billing_timing": "arrears",
> >         "rate_source": "rate",
> >         "rate_model": "standard",
> >         "units": "1",
> >         "events_count": 0,
> >         "amount_cents": 10000
> >       },
> >       {
> >         "rate_card_code": "api_calls_usd",
> >         "product_code": "api_calls_product",
> >         "product_type": "metered",
> >         "billable_metric_code": "api_calls",
> >         "billing_timing": "arrears",
> >         "rate_source": "rate",
> >         "rate_model": "standard",
> >         "units": "2000",
> >         "events_count": 2000,
> >         "amount_cents": 2000
> >       }
> >     ]
> >   }
> > }
> > ```
>
> | Rate card | Units | Unit price | `amount_cents` |
> | - | - | - | - |
> | `monthly_service_usd` | 1 | 100.00 USD | 10000 |
> | `api_calls_usd` | 2,000 | 0.01 USD | 2000 |
> | **Total** | | | **12000 (120.00 USD)** |
>
> `amount_cents` is in minor units: `12000` is 120.00 USD. Do not multiply it by 100 again.

Each applied Rate Card can follow a different billing period. The combined total may span several future invoices. Use [invoice fees](https://getlago.com/docs/v2/guide/invoicing/fees.md) to review billed results.

### If usage is missing

1. Check the Contract is `active`. Pending Contracts have no usage.
2. List the events for the Contract with `GET /events?external_contract_id=contract_example`. See [List events](#list-events).
3. Check each event's `code` matches the billable metric of the metered Product.
4. Check event timestamps fall inside the window's `from_datetime` and `to_datetime`.
5. If an event was accepted but is not visible yet, retrieve usage again after processing. Do not resend the event just to refresh the result.

> [card] [Ingest usage](https://getlago.com/docs/v2/guide/events/ingesting-usage.md)
>
> Send usage events for a Contract.

> [card] [List events (API)](https://getlago.com/docs/v2/api-reference/events/list.md)
>
> `GET /events`

> [card] [Retrieve Contract current usage (API)](https://getlago.com/docs/v2/api-reference/contracts/retrieve-current-usage.md)
>
> `GET /contracts/{external_id}/current_usage`

> [card] [Fees](https://getlago.com/docs/v2/guide/invoicing/fees.md)
>
> Billed results after the window closes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.