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
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 first 30 events matching the filters with the default sort order being EVENT_SOURCE_TIME DESC, EVENT_ID ASC can be corrected in a single request.
- Async mode: When query parameter async = true is given, 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
Determines the mode of the correction. Defaults to false
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
"UNDO"
Specifies whether to start a migration only after a confirmation
false
Body
Event Correction Payload for event correction
Contents of the event
Name of the Event Schema. Know more about event schema
1 - 50
Source time stamp of the event. This timestamp must be in ISO 8601 format.
"2022-06-15T07:30:35.123"
The event will be associated with the provided account
512
1
Attributes are numeric values. It can be usage metric which you push to Togai
Metric to be recorded
Name of the event attribute
1 - 50
"message"
Value of the event attribute
100
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.
1 - 50
"characters"
Dimensions are tags/labels associated with the events.
1 - 200
{ "Country": "India" }
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
512
"c0b1306d-f506-43a6-856b-69221efaee6b"
Response
Events Correction response
Raw usage event ingested by the business team and the status of the event ingestion.
Unique id generated by Togai to identify an event uniquely
Contents of the event
Name of the Event Schema. Know more about event schema
1 - 50
Source time stamp of the event. This timestamp must be in ISO 8601 format.
"2022-06-15T07:30:35.123"
The event will be associated with the provided account
512
1
Attributes are numeric values. It can be usage metric which you push to Togai
Metric to be recorded
Name of the event attribute
1 - 50
"message"
Value of the event attribute
100
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.
1 - 50
"characters"
Dimensions are tags/labels associated with the events.
1 - 200
{ "Country": "India" }
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
512
"c0b1306d-f506-43a6-856b-69221efaee6b"
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
, INGESTION_FAILED_INSUFFICIENT_CREDITS
, REVERTED
, UNKNOWN
"INGESTION_COMPLETED"
250
"Ingestion Completed successfully"
Created time stamp of the event. This timestamp must be in ISO 8601 format.
"2022-06-15T07:30:35.123"
Status of the event requested for correction
REVERTED
, REVERTED_AND_REINGESTED
, FAILED
Status description of the event requested for correction
The associated account belongs to this customer
50
"1"
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"
}
]
}