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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://developers.fireblocks.com/feedback

```json
{
  "path": "/api-reference/contract-interactions/decode-a-function-call-data-error-or-event-log",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Decode a function call data, error, or event log

> Decode a function call data, error, or event log from a deployed contract by blockchain native asset id and contract address.



## OpenAPI

````yaml https://docs.fireblocks.com/api/v1/swagger.yaml post /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/decode
openapi: 3.0.0
info:
  title: Fireblocks API
  description: >
    Fireblocks provides a suite of applications to manage digital asset
    operations and a complete development platform to build your business on the
    blockchain.


    - Visit our website for more information: [Fireblocks
    Website](https://fireblocks.com)

    - Visit our developer docs: [Fireblocks
    DevPortal](https://developers.fireblocks.com)
  version: 1.6.2
  contact:
    email: developers@fireblocks.com
servers:
  - url: https://api.fireblocks.io/v1
    description: Fireblocks Production Environment Base URL
  - url: https://sandbox-api.fireblocks.io/v1
    description: Fireblocks Sandbox Environment Base URL
security: []
paths:
  /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/decode:
    post:
      tags:
        - Contract Interactions
      summary: Decode a function call data, error, or event log
      description: >-
        Decode a function call data, error, or event log from a deployed
        contract by blockchain native asset id and contract address.
      operationId: decodeContractData
      parameters:
        - $ref: '#/components/parameters/X-Idempotency-Key'
        - name: contractAddress
          required: true
          in: path
          description: The contract's onchain address
          example: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
          schema:
            type: string
        - name: baseAssetId
          required: true
          in: path
          description: The blockchain native asset identifier
          example: ETH
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractDataDecodeRequest'
      responses:
        '200':
          description: Decoded data retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDataDecodedResponse'
        '400':
          description: Bad request, invalid input data or parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDataDecodeError'
        default:
          $ref: '#/components/responses/Error'
      x-codeSamples:
        - lang: TypeScript
          source: >-
            const response:
            Promise<FireblocksResponse<ContractDataDecodedResponse>> =
            fireblocks.contractInteractions.decodeContractData(contractInteractionsApiDecodeContractDataRequest);
        - lang: Java
          source: >-
            CompletableFuture<ApiResponse<ContractDataDecodedResponse>> response
            =
            fireblocks.contractInteractions().decodeContractData(contractDataDecodeRequest,
            contractAddress, baseAssetId, idempotencyKey);
        - lang: Python
          source: >-
            response =
            fireblocks.contract_interactions.decode_contract_data(contract_data_decode_request,
            contract_address, base_asset_id, idempotency_key);
components:
  parameters:
    X-Idempotency-Key:
      name: Idempotency-Key
      in: header
      description: >-
        A unique identifier for the request. If the request is sent multiple
        times with the same idempotency key, the server will return the same
        response as the first request. The idempotency key is valid for 24
        hours.
      required: false
      schema:
        type: string
  schemas:
    ContractDataDecodeRequest:
      type: object
      properties:
        data:
          description: >-
            The data to decode, which can be a string or an object containing
            the data and its type.
          oneOf:
            - $ref: '#/components/schemas/ContractDataEncodedDataString'
            - $ref: '#/components/schemas/ContractDataLogDataParam'
          example: '0x1234567890abcdef'
        dataType:
          $ref: '#/components/schemas/ContractDataDecodeDataType'
        abi:
          type: array
          items:
            $ref: '#/components/schemas/AbiFunction'
          description: The abi of the function/error/log to decode.
          example:
            - inputs:
                - name: to
                  type: address
                - name: amount
                  type: uint256
              stateMutability: nonpayable
              type: function
              name: transfer
      required:
        - data
        - dataType
    ContractDataDecodedResponse:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/ContractDataDecodeResponseParams'
          description: The decoded parameters of the contract function call.
        type:
          $ref: '#/components/schemas/ContractDataDecodeDataType'
      required:
        - result
        - type
    ContractDataDecodeError:
      type: object
      properties:
        message:
          type: string
          description: Bad request error message
          example: 'Error decoding data: Invalid ABI'
        code:
          type: number
          description: Error code
          example: 400
      required:
        - message
        - code
    ContractDataEncodedDataString:
      type: string
      description: The encoded data to decode
      example: '0x1234567890abcdef'
    ContractDataLogDataParam:
      type: object
      properties:
        data:
          type: string
          description: >-
            The data to decode, which can be a string or an object containing
            the data and its type.
          example: '0x1234567890abcdef'
        topics:
          type: array
          items:
            type: string
          description: The topics of the log, which is an array of strings.
          example:
            - 1311768467294899700
            - 12379813812177893000
      required:
        - data
        - topics
    ContractDataDecodeDataType:
      type: string
      description: The type of the data to decode.
      enum:
        - ERROR
        - LOG
        - FUNCTION
      example: FUNCTION
    AbiFunction:
      type: object
      properties:
        name:
          type: string
          example: mint
          description: The name of the contract function as it appears in the ABI
        stateMutability:
          type: string
          example: pure
          enum:
            - pure
            - view
            - nonpayable
            - payable
          description: >-
            The state mutability of the contract function as it appears in the
            ABI
        type:
          type: string
          example: constructor
          description: The type of the function
          enum:
            - constructor
            - function
            - error
            - event
            - receive
            - fallback
        inputs:
          description: The parameters that this function/constructor posses
          items:
            $ref: '#/components/schemas/Parameter'
          type: array
        outputs:
          description: The parameters that this 'read' function returns
          items:
            $ref: '#/components/schemas/Parameter'
          type: array
        description:
          type: string
          description: The documentation of this function (if has any)
      required:
        - type
    ContractDataDecodeResponseParams:
      type: object
      properties:
        name:
          type: string
          description: The name of the contract function.
          example: transfer
        signature:
          type: string
          description: The signature of the contract function.
          example: transfer(address,uint256)
        args:
          $ref: '#/components/schemas/ParameterWithValueList'
      required:
        - name
        - signature
        - args
    ErrorSchema:
      type: object
      properties:
        message:
          type: string
        code:
          type: number
    Parameter:
      type: object
      properties:
        name:
          type: string
          example: _name
          description: The name of the parameter as it appears in the ABI
        description:
          type: string
          example: The name of the token
          description: >-
            A description of the parameter, fetched from the devdoc of this
            contract
        internalType:
          type: string
          example: string
          description: The internal type of the parameter as it appears in the ABI
        type:
          type: string
          example: string
          description: The type of the parameter as it appears in the ABI
        components:
          type: array
          items:
            $ref: '#/components/schemas/Parameter'
      required:
        - name
        - type
    ParameterWithValueList:
      type: array
      items:
        $ref: '#/components/schemas/ParameterWithValue'
    ParameterWithValue:
      type: object
      properties:
        name:
          type: string
          example: _name
          description: The name of the parameter as it appears in the ABI
        description:
          type: string
          example: The name of the token
          description: >-
            A description of the parameter, fetched from the devdoc of this
            contract
        internalType:
          type: string
          example: string
          description: The  internal type of the parameter as it appears in the ABI
        type:
          type: string
          example: string
          description: The type of the parameter as it appears in the ABI
        components:
          type: array
          items:
            $ref: '#/components/schemas/Parameter'
        value:
          example: 'true'
          description: The value of the parameter. can also be ParameterWithValue
          type: string
        functionValue:
          description: >-
            The function value of this param (if has one). If this is set, the
            `value` shouldn`t be. Used for proxies
          allOf:
            - $ref: '#/components/schemas/LeanAbiFunction'
      required:
        - name
        - type
    LeanAbiFunction:
      type: object
      properties:
        name:
          type: string
          example: initialize
          description: The function name
        inputs:
          description: The function inputs
          type: array
          items:
            $ref: '#/components/schemas/ParameterWithValue'
        outputs:
          description: The function outputs
          type: array
          items:
            $ref: '#/components/schemas/ParameterWithValue'
        stateMutability:
          type: string
          enum:
            - view
            - pure
            - nonpayable
            - payable
          example: nonpayable
          description: >-
            The state mutability of the function (e.g., view, pure, nonpayable,
            payable)
      required:
        - inputs
  responses:
    Error:
      description: Error Response
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorSchema'
  headers:
    X-Request-ID:
      schema:
        type: string
      description: >-
        Unique ID correlated to the API request. Please provide it in any
        support ticket you create or on Github issues related to Fireblocks SDKs

````