> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hashdit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Transaction Security

> Analyzes a blockchain transaction before / after execution to identify security risks. The API inspects transaction calldata, detects dangerous patterns (e.g. unlimited approvals), evaluates dApp and domain reputation, and returns an overall risk score with detailed explanations. This endpoint is designed for wallets, signing flows, and transaction confirmation screens.



## OpenAPI

````yaml POST /v2/hashdit/transaction-security
openapi: 3.1.0
info:
  title: HashDit API
  description: >-
    HashDit threat intelligence API for domain security analysis, blockchain
    address classification, address poisoning detection, address security
    assessment, transaction simulation, transaction security, token security,
    and Solana token security
  version: 2.0.0
servers:
  - url: https://service.hashdit.io
security: []
paths:
  /v2/hashdit/transaction-security:
    post:
      summary: Transaction Security
      description: >-
        Analyzes a blockchain transaction before / after execution to identify
        security risks. The API inspects transaction calldata, detects dangerous
        patterns (e.g. unlimited approvals), evaluates dApp and domain
        reputation, and returns an overall risk score with detailed
        explanations. This endpoint is designed for wallets, signing flows, and
        transaction confirmation screens.
      operationId: transactionSecurity
      parameters:
        - name: X-API-KEY
          in: header
          description: Your HashDit API key
          required: true
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Must be set to application/json
          required: true
          schema:
            type: string
            default: application/json
        - name: X-DITING-API-DEBUG
          in: header
          description: Optional debug flag (1 enables verbose analysis)
          required: false
          schema:
            type: string
            enum:
              - '0'
              - '1'
      requestBody:
        description: Transaction to analyze
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionSecurityRequest'
            example:
              chainId: '56'
              from: '0xB59274D0468eA82Dc48De42488b5dfA5F7fb4A06'
              to: '0x12BB890508c125661E03b09EC06E404bc9289040'
              data: 0x095ea7b3...
              nonce: 6
              value: 0
              type: 2
              gas: 340800
              maxFeePerGas: 3497787365
              maxPriorityFeePerGas: 1000000000
              dappUrl: https://mov-ai.com/eh?hello=ke
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionSecurityResponse'
              example:
                chain: bsc
                from: '0xb59274d0468ea82dc48de42488b5dfa5f7fb4a06'
                to: '0x12bb890508c125661e03b09ec06e404bc9289040'
                function: approve(address,uint256)
                params:
                  '0': '0x0000000000001fF3684f28c67538d4D072C22734'
                  '1': 1.157920892373162e+77
                overall_risk: 5
                risk_description: Critical Risk
                risk_details:
                  - name: unlimited_approval
                    risk: 3
                    risk_name: Medium Risk
                    description: Unlimited token approval detected.
                  - name: is_in_blist
                    risk: 5
                    risk_name: Critical Risk
                    description: >-
                      There are potential risks in the dApp based on the threat
                      intelligence.
                scanned_time: 1766097400
                status:
                  domain_security: completed
                  tx_security: completed
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidAPIKeyErrorResponse'
              examples:
                Invalid API key:
                  summary: Invalid API key error
                  value:
                    code: '403'
                    message: 'invalid apiKey: apiKey invalid'
                    apiKey: ''
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitExceededErrorResponse'
              examples:
                Rate limit exceeded:
                  summary: Rate limit exceeded error
                  value:
                    code: '429'
                    status: error
                    message: Rate limit exceeded
components:
  schemas:
    TransactionSecurityRequest:
      type: object
      required:
        - chainId
        - from
        - to
        - data
        - nonce
        - value
        - gas
      properties:
        chainId:
          type: string
          description: >-
            The network chain ID. See [Supported
            Chains](/api-reference/endpoint/transaction-security/supported-chains)
            for a complete list of supported networks for this endpoint.
          example: '56'
        from:
          type: string
          description: Sender address.
          example: '0xB59274D0468eA82Dc48De42488b5dfA5F7fb4A06'
        to:
          type: string
          description: Target contract address or recipient address.
          example: '0x12BB890508c125661E03b09EC06E404bc9289040'
        data:
          type: string
          description: Hex-encoded transaction calldata.
          example: 0x095ea7b3...
        nonce:
          type: number
          description: Transaction nonce.
          example: 6
        value:
          type: number
          description: Native token value. Measured in wei.
          example: 0
        type:
          type: number
          description: Transaction type. E.g. 0 for legacy transactions, 2 for EIP-1559.
          enum:
            - 0
            - 2
        gas:
          type: number
          description: Gas limit.
          example: 340800
        maxFeePerGas:
          type: number
          description: Max fee per gas (EIP-1559).
          example: 3497787365
        maxPriorityFeePerGas:
          type: number
          description: Priority fee per gas (EIP-1559).
          example: 1000000000
        dappUrl:
          type: string
          description: Originating dApp URL for domain risk analysis.
          example: https://mov-ai.com/eh?hello=ke
    TransactionSecurityResponse:
      type: object
      properties:
        chain:
          type: string
          description: Blockchain identifier.
          example: bsc
        from:
          type: string
          description: Sender address.
          example: '0xb59274d0468ea82dc48de42488b5dfa5f7fb4a06'
        to:
          type: string
          description: Target contract address or recipient address.
          example: '0x12bb890508c125661e03b09ec06e404bc9289040'
        function:
          type: string
          description: Decoded function signature.
          example: approve(address,uint256)
        params:
          type: object
          description: Decoded function parameters.
          example:
            '0': '0x0000000000001fF3684f28c67538d4D072C22734'
            '1': 1.157920892373162e+77
        value:
          type: number
          description: Native token value. Measured in wei.
          example: 0
        gas_used:
          type: number
          description: Gas used (if simulated).
        overall_risk:
          type: number
          description: Overall risk score (0-5). Higher values indicate higher risk.
          enum:
            - '0'
            - '1'
            - '2'
            - '3'
            - '4'
            - '5'
        risk_description:
          type: string
          description: Human-readable risk level (e.g. Critical Risk).
          example: Critical Risk
        risk_details:
          type: array
          description: Detailed list of detected risks.
          items:
            $ref: '#/components/schemas/RiskDetailItem'
        scanned_time:
          type: number
          description: Unix timestamp of analysis.
          example: 1766097400
        status:
          $ref: '#/components/schemas/TransactionSecurityStatus'
        url:
          type: string
          description: dApp URL used for domain analysis (if provided).
          example: https://mov-ai.com/eh?hello=ke
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: '`400`'
        status:
          type: string
          description: Error status
    InvalidAPIKeyErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: '`403`'
        message:
          type: string
          description: 'invalid apiKey: apiKey invalid'
        apiKey:
          type: string
          description: API key
          example: ''
    RateLimitExceededErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: '`429`'
        status:
          type: string
          description: error
        message:
          type: string
          description: Rate limit exceeded
    RiskDetailItem:
      type: object
      properties:
        name:
          type: string
          description: Risk identifier.
          example: unlimited_approval
        value:
          type: string
          description: Associated value (address, string, etc.).
        value_type:
          type: string
          description: Value type (e.g. address, string).
        risk:
          type: number
          description: Risk severity score (0-5). Higher values indicate higher risk.
          enum:
            - '0'
            - '1'
            - '2'
            - '3'
            - '4'
            - '5'
        risk_name:
          type: string
          description: Risk label (e.g. Medium Risk).
          example: Medium Risk
        description:
          type: string
          description: User-facing explanation of the risk.
          example: Unlimited token approval detected.
    TransactionSecurityStatus:
      type: object
      properties:
        domain_security:
          type: string
          description: Domain analysis status.
          enum:
            - completed
            - in_progress
            - error
        tx_security:
          type: string
          description: Transaction analysis status.
          enum:
            - completed
            - in_progress
            - error

````