Introduction
APIs
- Authentication
- Customers
- Accounts
- Aliases
- Event Schemas
- Usage Meters
- AddOns
- Licenses
- Feature
- (Deprecated) Price Plans
- Price Plan V2
- Settings
- Price Experimentation
- Jobs
- Event Ingestion
- Entitlements
- Event Management
- Metrics
- Credits
- Invoices
- Payments
- Wallet
- InvoiceGroups
- Alerts
- Reports
Usage Meters
Update an usage meter
This API lets you update an existing usage meter.
PATCH
/
usage_meters
/
{usage_meter_id}
curl --request PATCH \
--url https://api.togai.com/usage_meters/{usage_meter_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"billableName": "<string>",
"description": "<string>",
"eventSchemaName": "<string>",
"type": "COUNTER",
"aggregation": "COUNT",
"computations": [
{
"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",
"computation": {
"*": [
{
"var": "attributes.distance"
},
0.4
]
},
"order": 123
}
],
"filters": [
{
"field": "<string>",
"value": "<string>"
}
]
}'
{
"id": "um.1zlQTBWlkeO.lB7fh",
"name": "Rides",
"displayName": "Rides",
"description": "Cab rides",
"type": "COUNTER",
"aggregation": "COUNT",
"status": "DRAFT",
"computations": [
{
"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",
"order": 1,
"computation": "1"
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
Maximum length:
50
Example:
"um.1zYnCiM9Bpg.1zYn"
Body
application/json
Payload to create usage meter
Request to update usage meter
Response
200
application/json
Response for Create and Get usage event requests
Structure of usage meter
curl --request PATCH \
--url https://api.togai.com/usage_meters/{usage_meter_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"billableName": "<string>",
"description": "<string>",
"eventSchemaName": "<string>",
"type": "COUNTER",
"aggregation": "COUNT",
"computations": [
{
"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",
"computation": {
"*": [
{
"var": "attributes.distance"
},
0.4
]
},
"order": 123
}
],
"filters": [
{
"field": "<string>",
"value": "<string>"
}
]
}'
{
"id": "um.1zlQTBWlkeO.lB7fh",
"name": "Rides",
"displayName": "Rides",
"description": "Cab rides",
"type": "COUNTER",
"aggregation": "COUNT",
"status": "DRAFT",
"computations": [
{
"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",
"order": 1,
"computation": "1"
}
]
}
Assistant
Responses are generated using AI and may contain mistakes.