- Postman collection
- Open API spec
Authentication
Customers
Accounts
Aliases
Event Schemas
Usage Meters
AddOns
Licenses
Feature
Price Plans
Settings
Price Experimentation
Jobs
Event Ingestion
Entitlements
Event Management
Metrics
Credits
Invoices
Payments
Wallet
InvoiceGroups
APIs
Correct an ingested event
This API lets you to correct events. Available in both synchronous and asynchronous mode
- Usages: Reduction of all usages associated with this event
- Revenue: Reduction of all revenues associated with this event
- Entitlements: Entitlements(Feature Credits) consumed by this event are granted back to the account.
Possible Actions:
- UNDO: Undo all usages, revenue and entitlements associated with an event
- REDO: Performs UNDO and re-ingests the same event
- REDO_EVENT: Performs UNDO and re-ingests the correction payload of the event
curl --request POST \
--url https://api.togai.com/events/correction \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"event": {
"schemaName": "<string>",
"id": "c0b1306d-f506-43a6-856b-69221efaee6b",
"timestamp": "2022-06-15T07:30:35.123",
"accountId": 1,
"attributes": [
{
"name": "message",
"value": 100,
"unit": "characters"
}
],
"dimensions": {}
}
}'
{
"data": [
{
"referenceId": "event.21OpEx4DHQu.CZlyh",
"eventPayload": {
"timestamp": "2023-02-23T14:25:10Z",
"schemaName": "travelCompletedEvent",
"id": "c0b1306d-f506-43a6-856b-69221efaee6b",
"accountId": "1",
"attributes": [
{
"name": "distanceTravelled",
"value": "50",
"unit": "Miles"
},
{
"name": "timeSpent",
"value": "60",
"unit": "Minutes"
}
],
"dimensions": {
"location": "Seattle",
"costCenterCode": "1234",
"travelType": "Business"
}
},
"ingestionStatus": {
"status": "INGESTION_COMPLETED_EVENT_NOT_METERED",
"statusDescription": "Event ingestion completed successfully but the event is not associated with any bill plan."
},
"customerId": "CUS0001",
"source": {
"id": "ENTITLED",
"type": "ENTITLED"
},
"createdAt": "2023-02-23T14:25:10Z",
"status": "REVERTED",
"reason": "Event Reverted"
},
{
"referenceId": "event.23OrTx4FGQu.XVpzf",
"eventPayload": {
"timestamp": "2023-02-23T14:25:10Z",
"schemaName": "smsSentEvent",
"id": "sdvb325j-f506-43a6-856b-69221efaee6b",
"accountId": "1",
"attributes": [
{
"name": "smsCount",
"value": "50",
"unit": "count"
}
],
"dimensions": {}
},
"ingestionStatus": {
"status": "INGESTION_COMPLETED_EVENT_NOT_METERED",
"statusDescription": "Event ingestion completed successfully but the event is not associated with any bill plan."
},
"customerId": "CUS0001",
"source": {
"id": "",
"type": ""
},
"createdAt": "2023-01-01T14:25:10Z",
"status": "FAILED",
"reason": "Event was ingested in past pricing cycle"
}
]
}
Query Parameters: Allowed filter combinations
- Sync mode: Maximum of 5 events matching the filters can be corrected in a request.
- Async mode: Events matching the filters will be considered for correction and takes place in background.
Status of background job can be obtained using List Jobs API
Unique identifier of the account corresponding to the event
Unique identifier of an event generated by Togai for reference
Identifier of an event provided by the user
Timestamp of an event provided by the user
Timestamp corresponding to the event ingestion time in Togai
account_id
account_id
, id
account_id
, event_id
account_id
, event_source_time
account_id
, event_id
, created_at
account_id
, event_id
, event_source_time
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Query Parameters
Action to perform in event correction
UNDO
, REDO
, REDO_EVENT
Specifies whether to start a migration only after a confirmation
Body
Contents of the event
Name of the Event Schema. Know more about event schema
Togai restricts users to ingest events with same id within a period of 45 days. This restriction is common for /entitled API, /ingest API and /ingestBatch API. i.e, an id used on /ingest API will not be allowed on /ingestBatch or /entitled APIs
Source time stamp of the event. This timestamp must be in ISO 8601 format.
The event will be associated with the provided account
Attributes are numeric values. It can be usage metric which you push to Togai
Name of the event attribute
Value of the event attribute
Unit with which the attribute value was measured. Natively supported units - "Meters, Miles, Kilometers, Grams, Kilograms, ounces, Pounds, Minutes, Hours, Seconds, Milliseconds, Microseconds, None". Clients are free to add any other custom units.
Dimensions are tags/labels associated with the events.
Response
Unique id generated by Togai to identify an event uniquely
Contents of the event
Name of the Event Schema. Know more about event schema
Togai restricts users to ingest events with same id within a period of 45 days. This restriction is common for /entitled API, /ingest API and /ingestBatch API. i.e, an id used on /ingest API will not be allowed on /ingestBatch or /entitled APIs
Source time stamp of the event. This timestamp must be in ISO 8601 format.
The event will be associated with the provided account
Attributes are numeric values. It can be usage metric which you push to Togai
Name of the event attribute
Value of the event attribute
Unit with which the attribute value was measured. Natively supported units - "Meters, Miles, Kilometers, Grams, Kilograms, ounces, Pounds, Minutes, Hours, Seconds, Milliseconds, Microseconds, None". Clients are free to add any other custom units.
Dimensions are tags/labels associated with the events.
Status about the event ingestion.
Ingestion status
INGESTION_IN_PROGRESS
, INGESTION_FAILED
, INGESTION_FAILED_SCHEMA_NOT_DEFINED
, INGESTION_FAILED_ENRICHMENT_FAILED
, INGESTION_FAILED_UNITS_INVALID
, INGESTION_COMPLETED_NO_MATCHING_METERS
, INGESTION_COMPLETED_EVENT_METERED
, INGESTION_COMPLETED_EVENT_NOT_METERED
, INGESTION_FAILED_PAST_GRACE_PERIOD
, INGESTION_FAILED_ACCOUNT_NOT_FOUND
, INGESTION_FAILED_DUPLICATE_EVENT
, INGESTION_FAILED_NO_EVENT_ID
, INGESTION_FAILED_INVALID_NAMED_LICENSE_EVENT
, REVERTED
, UNKNOWN
The associated account belongs to this customer
Source of ingestion of event
Unique identifier representing the source
Type of source
Created time stamp of the event. This timestamp must be in ISO 8601 format.
Status of the event requested for correction
REVERTED
, REVERTED_AND_REINGESTED
, FAILED
Status description of the event requested for correction
curl --request POST \
--url https://api.togai.com/events/correction \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"event": {
"schemaName": "<string>",
"id": "c0b1306d-f506-43a6-856b-69221efaee6b",
"timestamp": "2022-06-15T07:30:35.123",
"accountId": 1,
"attributes": [
{
"name": "message",
"value": 100,
"unit": "characters"
}
],
"dimensions": {}
}
}'
{
"data": [
{
"referenceId": "event.21OpEx4DHQu.CZlyh",
"eventPayload": {
"timestamp": "2023-02-23T14:25:10Z",
"schemaName": "travelCompletedEvent",
"id": "c0b1306d-f506-43a6-856b-69221efaee6b",
"accountId": "1",
"attributes": [
{
"name": "distanceTravelled",
"value": "50",
"unit": "Miles"
},
{
"name": "timeSpent",
"value": "60",
"unit": "Minutes"
}
],
"dimensions": {
"location": "Seattle",
"costCenterCode": "1234",
"travelType": "Business"
}
},
"ingestionStatus": {
"status": "INGESTION_COMPLETED_EVENT_NOT_METERED",
"statusDescription": "Event ingestion completed successfully but the event is not associated with any bill plan."
},
"customerId": "CUS0001",
"source": {
"id": "ENTITLED",
"type": "ENTITLED"
},
"createdAt": "2023-02-23T14:25:10Z",
"status": "REVERTED",
"reason": "Event Reverted"
},
{
"referenceId": "event.23OrTx4FGQu.XVpzf",
"eventPayload": {
"timestamp": "2023-02-23T14:25:10Z",
"schemaName": "smsSentEvent",
"id": "sdvb325j-f506-43a6-856b-69221efaee6b",
"accountId": "1",
"attributes": [
{
"name": "smsCount",
"value": "50",
"unit": "count"
}
],
"dimensions": {}
},
"ingestionStatus": {
"status": "INGESTION_COMPLETED_EVENT_NOT_METERED",
"statusDescription": "Event ingestion completed successfully but the event is not associated with any bill plan."
},
"customerId": "CUS0001",
"source": {
"id": "",
"type": ""
},
"createdAt": "2023-01-01T14:25:10Z",
"status": "FAILED",
"reason": "Event was ingested in past pricing cycle"
}
]
}