Validation API

Overview

The Validation REST API provides endpoints for validating a transaction by sending the transaction data and other relevant information. It is secured using a Validation API key found under Settings > API keys in Panorama UI.

Authentication

All endpoints require a valid Validation API key in the X-Api-Key header. API Keys

Endpoints

1. Validate transaction

Validates transaction and provides the signature to use with Cube3 protocol integration ().

URL: api/v1/transaction/validate

Method: POST

Headers:

  • X-Api-Key: <Validation API key (string)>

  • accept: application/json(Specifies that the response format should be in JSON.)

  • Content-Type: application/json(Specifies the format of the request body, which must be in JSON format.)

Request Body:

{
  "transaction": {
    "to": "string",
    "from": "string",
    "nonce": "string",
    "data": "string",
    "value": "string",
    "chainId": "string"
  },
  "trackNonce": true,
  "clientData": {
    "userAgent": "string",
    "ip": "string"
  },
  "signTransaction": true
}

Request Body fields description:

  • transaction.to (string): The address to which the transaction is being sent.

  • transaction.from (string): The address from which the transaction is being sent.

  • transaction.nonce (string): The nonce for the transaction (optional).

  • transaction.data (string): Hexadecimal-encoded transaction data, typically used for calling smart contracts (optional).

  • transaction.value (string): The value of the transaction in Wei (optional).

  • transaction.chainId (string): The ID of the blockchain network. Supported chains: CUBE3 Detect Products

  • trackNonce (boolean): Indicates whether to track the nonce of the transaction.

  • clientData (object): Client data related to the transaction (optional).

  • clientData.userAgent (string): The user agent of the client (optional).

  • clientData.ip (string): The IP address of the client (optional).

  • signTransaction (boolean): Indicates whether the transaction should be signed.

Responses:

  • 200 OK: Returns the validation result response.

  • 400 Bad Request: Invalid input, such as missing required fields or incorrectly formatted data.

  • 401 Unauthorized: Missing or invalid API key

Example request:

curl --location 'https://validation-api.cube3.ai/api/v1/transaction/validate' \
--header 'accept: application/json' \
--header 'X-API-KEY: api-key-validation' \
--header 'Content-Type: application/json' \
--data '{
  "transaction": {
    "to": "0x1Da540d47AeB1565ef74eDf89383FDaA6bD250aD",
    "from": "0xAd6Fca7B276A7d734EfFfA6573dD446A2841e049",
    "data": "0x59968e0e000000000000000000000000ad6fca7b276a7d734efffa6573dd446a2841e04000000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "value": "0",
    "chainId": "1"
  },
  "trackNonce": false,
  "clientData": {
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
    "ip": "11.157.11.253"
  },
  "signTransaction": true
}'

Example Response:

{
    "valid": false,
    "payload": null,
    "error": null,
    "combinedScore": 100,
    "combinedScoreDetails": {
        "value": 100,
        "category": "fraud",
        "subCategory": "validation",
        "subCategoryDescription": "Validation impacted by following rules: [Block mintCube3TokenBlockByParameter(to, amount, payload) more than 100] and []",
        "tagName": null,
        "tagDescription": null
    },
    "cube3TxId": "6707b097c8c5077fec37449c"
}

Response Body fields description:

  • valid (boolean):

    • Indicates whether the transaction passed the validation.

  • payload (String):

    • This field typically contains a Signature payload to use in transaction.

  • error (String):

    • If any error occurs during the validation, it will be detailed here.

  • combinedScore (integer):

    • Represents the overall risk score for the transaction, with higher values indicating greater risk.

  • combinedScoreDetails (object):

    • Provides a breakdown of the risk score and the factors contributing to it. Fraud, compliance, and cyber risks, with higher values indicating greater overall risk.

    • value (integer): n number measuring cyber risk, with higher values indicating higher threat levels.

    • category (string): Specifies the particular type of combined risk identified.

    • subCategory (string): Identifies the type of risk.

    • subCategoryDescription (string): Providing a detailed explanation of the identified combined risk category, describing the nature and characteristics of the combined risk including the rules that impacted the validation outcome.

    • tagName, tagDescription (string): These fields provide additional categorization and details.

  • cube3TxId (string):

    • The unique identifier for the transaction within the Cube3 system.

2. Update validated transaction

This API is used to update transaction details based on a unique Cube3 transaction ID (cube3TxId).

URL: /api/v1/transaction/{cube3TxId}

Method: PUT

Headers:

  • X-Api-Key: <Validation API key (string)>

  • accept: application/json(Specifies that the response format should be in JSON.)

  • Content-Type: application/json(Specifies the format of the request body, which must be in JSON format.)

Request Body:

{
  "transactionId": "string",
  "blockNumber": "string",
  "blockTime": "2024-10-08T06:46:02.766Z"
}

Request Body fields description:

  • transactionId (string): The unique identifier(hash) of the transaction (required).

  • blockNumber (string): The number of the block that contains the transaction (optional).

  • blockTime (string): The timestamp of when the block was mined (required, in ISO 8601 format)(optional).

Responses:

  • 200 OK: Indicates the change was accepted

  • 400 Bad Request: Invalid input, such as missing required fields or incorrectly formatted data.

  • 401 Unauthorized: Missing or invalid API key

  • 404 Not Found: The specified cube3TxId could not be found.

Example request:

curl --location --request PUT 'https://validation-api.cube3.ai/api/v1/transaction/{cube3TxId}' \
--header 'accept: application/json' \
--header 'X-API-KEY: api-key-validation' \
--header 'Content-Type: application/json' \
--data '{
  "transactionId": "0x48b6c83e5164c23a8b1b8883beb06fa0dccf2146f6d89359c58a5cc95c2272a7",
  "blockNumber": "12456789",
  "blockTime": "2024-10-08T06:46:02.766Z"
  }`

Last updated