Aleo Programs API

Deployed program and mapping queries

OpenAPI Specification

aleo-programs-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Aleo Node REST Blocks Programs API
  description: The public REST API exposed by Aleo network nodes (snarkOS), served through Provable's public gateway at api.explorer.provable.com. It provides read access to on-chain state — the latest block height/hash/state root, blocks and their transactions, deployed programs and their mappings, and the current validator committee — plus a broadcast endpoint for submitting signed transactions to the network. The API is unauthenticated and read-only for query endpoints. Endpoints were verified live against the mainnet gateway; the route surface follows the snarkOS node REST implementation.
  version: v1
  contact:
    name: Provable / Aleo Developer Community
    url: https://docs.aleo.org/
  license:
    name: Apache-2.0
    url: https://github.com/ProvableHQ/snarkOS/blob/staging/LICENSE.md
servers:
- url: https://api.explorer.provable.com/v1
  description: Provable public gateway (mainnet + testnet)
tags:
- name: Programs
  description: Deployed program and mapping queries
paths:
  /{network}/program/{programId}:
    get:
      operationId: getProgram
      tags:
      - Programs
      summary: Get program source
      description: Returns the Aleo instructions (bytecode) for the deployed program with the given program ID, e.g. credits.aleo.
      parameters:
      - $ref: '#/components/parameters/Network'
      - name: programId
        in: path
        required: true
        description: Program ID, e.g. credits.aleo.
        schema:
          type: string
        example: credits.aleo
      responses:
        '200':
          description: The program source.
          content:
            application/json:
              schema:
                type: string
        '404':
          description: Program not found.
  /{network}/program/{programId}/mappings:
    get:
      operationId: getProgramMappings
      tags:
      - Programs
      summary: List a program's mapping names
      description: Returns the names of the mappings declared by the program.
      parameters:
      - $ref: '#/components/parameters/Network'
      - name: programId
        in: path
        required: true
        schema:
          type: string
        example: credits.aleo
      responses:
        '200':
          description: The mapping names.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /{network}/program/{programId}/mapping/{mappingName}/{key}:
    get:
      operationId: getMappingValue
      tags:
      - Programs
      summary: Get a mapping value
      description: Returns the value stored under the given key in the named mapping of the program (e.g. the account balance in credits.aleo/account).
      parameters:
      - $ref: '#/components/parameters/Network'
      - name: programId
        in: path
        required: true
        schema:
          type: string
        example: credits.aleo
      - name: mappingName
        in: path
        required: true
        schema:
          type: string
        example: account
      - name: key
        in: path
        required: true
        description: The mapping key (e.g. an Aleo address).
        schema:
          type: string
      responses:
        '200':
          description: The mapping value (null if unset).
          content:
            application/json:
              schema:
                type: string
                nullable: true
components:
  parameters:
    Network:
      name: network
      in: path
      required: true
      description: The Aleo network to query.
      schema:
        type: string
        enum:
        - mainnet
        - testnet
        default: mainnet
externalDocs:
  description: Aleo developer documentation
  url: https://docs.aleo.org/