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

# Get blocks

> Retrieves multiple blocks based on specified criteria.

## Cost

This endpoint costs **0.5 RU** (Request Units) per call.


## OpenAPI

````yaml POST /v1/rpc/getBlocks
openapi: 3.0.0
info:
  title: Kaspa Developer Platform (KDP) API
  description: >-
    A high-performance REST API providing real-time and historical data from the
    Kaspa blockchain
  version: '1.0'
  contact: {}
servers:
  - url: https://api.kas.fyi
    description: Mainnet API
security: []
tags:
  - name: Address
    description: Operations related to Kaspa addresses
  - name: Block
    description: Operations related to Kaspa blocks
  - name: Transaction
    description: Operations related to Kaspa transactions
  - name: Token
    description: Operations related to KRC20 tokens
  - name: Kaspa Node RPC Proxy
    description: Direct proxy to Kaspa node RPC methods
paths:
  /v1/rpc/getBlocks:
    post:
      tags:
        - Kaspa Node RPC Proxy
      summary: Get blocks
      description: Retrieves multiple blocks based on specified criteria.
      operationId: RpcController_getBlocks
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RpcGetBlocksRequestDto'
      responses:
        '200':
          description: Blocks retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RpcGetBlocksResponseDto'
      security:
        - x-api-key: []
components:
  schemas:
    RpcGetBlocksRequestDto:
      type: object
      properties:
        lowHash:
          type: string
          description: Low hash to start from
          example: fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41
        includeBlocks:
          type: boolean
          description: Whether to include blocks in the response
          example: true
        includeTransactions:
          type: boolean
          description: Whether to include transactions in the response
          example: true
      required:
        - includeBlocks
        - includeTransactions
    RpcGetBlocksResponseDto:
      type: object
      properties:
        blockHashes:
          description: Array of block hashes
          example:
            - fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41
            - 21e4944392af43783de33dd076c65dd3f5fd57ddaf6fd9f68674d33b54f1b575
          type: array
          items:
            type: string
        blocks:
          description: Array of complete block data (if includeBlocks was true)
          type: array
          items:
            $ref: '#/components/schemas/RpcBlockDto'
      required:
        - blockHashes
        - blocks
    RpcBlockDto:
      type: object
      properties:
        header:
          description: Block header
          allOf:
            - $ref: '#/components/schemas/RpcHeaderDto'
        transactions:
          description: Transactions in this block
          type: array
          items:
            $ref: '#/components/schemas/RpcTransactionDto'
        verboseData:
          description: Optional verbose data provided by RPC
          allOf:
            - $ref: '#/components/schemas/RpcBlockVerboseDataDto'
      required:
        - header
        - transactions
    RpcHeaderDto:
      type: object
      properties:
        hash:
          type: string
          description: Block hash
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        version:
          type: number
          description: Block version
          example: 1
        parentsByLevel:
          description: Parents by level
          example:
            - - 0x1234567890abcdef...
            - - 0x9876543210fedcba...
          type: array
          items:
            type: string
        hashMerkleRoot:
          type: string
          description: Hash merkle root
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        acceptedIdMerkleRoot:
          type: string
          description: Accepted ID merkle root
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        utxoCommitment:
          type: string
          description: UTXO commitment
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        timestamp:
          type: string
          description: Block timestamp
          example: '1638360000000'
        bits:
          type: number
          description: Difficulty bits
          example: 393216
        nonce:
          type: string
          description: Nonce
          example: '12345678901234567890'
        daaScore:
          type: string
          description: DAA score
          example: '1234567'
        blueWork:
          type: string
          description: Blue work
          example: '123456789012345'
        blueScore:
          type: string
          description: Blue score
          example: '1234567'
        pruningPoint:
          type: string
          description: Pruning point hash
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
      required:
        - hash
        - version
        - parentsByLevel
        - hashMerkleRoot
        - acceptedIdMerkleRoot
        - utxoCommitment
        - timestamp
        - bits
        - nonce
        - daaScore
        - blueWork
        - blueScore
        - pruningPoint
    RpcTransactionDto:
      type: object
      properties:
        version:
          type: number
          description: Transaction version
          example: 1
        inputs:
          description: Transaction inputs
          type: array
          items:
            $ref: '#/components/schemas/RpcTransactionInputDto'
        outputs:
          description: Transaction outputs
          type: array
          items:
            $ref: '#/components/schemas/RpcTransactionOutputDto'
        lockTime:
          type: string
          description: Lock time
          example: '0'
        subnetworkId:
          type: string
          description: Subnetwork ID
          example: '0100000000000000000000000000000000000000'
        gas:
          type: string
          description: Gas limit
          example: '0'
        payload:
          type: string
          description: Transaction payload
          example: 0x
        mass:
          type: string
          description: Transaction mass
          example: '1000'
        verboseData:
          description: Optional verbose data provided by RPC
          allOf:
            - $ref: '#/components/schemas/RpcTransactionVerboseDataDto'
      required:
        - version
        - inputs
        - outputs
        - lockTime
        - subnetworkId
        - gas
        - payload
    RpcBlockVerboseDataDto:
      type: object
      properties:
        hash:
          type: string
          description: Block hash
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        difficulty:
          type: number
          description: Block difficulty
          example: 1.5
        selectedParentHash:
          type: string
          description: Selected parent hash
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        transactionIds:
          description: Transaction IDs in this block
          example:
            - 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
            - '0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba'
          type: array
          items:
            type: string
        isHeaderOnly:
          type: boolean
          description: Whether this is a header-only block
          example: false
        blueScore:
          type: number
          description: Blue score
          example: 1234567
        childrenHashes:
          description: Children hashes
          example:
            - 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
          type: array
          items:
            type: string
        mergeSetBluesHashes:
          description: Merge set blue hashes
          example:
            - 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
          type: array
          items:
            type: string
        mergeSetRedsHashes:
          description: Merge set red hashes
          example:
            - '0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba'
          type: array
          items:
            type: string
        isChainBlock:
          type: boolean
          description: Whether this is a chain block
          example: true
      required:
        - hash
        - difficulty
        - selectedParentHash
        - transactionIds
        - isHeaderOnly
        - blueScore
        - childrenHashes
        - mergeSetBluesHashes
        - mergeSetRedsHashes
        - isChainBlock
    RpcTransactionInputDto:
      type: object
      properties:
        previousOutpoint:
          description: Previous transaction outpoint
          allOf:
            - $ref: '#/components/schemas/RpcTransactionOutpointDto'
        signatureScript:
          type: string
          description: Signature script in hex format
          example: 0x473044...
        sequence:
          type: string
          description: Input sequence number
          example: '4294967295'
        sigOpCount:
          type: number
          description: Number of signature operations
          example: 1
      required:
        - previousOutpoint
        - sequence
        - sigOpCount
    RpcTransactionOutputDto:
      type: object
      properties:
        value:
          type: string
          description: Output value in SOMPI
          example: '1000000000'
        scriptPublicKey:
          type: string
          description: Script public key
        verboseData:
          description: Optional verbose data provided by RPC
          allOf:
            - $ref: '#/components/schemas/RpcTransactionOutputVerboseDataDto'
      required:
        - value
        - scriptPublicKey
    RpcTransactionVerboseDataDto:
      type: object
      properties:
        transactionId:
          type: string
          description: Transaction ID
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        hash:
          type: string
          description: Transaction hash
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        computeMass:
          type: string
          description: Computed mass of the transaction
          example: '1000'
        blockHash:
          type: string
          description: Block hash containing this transaction
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        blockTime:
          type: string
          description: Block time
          example: '1638360000000'
      required:
        - transactionId
        - hash
        - computeMass
        - blockHash
        - blockTime
    RpcTransactionOutpointDto:
      type: object
      properties:
        transactionId:
          type: string
          description: Transaction ID
          example: 34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6
        index:
          type: number
          description: Output index
          example: 0
      required:
        - transactionId
        - index
    RpcTransactionOutputVerboseDataDto:
      type: object
      properties:
        scriptPublicKeyType:
          type: string
          description: Script public key type
          example: pubkeyhash
        scriptPublicKeyAddress:
          type: string
          description: Script public key address
          example: kaspa:qpzpfwcsqsxhxwup26r55fd0ghqlhyugz8cp6y3wxuddc02vcxtjg75pspnwz
      required:
        - scriptPublicKeyType
        - scriptPublicKeyAddress
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key required for authentication. Get your API key at
        https://developer.kas.fyi

````