Search
Search events
v1.usage.search(UsageSearchParams**kwargs) -> idstrcustomer_idstrevent_typestrtimestampdatetimetransaction_idstris_duplicateboolmatched_billable_metricslistmatched_customerUsageSearchResponseItemMatchedCustomerprocessed_atdatetimepropertiesDict[str, object]UsageSearchResponse
post/v1/events/search
For a set of events, look up matched billable metrics and customers by transaction id. This endpoint looks at transactions that occurred in the last 34 days, and is intended for sampling-based testing workflows. It is heavily rate limited.
Parameters
transaction_idslist
List[str]
The transaction IDs of the events to retrieve
Returns
UsageSearchResponsetype
from metronome import Metronome
client = Metronome(
bearer_token="My Bearer Token",
)
response = client.v1.usage.search(
transaction_ids=["2021-01-01T00:00:00Z_cluster42"],
)
print(response)
200 Example
[
{
"id": "id",
"customer_id": "customer_id",
"event_type": "event_type",
"timestamp": "2019-12-27T18:11:19.117Z",
"transaction_id": "transaction_id",
"is_duplicate": true,
"matched_billable_metrics": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name",
"aggregate": "aggregate",
"aggregate_keys": [
"string"
],
"aggregation_key": "aggregation_key",
"aggregation_type": "COUNT",
"archived_at": "2019-12-27T18:11:19.117Z",
"custom_fields": {
"foo": "string"
},
"event_type_filter": {
"in_values": [
"string"
],
"not_in_values": [
"string"
]
},
"filter": {
"foo": "bar"
},
"group_by": [
"string"
],
"group_keys": [
[
"string"
]
],
"property_filters": [
{
"name": "name",
"exists": true,
"in_values": [
"string"
],
"not_in_values": [
"string"
]
}
],
"sql": "sql"
}
],
"matched_customer": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name"
},
"processed_at": "2019-12-27T18:11:19.117Z",
"properties": {
"foo": "bar"
}
}
]