curl --request GET \
--url https://api.togai.com/usage_meters \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "<string>",
"name": "rides-usage",
"displayName": "<string>",
"type": "COUNTER",
"aggregation": "COUNT",
"billableName": "Rides Usage",
"description": "Meter to track cab rides",
"filters": [
{
"field": "<string>",
"value": "<string>"
}
],
"status": "DRAFT",
"computations": [
{
"computation": {
"*": [
{
"var": "attributes.distance"
},
0.4
]
},
"order": 123,
"id": "<string>",
"matcher": "{\n \"and\": [\n {\"in\": [{\"var\": \"dimension.city\"}, \"chennai\", \"mumbai\"]},\n \"or\": [\n {\">\": [{\"var\": \"attribute.distance\"}, 100]},\n {\"<\": [{\"var\": \"attribute.distance\"}, 20]}\n ]\n ]\n}\n"
}
],
"eventSchema": {
"name": "<string>",
"version": 1,
"description": "<string>",
"status": "DRAFT",
"attributes": [
{
"name": "distance",
"defaultUnit": "kms"
}
],
"dimensions": [
{
"name": "city"
}
],
"filterFields": [
"<string>"
],
"featureDetails": {
"featureId": "<string>",
"attributeName": "<string>"
},
"enrichments": {
"fields": [
{
"name": "<string>",
"type": "ATTRIBUTE",
"enrichmentType": "VALUE",
"value": "<string>",
"order": 123
}
],
"dependencies": [
{
"type": "SETTING",
"key": "<string>",
"name": "<string>"
}
]
},
"eventIdTemplate": "<string>",
"eventLevelRevenue": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"createdAt": "2023-11-07T05:31:56Z",
"lastActivatedAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"nextToken": "<string>",
"context": {
"pageSize": 123,
"sortOrder": "ASC"
}
}Get a list of usage meters associated with an event schema
curl --request GET \
--url https://api.togai.com/usage_meters \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "<string>",
"name": "rides-usage",
"displayName": "<string>",
"type": "COUNTER",
"aggregation": "COUNT",
"billableName": "Rides Usage",
"description": "Meter to track cab rides",
"filters": [
{
"field": "<string>",
"value": "<string>"
}
],
"status": "DRAFT",
"computations": [
{
"computation": {
"*": [
{
"var": "attributes.distance"
},
0.4
]
},
"order": 123,
"id": "<string>",
"matcher": "{\n \"and\": [\n {\"in\": [{\"var\": \"dimension.city\"}, \"chennai\", \"mumbai\"]},\n \"or\": [\n {\">\": [{\"var\": \"attribute.distance\"}, 100]},\n {\"<\": [{\"var\": \"attribute.distance\"}, 20]}\n ]\n ]\n}\n"
}
],
"eventSchema": {
"name": "<string>",
"version": 1,
"description": "<string>",
"status": "DRAFT",
"attributes": [
{
"name": "distance",
"defaultUnit": "kms"
}
],
"dimensions": [
{
"name": "city"
}
],
"filterFields": [
"<string>"
],
"featureDetails": {
"featureId": "<string>",
"attributeName": "<string>"
},
"enrichments": {
"fields": [
{
"name": "<string>",
"type": "ATTRIBUTE",
"enrichmentType": "VALUE",
"value": "<string>",
"order": 123
}
],
"dependencies": [
{
"type": "SETTING",
"key": "<string>",
"name": "<string>"
}
]
},
"eventIdTemplate": "<string>",
"eventLevelRevenue": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"createdAt": "2023-11-07T05:31:56Z",
"lastActivatedAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"nextToken": "<string>",
"context": {
"pageSize": 123,
"sortOrder": "ASC"
}
}Query Parameters
Filterable Fields
Searchable Fields
Sortable Fields
_sort query paramupdated_at DESCBearer authentication header of the form Bearer <token>, where <token> is your auth token.
Filter by status
ACTIVE, INACTIVE Filter by aggregations
COUNT, SUM "eyJsYXN0SXRlbUlkIjogInN0cmluZyIsICJwYWdlU2l6ZSI6IDEwMCwgInNvcnRPcmRlciI6ICJhc2MifQ=="
10
Response for list usage_meters request
Show child attributes
Identifier of the usage meter
20Name of the usage meter
50"rides-usage"
Display name of usage meter. This is an auto-generated field which contains billableName of usage meter. If billableName is not provided, name will be used as display name.
255Type of usage meter
COUNTER "COUNTER"
Aggregation to be applied on usage meter result
COUNT, SUM Billable name of addon. Billable name takes precedence over name to display in invoice.
255"Rides Usage"
255"Meter to track cab rides"
Status of usage meter
DRAFT, ACTIVE, INACTIVE, ARCHIVED "DRAFT"
1Show child attributes
Computation to be applied on an event if it matches the matcher. In case of a COUNT aggregation type, computation should be passed as '1'
500{
"*": [{ "var": "attributes.distance" }, 0.4]
}The order in which multiple matched computations will get evaluated
Optional identifier describing the matcher and computation pair
50Condition to be applied on event. Upon matching it the corresponding computation will be considered for usage_meter unit calculation. The result of the matcher needs to be truthy in order to be considered as a match.
1500"{\n \"and\": [\n {\"in\": [{\"var\": \"dimension.city\"}, \"chennai\", \"mumbai\"]},\n \"or\": [\n {\">\": [{\"var\": \"attribute.distance\"}, 100]},\n {\"<\": [{\"var\": \"attribute.distance\"}, 20]}\n ]\n ]\n}\n"
Structure of an event schema
Show child attributes
Name of the event. Must be unique for an organization.
50Version of event schema
x >= 11
Description of the event
255Status of event schema
DRAFT, ACTIVE, INACTIVE, ARCHIVED "DRAFT"
Show child attributes
Show child attributes
ATTRIBUTE, DIMENSION VALUE, JSON_LOGIC, JSON_LOGIC_FROM_DEPENDENCY Template used to generate event id based on event payload