API Reference
- Customers
- Products
- Plans
- Contracts
- Invoices
- Measurements
- Auth
- Events
- Reports
- Integrations
- Credits
- Webhooks
Submit a batch of events for testing
Use this endpoint to send an array of events for processing. Make sure to comply with the request schema for each event. NOTE: this is a dry run and will not result in actual storage of the events.
curl --request POST \
--url https://connect.withvayu.com/events/dry-run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"events": [
{
"name": "api_call",
"timestamp": "2023-09-13T18:25:43.511Z",
"customerAlias": "customer_12345",
"ref": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
"data": {
"key1": "processing_duration",
"key2": "api_url"
}
}
]
}'
{
"events": [
{
"event": {
"timestamp": "2023-11-07T05:31:56Z",
"customerAlias": "<string>",
"accountId": "<string>",
"data": {},
"ref": "<string>",
"name": "<string>"
},
"matchedCustomer": "<string>",
"meterWithValues": [
{
"name": "<string>",
"eventName": "<string>",
"aggregationMethod": {
"operator": "Count",
"field": "<string>",
"instanceKey": "<string>"
},
"filter": {
"conditions": [
{
"criterions": [
{
"field": "<string>",
"operator": "Equals",
"value": "<string>"
}
]
}
]
},
"pricing": {
"pricingModel": "PerUnit",
"priceConfiguration": {
"price": 1,
"chunkSize": 1
}
},
"value": 123,
"instanceValue": "<any>"
}
]
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
The distinctive label assigned to an event, serving as a critical identifier for categorizing and pricing events within the system's backend infrastructure.
"api_call"
The temporal marker denoting the exact moment of event occurrence. The timestamp is formatted as an ISO 8601 string and is expressed in Coordinated Universal Time (UTC). i.e. YYYY-MM-DDTHH:MM:SS.SSSZ
"2023-09-13T18:25:43.511Z"
A pseudonymous or otherwise obfuscated identifier uniquely assigned to each customer.
1
"customer_12345"
A universally unique identifier (UUID) or other form of high-entropy string serving as an immutable reference for each event entry.
"4f6cf35x-2c4y-483z-a0a9-158621f77a21"
Response
The name of the meter
1
The name of the event that the meter is tracking.
1
The aggregation method defines how the events should be summed to represent a usage value.
The aggregation method defines how the events should be summed to represent a usage value.
Count
, Sum
, Distinct
, Max
, Min
, Average
, First
, Last
The field inside the "data" property to apply the aggregation method to.
The fields that is used to group different events together when measuring the usage.
The filter to apply to the events to be included in the meter. The filter object contains an array of Conditions, each condition represents a logical OR statement. Each condition contains an array of Criteria (criterions), each criterion represents a logical AND statement.
The pricing data of the meter. The pricing data contains the pricing model and the pricing details.
PerUnit
curl --request POST \
--url https://connect.withvayu.com/events/dry-run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"events": [
{
"name": "api_call",
"timestamp": "2023-09-13T18:25:43.511Z",
"customerAlias": "customer_12345",
"ref": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
"data": {
"key1": "processing_duration",
"key2": "api_url"
}
}
]
}'
{
"events": [
{
"event": {
"timestamp": "2023-11-07T05:31:56Z",
"customerAlias": "<string>",
"accountId": "<string>",
"data": {},
"ref": "<string>",
"name": "<string>"
},
"matchedCustomer": "<string>",
"meterWithValues": [
{
"name": "<string>",
"eventName": "<string>",
"aggregationMethod": {
"operator": "Count",
"field": "<string>",
"instanceKey": "<string>"
},
"filter": {
"conditions": [
{
"criterions": [
{
"field": "<string>",
"operator": "Equals",
"value": "<string>"
}
]
}
]
},
"pricing": {
"pricingModel": "PerUnit",
"priceConfiguration": {
"price": 1,
"chunkSize": 1
}
},
"value": 123,
"instanceValue": "<any>"
}
]
}
]
}