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

# Get transaction

> Get the detail of a transaction given the transaction hash.

Provide the param "hash" or ("block_number" and "tx_index"). If both params are provided,
"hash" will be used.



## OpenAPI

````yaml get /v1/tx/detail
openapi: 3.0.2
info:
  title: 🛠️ Basic API
  version: v1.0.0
servers:
  - url: https://api.chainbase.online
    description: production server
security: []
paths:
  /v1/tx/detail:
    get:
      tags:
        - Transaction
      summary: Get transaction
      description: >-
        Get the detail of a transaction given the transaction hash.


        Provide the param "hash" or ("block_number" and "tx_index"). If both
        params are provided,

        "hash" will be used.
      operationId: GetTxDetail
      parameters:
        - description: >-
            chain network id, see [list of
            details](/platform/features/api/web3-api)
          required: true
          schema:
            title: Chain Id
            type: integer
            description: >-
              chain network id, see [list of
              details](/platform/features/api/web3-api)
          example: '1'
          name: chain_id
          in: query
        - description: The transaction hash
          required: false
          schema:
            title: Hash
            type: string
            description: The transaction hash
          example: '0xea1093d492a1dcb1bef708f771a99a96ff05dcab81ca76c31940300177fcf49f'
          name: hash
          in: query
        - description: Block number of the transaction
          required: false
          schema:
            title: Block Number
            type: integer
            description: Block number of the transaction
          name: block_number
          in: query
        - description: Index of the transaction
          required: false
          schema:
            title: Tx Index
            type: integer
            description: Index of the transaction
          name: tx_index
          in: query
        - required: true
          schema:
            title: X-Api-Key
            type: string
            example: demo
          example: demo
          name: x-api-key
          in: header
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseGetTxDetail'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    ResponseGetTxDetail:
      title: ResponseGetTxDetail
      required:
        - data
      type: object
      properties:
        code:
          title: Code
          type: integer
          default: 0
        message:
          title: Message
          type: string
          default: ok
        data:
          $ref: '#/components/schemas/TxDetail'
    ErrorMessage:
      title: ErrorMessage
      required:
        - code
        - message
      type: object
      properties:
        code:
          title: Code
          type: integer
        message:
          title: Message
          type: string
    TxDetail:
      title: TxDetail
      required:
        - type
        - status
        - block_number
        - block_timestamp
        - transaction_hash
        - transaction_index
        - from_address
        - to_address
        - value
        - input
        - nonce
        - contract_address
        - gas
        - gas_price
        - gas_used
        - effective_gas_price
        - cumulative_gas_used
        - max_fee_per_gas
        - max_priority_fee_per_gas
        - tx_fee
        - saving_fee
        - burnt_fee
      type: object
      properties:
        type:
          title: Type
          type: integer
          description: 'tx type, 0: LegacyTx, 1: AccessListTx, 2: DynamicFeeTx, 3: BlobTx'
        status:
          title: Status
          type: integer
          description: 'tx status, 0: failed, 1: success'
        block_number:
          title: Block Number
          type: integer
          description: block number
        block_timestamp:
          title: Block Timestamp
          type: string
          description: block time
          format: date-time
        transaction_hash:
          title: Transaction Hash
          type: string
          description: transaction hash
        transaction_index:
          title: Transaction Index
          type: integer
          description: transaction index
        from_address:
          title: From Address
          type: string
          description: from address
        to_address:
          title: To Address
          type: string
          description: to address
        value:
          title: Value
          type: string
          description: tx value
        input:
          title: Input
          type: string
          description: tx input
        nonce:
          title: Nonce
          type: integer
          description: from address nonce
        contract_address:
          title: Contract Address
          type: string
          description: contract address, when tx is contract creation tx
        gas:
          title: Gas
          type: integer
          description: gas limit
        gas_price:
          title: Gas Price
          type: integer
          description: gas price
        gas_used:
          title: Gas Used
          type: integer
          description: gas used
        effective_gas_price:
          title: Effective Gas Price
          type: integer
          description: effective gas price
        cumulative_gas_used:
          title: Cumulative Gas Used
          type: integer
          description: cumulative gas used
        max_fee_per_gas:
          title: Max Fee Per Gas
          type: integer
          description: max fee per gas
        max_priority_fee_per_gas:
          title: Max Priority Fee Per Gas
          type: integer
          description: max priority fee per gas
        tx_fee:
          title: Tx Fee
          type: integer
          description: tx fee
        saving_fee:
          title: Saving Fee
          type: integer
          description: saving fee
        burnt_fee:
          title: Burnt Fee
          type: integer
          description: burnt fee

````