## Preview Events `v1.customers.preview_events(CustomerPreviewEventsParams**kwargs) -> CustomerPreviewEventsResponse` **post** `/v1/customers/{customer_id}/previewEvents` Preview how a set of events will affect a customer's invoice. Generates a draft invoice for a customer using their current contract configuration and the provided events. This is useful for testing how new events will affect the customer's invoice before they are actually processed. ### Parameters - **customer\_id:** `str` - **events:** `Iterable[Event]` - **event\_type:** `str` - **customer\_id:** `str` This has no effect for preview events, but may be set for consistency with Event objects. They will be processed even if they do not match the customer's ID or ingest aliases. - **properties:** `Dict[str, object]` - **timestamp:** `str` RFC 3339 formatted. If not provided, the current time will be used. - **transaction\_id:** `str` This has no effect for preview events, but may be set for consistency with Event objects. Duplicate transaction_ids are NOT filtered out, even within the same request. - **mode:** `Literal["replace", "merge"]` If set to "replace", the preview will be generated as if those were the only events for the specified customer. If set to "merge", the events will be merged with any existing events for the specified customer. Defaults to "replace". - `"replace"` - `"merge"` - **skip\_zero\_qty\_line\_items:** `bool` If set, all zero quantity line items will be filtered out of the response. ### Returns - `class CustomerPreviewEventsResponse` - **data:** `Invoice` ### Example ```python from metronome import Metronome client = Metronome( bearer_token="My Bearer Token", ) response = client.v1.customers.preview_events( customer_id="d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc", events=[{ "event_type": "heartbeat", "timestamp": "2021-01-01T00:00:00Z", "properties": { "cpu_hours": 100, "memory_gb_hours": 200, }, }], ) print(response.data) ```