Flow Collections API

The Collections API from Flow — 1 operation(s) for collections.

OpenAPI Specification

flow-blockchain-collections-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: 1.0.0
  title: Access Accounts Collections API
servers:
- url: https://rest-testnet.onflow.org/v1
  description: Flow Testnet
- url: https://rest-mainnet.onflow.org/v1
  description: Flow Mainnet
tags:
- name: Collections
paths:
  /collections/{id}:
    get:
      summary: Gets a Collection by ID
      description: Get a collection by provided collection ID.
      tags:
      - Collections
      parameters:
      - name: id
        in: path
        schema:
          $ref: '#/components/schemas/Identifier'
        required: true
        description: The collection ID.
      - $ref: '#/components/parameters/expandParam'
      - $ref: '#/components/parameters/selectParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Collection'
        '400':
          $ref: '#/components/responses/400BadRequest'
        '404':
          $ref: '#/components/responses/404NotFound'
        '500':
          $ref: '#/components/responses/500InternalServerError'
components:
  schemas:
    TransactionStatus:
      type: string
      description: This value indicates the state of the transaction execution. Only sealed and expired are final and immutable states.
      enum:
      - Pending
      - Finalized
      - Executed
      - Sealed
      - Expired
    Address:
      description: The 8-byte address of an account.
      type: string
      format: hexadecimal
      pattern: '[a-fA-F0-9]{16}'
    TransactionSignature:
      description: Base64 encoded signature.
      type: object
      required:
      - address
      - key_index
      - signature
      properties:
        address:
          $ref: '#/components/schemas/Address'
        key_index:
          type: string
          format: uint64
        signature:
          $ref: '#/components/schemas/Signature'
    Identifier:
      description: A 32-byte unique identifier for an entity.
      type: string
      format: hexadecimal
      pattern: '[a-fA-F0-9]{64}'
    Collection:
      type: object
      required:
      - id
      - _expandable
      properties:
        id:
          $ref: '#/components/schemas/Identifier'
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/Transaction'
        _expandable:
          type: object
          properties:
            transactions:
              type: array
              items:
                type: string
                format: uri
        _links:
          $ref: '#/components/schemas/Links'
    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
    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'
    Links:
      type: object
      properties:
        _self:
          type: string
    TransactionExecution:
      type: string
      description: This value indicates whether the transaction execution succeded or not, this value should be checked when determining transaction success.
      enum:
      - Pending
      - Success
      - Failure
    Transaction:
      type: object
      required:
      - id
      - script
      - arguments
      - reference_block_id
      - gas_limit
      - payer
      - proposal_key
      - authorizers
      - payload_signatures
      - envelope_signatures
      - _expandable
      properties:
        id:
          $ref: '#/components/schemas/Identifier'
        script:
          type: string
          format: base64
          description: Base64 encoded Cadence script.
        arguments:
          type: array
          description: Array of Base64 encoded arguments with in [JSON-Cadence interchange format](https://docs.onflow.org/cadence/json-cadence-spec/).
          items:
            type: string
            format: byte
        reference_block_id:
          $ref: '#/components/schemas/Identifier'
        gas_limit:
          type: string
          format: uint64
          description: The limit on the amount of computation a transaction is allowed to preform.
        payer:
          $ref: '#/components/schemas/Address'
        proposal_key:
          $ref: '#/components/schemas/ProposalKey'
        authorizers:
          type: array
          items:
            $ref: '#/components/schemas/Address'
        payload_signatures:
          type: array
          items:
            $ref: '#/components/schemas/TransactionSignature'
        envelope_signatures:
          type: array
          items:
            $ref: '#/components/schemas/TransactionSignature'
        result:
          $ref: '#/components/schemas/TransactionResult'
        _expandable:
          type: object
          properties:
            result:
              type: string
              format: uri
        _links:
          $ref: '#/components/schemas/Links'
    EventType:
      description: The qualified event type.
      type: string
    Signature:
      description: A variable length signature.
      type: string
      format: byte
    Error:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
    ProposalKey:
      type: object
      required:
      - address
      - key_index
      - sequence_number
      properties:
        address:
          $ref: '#/components/schemas/Address'
        key_index:
          type: string
          format: uint64
        sequence_number:
          type: string
          format: uint64
    TransactionResult:
      type: object
      required:
      - block_id
      - collection_id
      - status
      - status_code
      - error_message
      - computation_used
      - events
      properties:
        block_id:
          $ref: '#/components/schemas/Identifier'
        collection_id:
          $ref: '#/components/schemas/Identifier'
        execution:
          $ref: '#/components/schemas/TransactionExecution'
        status:
          $ref: '#/components/schemas/TransactionStatus'
        status_code:
          type: integer
        error_message:
          type: string
          description: Provided transaction error in case the transaction wasn't successful.
        computation_used:
          type: string
          format: uint64
        events:
          type: array
          items:
            $ref: '#/components/schemas/Event'
        metadata:
          $ref: '#/components/schemas/Metadata'
        _links:
          $ref: '#/components/schemas/Links'
    Metadata:
      description: Contains data about the node's state at the time of the request.
      type: object
      properties:
        executor_metadata:
          $ref: '#/components/schemas/ExecutorMetadata'
  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:
    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
    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
externalDocs:
  description: Find out more about the Access API
  url: https://docs.onflow.org/access-api/