Transaction Monitoring : API
15 min
This describes the request body and the various responses from the transaction monitoring system after processing a transaction. The responses detail the rule evaluation, any detected violations, and errors encountered during the rule evaluation or transaction processing.
Endpoint: /stream/v1
Method: POST
Headers:
- x-api-key (Required): A valid API key associated with the team. (Present in the API Key Curl Command)
Request Body:
The request body must be a JSON object that includes the following fields:
{
"data": { ... } // Required, dynamic payload
}Responses:
200 OK (Success)
The response includes the following details for each rule :
- status: The status for each rule, which can be:
- RULE_COMPILED: The rule was successfully checked with the payload, and no violations were found.
- RULE_VIOLATED: The transaction violated the rule.
- RULE_EVALUATION_FAILED: An error occurred while evaluating the rule, likely due to misconfiguration or invalid logic in the rule.
- timetaken: The time taken to evaluate each rule against the transaction payload.
{
"txnId": "txn-987654",
"teamId": "679ddc46-34ce-4b7a-8da8-4b8ba4848ae8",
"acknowledgementId": "670f9e9d4028b83f2543fdb1",
"flagged": true,
"receivedAt": 1729076893328,
"ruleEvaluationMetrics": {
"3116db5a-36bb-4a70-8853-6a71cf6b91a9": {
"status": "RULE_VIOLATED",
"timetaken": 0.159074992
},
"13f913d5-8dcc-4867-b6d7-5d372956ce04": {
"status": "RULE_EVALUATION_FAILED",
"timetaken": 0.003980621
},
"1484dd77-985d-4854-af45-86934f50cdd5": {
"status": "RULE_COMPLIED",
"timetaken": 0.121830409
}
}400 Bad Request
- INVALID_JSON
- Description: The request body contains invalid JSON, making it impossible to process the transaction.
- Response :
{
"error": "INVALID_JSON"
}- Missing Required Fields
- Description: One or more required fields are missing from the transaction payload.
- Response:
{
"error": "Missing required fields: [list of fields]"
}- Failed to Parse Transaction Payload
- Description: The system encountered an error while parsing the transaction payload, possibly due to improper data formatting or structure.
- Response:
{
"error": "FAILED_TO_PARSE_TRANSACTION_PAYLOAD"
}- Empty Database Schema
- Description: The database schema is not set or configured for the team, preventing the transaction from being processed.
- Response:
{
"error": "dbSchema is empty"
}401 Unauthorized
- Missing API Key
- Description: The x-api-key header is not present in the request, and the server cannot authenticate the request.
- Response:
{
"error": "Missing x-api-key"
}- Invalid API Key
- Description: The provided API key in the x-api-key header is invalid or incorrect.
- Response:
{
"error": "Invalid x-api-key"
}403 Forbidden
- Unauthorized Team
- Description: The team ID provided in the request is not authorized to access the requested resources.
- Response:
{
"error": "UNKNOWN_TEAM"
}422 Unprocessable Entity
- Failed to Register Transaction :
- This indicates that there was an error in the transaction payload. The potential reasons for this could include:
- Datatype mismatch: A field’s value does not match its expected datatype.
- Missing keys: Certain required keys are missing from the transaction payload, preventing proper rule evaluation.
- Response:
{
"error": "FAILED_TO_REGISTER_TRANSACTION"
}These response categories provide detailed feedback about whether the transaction was processed successfully, the status of each rule evaluated, and if any errors occurred during the evaluation.