Dapper Labs Blocks API

The Blocks API from Dapper Labs — 3 operation(s) for blocks.

OpenAPI Specification

dapper-labs-blocks-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: 1.0.0
  title: Access Accounts Blocks API
servers:
- url: https://rest-testnet.onflow.org/v1
  description: Flow Testnet
- url: https://rest-mainnet.onflow.org/v1
  description: Flow Mainnet
tags:
- name: Blocks
paths:
  /blocks:
    get:
      summary: Gets Blocks by Height
      description: Get block data by the provided height range or list of heights.
      tags:
      - Blocks
      parameters:
      - description: A comma-separated list of block heights to get. This parameter is incompatible with `start_height` and `end_height`.
        name: height
        in: query
        schema:
          type: array
          items:
            $ref: '#/components/schemas/BlockHeight'
          minItems: 1
          uniqueItems: true
        explode: false
        style: form
      - name: start_height
        in: query
        schema:
          $ref: '#/components/schemas/BlockHeight'
        required: false
        description: The start height of the block range to get. Must be used together with `end_height`. This parameter is incompatible with `height`.
      - name: end_height
        in: query
        schema:
          $ref: '#/components/schemas/BlockHeight'
        required: false
        description: The ending height of the block range to get. Must be used together with `start_height`. This parameter is incompatible with `height`.
      - $ref: '#/components/parameters/expandParam'
      - $ref: '#/components/parameters/selectParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Block'
        '400':
          $ref: '#/components/responses/400BadRequest'
        '404':
          $ref: '#/components/responses/404NotFound'
        '500':
          $ref: '#/components/responses/500InternalServerError'
  /blocks/{id}:
    get:
      summary: Get Blocks by ID.
      description: Get a block data or list of blocks by the provided ID or list of IDs.
      tags:
      - Blocks
      parameters:
      - description: A block ID or comma-separated list of block IDs.
        name: id
        in: path
        schema:
          type: array
          items:
            $ref: '#/components/schemas/Identifier'
          minItems: 1
          maxItems: 50
          uniqueItems: true
        explode: true
        required: true
      - $ref: '#/components/parameters/expandParam'
      - $ref: '#/components/parameters/selectParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Block'
        '400':
          $ref: '#/components/responses/400BadRequest'
        '404':
          $ref: '#/components/responses/404NotFound'
        '500':
          $ref: '#/components/responses/500InternalServerError'
  /blocks/{id}/payload:
    get:
      summary: Get Block Payload by Block ID.
      description: Get a block payload data by the provided block ID.
      tags:
      - Blocks
      parameters:
      - description: A block ID.
        name: id
        in: path
        schema:
          $ref: '#/components/schemas/Identifier'
        explode: true
        required: true
      - $ref: '#/components/parameters/expandParam'
      - $ref: '#/components/parameters/selectParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockPayload'
        '400':
          $ref: '#/components/responses/400BadRequest'
        '404':
          $ref: '#/components/responses/404NotFound'
        '500':
          $ref: '#/components/responses/500InternalServerError'
components:
  schemas:
    BlockHeight:
      oneOf:
      - type: string
        format: uint64
      - type: string
        enum:
        - final
        - sealed
    Links:
      type: object
      properties:
        _self:
          type: string
    EventType:
      description: The qualified event type.
      type: string
    CollectionGuarantee:
      type: object
      required:
      - collection_id
      - signer_ids
      - signature
      - reference_block_id
      - cluster_chain_id
      properties:
        collection_id:
          $ref: '#/components/schemas/Identifier'
        signer_ids:
          type: array
          items:
            $ref: '#/components/schemas/Identifier'
          minItems: 1
          uniqueItems: true
        signature:
          $ref: '#/components/schemas/Signature'
        reference_block_id:
          $ref: '#/components/schemas/Identifier'
        cluster_chain_id:
          type: string
    BlockHeader:
      type: object
      required:
      - id
      - parent_id
      - height
      - timestamp
      - parent_voter_signature
      properties:
        id:
          $ref: '#/components/schemas/Identifier'
        parent_id:
          $ref: '#/components/schemas/Identifier'
        height:
          type: string
          format: uint64
        timestamp:
          type: string
          format: date-time
        parent_voter_signature:
          $ref: '#/components/schemas/Signature'
    Metadata:
      description: Contains data about the node's state at the time of the request.
      type: object
      properties:
        executor_metadata:
          $ref: '#/components/schemas/ExecutorMetadata'
    BlockPayload:
      type: object
      required:
      - collection_guarantees
      - block_seals
      properties:
        collection_guarantees:
          type: array
          items:
            $ref: '#/components/schemas/CollectionGuarantee'
          uniqueItems: true
        block_seals:
          type: array
          items:
            $ref: '#/components/schemas/BlockSeal'
          uniqueItems: true
    AggregatedSignature:
      type: object
      required:
      - verifier_signatures
      - signer_ids
      properties:
        verifier_signatures:
          type: array
          items:
            $ref: '#/components/schemas/Signature'
          minItems: 1
          uniqueItems: true
        signer_ids:
          type: array
          items:
            $ref: '#/components/schemas/Identifier'
          minItems: 1
          uniqueItems: true
    BlockStatus:
      type: string
      description: This value indicates the status of a block.
      enum:
      - BLOCK_UNKNOWN
      - BLOCK_FINALIZED
      - BLOCK_SEALED
    Signature:
      description: A variable length signature.
      type: string
      format: byte
    ExecutorMetadata:
      type: object
      description: Contains data about the execution result used to serve the request.
      properties:
        execution_result_id:
          $ref: '#/components/schemas/Identifier'
        executor_ids:
          type: array
          items:
            $ref: '#/components/schemas/Identifier'
    Event:
      type: object
      required:
      - type
      - transaction_id
      - transaction_index
      - event_index
      - payload
      properties:
        type:
          $ref: '#/components/schemas/EventType'
        transaction_id:
          $ref: '#/components/schemas/Identifier'
        transaction_index:
          type: string
          format: uint64
        event_index:
          type: string
          format: uint64
        payload:
          type: string
          format: byte
    ExecutionResult:
      type: object
      required:
      - id
      - block_id
      - events
      - previous_result_id
      properties:
        id:
          $ref: '#/components/schemas/Identifier'
        block_id:
          $ref: '#/components/schemas/Identifier'
        events:
          type: array
          items:
            $ref: '#/components/schemas/Event'
        chunks:
          type: array
          items:
            $ref: '#/components/schemas/Chunk'
        previous_result_id:
          $ref: '#/components/schemas/Identifier'
        metadata:
          $ref: '#/components/schemas/Metadata'
        _links:
          $ref: '#/components/schemas/Links'
    StateCommitment:
      description: The root hash of the state tree.
      type: string
      format: hexadecimal
      pattern: '[a-fA-F0-9]{64}'
    Block:
      type: object
      required:
      - header
      - block_status
      properties:
        header:
          $ref: '#/components/schemas/BlockHeader'
        payload:
          $ref: '#/components/schemas/BlockPayload'
        execution_result:
          $ref: '#/components/schemas/ExecutionResult'
        _expandable:
          type: object
          properties:
            payload:
              type: string
            execution_result:
              type: string
              format: uri
        _links:
          $ref: '#/components/schemas/Links'
        block_status:
          $ref: '#/components/schemas/BlockStatus'
    BlockSeal:
      type: object
      required:
      - block_id
      - result_id
      - final_state
      - aggregated_approval_signatures
      properties:
        block_id:
          $ref: '#/components/schemas/Identifier'
        result_id:
          $ref: '#/components/schemas/Identifier'
        final_state:
          $ref: '#/components/schemas/StateCommitment'
        aggregated_approval_signatures:
          type: array
          items:
            $ref: '#/components/schemas/AggregatedSignature'
          minItems: 1
          uniqueItems: true
    Identifier:
      description: A 32-byte unique identifier for an entity.
      type: string
      format: hexadecimal
      pattern: '[a-fA-F0-9]{64}'
    Chunk:
      type: object
      required:
      - block_id
      - collection_index
      - start_state
      - end_state
      - event_collection
      - index
      - number_of_transactions
      - total_computation_used
      properties:
        block_id:
          $ref: '#/components/schemas/Identifier'
        collection_index:
          type: string
          format: uint64
        start_state:
          type: string
          format: byte
        end_state:
          type: string
          format: byte
        event_collection:
          type: string
          format: byte
        index:
          type: string
          format: uint64
        number_of_transactions:
          type: string
          format: uint64
        total_computation_used:
          type: string
          format: uint64
    Error:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
  responses:
    500InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    400BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    404NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  parameters:
    selectParam:
      description: A comma-separated list indicating which properties of the content to return.
      name: select
      in: query
      schema:
        type: array
        items:
          type: string
        minItems: 1
        uniqueItems: true
      explode: false
      style: form
      required: false
    expandParam:
      description: A comma-separated list indicating which properties of the content to expand.
      name: expand
      in: query
      schema:
        type: array
        items:
          type: string
        minItems: 1
        uniqueItems: true
      explode: false
      style: form
      required: false
externalDocs:
  description: Find out more about the Access API
  url: https://docs.onflow.org/access-api/