Search
Search events
client.v1.usage.search(UsageSearchParamsbody, RequestOptionsoptions?): idstringcustomer_idstringevent_typestringtimestampstringtransaction_idstringis_duplicatebooleanmatched_billable_metricsarraymatched_customerMatchedCustomerprocessed_atstringpropertiesRecord<string, unknown>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
bodytransactionIdsarrayUsageSearchParams
Returns
UsageSearchResponsealias
import Metronome from '@metronome/sdk';
const client = new Metronome({
bearerToken: 'My Bearer Token',
});
const response = await client.v1.usage.search({ transactionIds: ['2021-01-01T00:00:00Z_cluster42'] });
console.log(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"
}
}
]