## Get usage history `client.aiGateway.billing.usageHistory(BillingUsageHistoryParamsparams, RequestOptionsoptions?): BillingUsageHistoryResponse` **get** `/accounts/{account_id}/ai-gateway/billing/usage-history` Retrieve aggregated usage meter event summaries for the given time range. ### Parameters - `params: BillingUsageHistoryParams` - `account_id: string` Path param: Cloudflare account ID. - `value_grouping_window: "day" | "hour"` Query param: Grouping window for usage data. - `"day"` - `"hour"` - `end_time?: number | null` Query param: End time as Unix timestamp in milliseconds. - `start_time?: number | null` Query param: Start time as Unix timestamp in milliseconds. ### Returns - `BillingUsageHistoryResponse` - `history: Array` - `id: string` - `aggregated_value: number` - `end_time: number` - `start_time: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.billing.usageHistory({ account_id: 'account_id', value_grouping_window: 'day', }); console.log(response.history); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "history": [ { "id": "id", "aggregated_value": 0, "end_time": 0, "start_time": 0 } ] }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ```