Avalanche Platform Chain API

JSON-RPC access to the Avalanche Primary Network Platform Chain (P-Chain) — balances, UTXOs, subnets, validators, staking, supply and blockchain status.

OpenAPI Specification

ava-labs-platform-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Avalanche Platform Chain API
  description: >-
    JSON-RPC 2.0 API for interacting with Avalanche's Platform Chain (P-Chain). All methods use POST to the same
    endpoint with the method specified in the request body.
  version: 1.0.0
servers:
  - url: https://api.avax.network/ext/bc
    description: Mainnet
  - url: https://api-test.avax.network/ext/bc
    description: Testnet
  - url: http://127.0.0.1:9650/ext/bc
    description: Testnet
paths:
  /P#platform.getHeight:
    post:
      summary: platform.getHeight
      description: GetHeight returns the height of the last accepted block
      operationId: platform_getHeight
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getHeight
                  default: platform.getHeight
                params:
                  type: object
                  example: {}
                  default: {}
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getHeight
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    type: object
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getProposedHeight:
    post:
      summary: platform.getProposedHeight
      description: GetProposedHeight returns the current ProposerVM height
      operationId: platform_getProposedHeight
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getProposedHeight
                  default: platform.getProposedHeight
                params:
                  type: object
                  example: {}
                  default: {}
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getProposedHeight
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    type: object
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getBalance:
    post:
      summary: platform.getBalance
      description: GetBalance gets the balance of an address
      operationId: platform_getBalance
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getBalance
                  default: platform.getBalance
                params:
                  $ref: '#/components/schemas/GetBalanceRequest'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getBalance
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetBalanceResponse'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getUTXOs:
    post:
      summary: platform.getUTXOs
      description: GetUTXOs returns the UTXOs controlled by the given addresses
      operationId: platform_getUTXOs
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getUTXOs
                  default: platform.getUTXOs
                params:
                  type: object
                  properties:
                    addresses:
                      type: array
                      items:
                        type: string
                      description: Addresses to get UTXOs for
                    limit:
                      type: integer
                      description: Max number of UTXOs to return
                    startIndex:
                      type: object
                      description: Starting index for pagination
                    sourceChain:
                      type: string
                      description: Chain to get UTXOs from
                    encoding:
                      type: string
                      enum:
                        - hex
                        - json
                      description: Encoding format
                  required:
                    - addresses
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getUTXOs
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    type: object
                    properties:
                      numFetched:
                        type: integer
                        description: Number of UTXOs fetched
                      utxos:
                        type: array
                        items:
                          type: string
                        description: UTXOs
                      endIndex:
                        type: object
                        description: End index for pagination
                      encoding:
                        type: string
                        description: Encoding format used
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getSubnet:
    post:
      summary: platform.getSubnet
      description: Calls the platform.getSubnet method
      operationId: platform_getSubnet
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getSubnet
                  default: platform.getSubnet
                params:
                  $ref: '#/components/schemas/GetSubnetArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getSubnet
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetSubnetResponse'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getSubnets:
    post:
      summary: platform.getSubnets
      description: Returns information about the specified Subnets. The response will include the primary network.
      operationId: platform_getSubnets
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getSubnets
                  default: platform.getSubnets
                params:
                  $ref: '#/components/schemas/GetSubnetsArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getSubnets
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetSubnetsResponse'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getStakingAssetID:
    post:
      summary: platform.getStakingAssetID
      description: GetStakingAssetID returns the assetID of the token used to stake on the provided subnet
      operationId: platform_getStakingAssetID
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getStakingAssetID
                  default: platform.getStakingAssetID
                params:
                  $ref: '#/components/schemas/GetStakingAssetIDArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getStakingAssetID
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetStakingAssetIDResponse'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getCurrentValidators:
    post:
      summary: platform.getCurrentValidators
      description: >-
        GetCurrentValidators returns the current validators. If a single nodeID is provided, full delegators information
        is also returned. Otherwise only delegators' number and total weight is returned.
      operationId: platform_getCurrentValidators
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getCurrentValidators
                  default: platform.getCurrentValidators
                params:
                  $ref: '#/components/schemas/GetCurrentValidatorsArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getCurrentValidators
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetCurrentValidatorsReply'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getL1Validator:
    post:
      summary: platform.getL1Validator
      description: GetL1Validator returns the L1 validator if it exists
      operationId: platform_getL1Validator
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getL1Validator
                  default: platform.getL1Validator
                params:
                  $ref: '#/components/schemas/GetL1ValidatorArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getL1Validator
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetL1ValidatorReply'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getCurrentSupply:
    post:
      summary: platform.getCurrentSupply
      description: GetCurrentSupply returns an upper bound on the supply of AVAX in the system
      operationId: platform_getCurrentSupply
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getCurrentSupply
                  default: platform.getCurrentSupply
                params:
                  $ref: '#/components/schemas/GetCurrentSupplyArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getCurrentSupply
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetCurrentSupplyReply'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.sampleValidators:
    post:
      summary: platform.sampleValidators
      description: SampleValidators returns a sampling of the list of current validators
      operationId: platform_sampleValidators
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.sampleValidators
                  default: platform.sampleValidators
                params:
                  $ref: '#/components/schemas/SampleValidatorsArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.sampleValidators
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/SampleValidatorsReply'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getBlockchainStatus:
    post:
      summary: platform.getBlockchainStatus
      description: Gets the status of a blockchain by its ID.
      operationId: platform_getBlockchainStatus
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getBlockchainStatus
                  default: platform.getBlockchainStatus
                params:
                  $ref: '#/components/schemas/GetBlockchainStatusArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.getBlockchainStatus
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/GetBlockchainStatusReply'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.validatedBy:
    post:
      summary: platform.validatedBy
      description: Returns the ID of the Subnet that validates the specified blockchain
      operationId: platform_validatedBy
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.validatedBy
                  default: platform.validatedBy
                params:
                  $ref: '#/components/schemas/ValidatedByArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.validatedBy
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/ValidatedByResponse'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.validates:
    post:
      summary: platform.validates
      description: Returns the IDs of the blockchains validated by the specified Subnet
      operationId: platform_validates
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.validates
                  default: platform.validates
                params:
                  $ref: '#/components/schemas/ValidatesArgs'
                  description: Method parameters
                id:
                  type: integer
                  example: 1
                  default: 1
              required:
                - jsonrpc
                - method
                - params
                - id
            examples:
              default:
                summary: Example request
                value:
                  jsonrpc: '2.0'
                  method: platform.validates
                  params: {}
                  id: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    example: '2.0'
                  result:
                    $ref: '#/components/schemas/ValidatesResponse'
                    description: Method result
                  id:
                    type: integer
                    example: 1
                required:
                  - jsonrpc
                  - result
                  - id
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONRPCError'
  /P#platform.getBlockchains:
    post:
      summary: platform.getBlockchains
      description: GetBlockchains returns all of the blockchains that exist
      operationId: platform_getBlockchains
      tags:
        - platform
      requestBody:
        required: true
        description: JSON-RPC request
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  example: '2.0'
                  default: '2.0'
                method:
                  type: string
                  example: platform.getBlockchains
                  default: platform.getBlockchains
                params:
                  type: object
                  example: {}
                  default: {}
                id:
                  type: integer
                  example: 1
              

# --- truncated at 32 KB (83 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/ava-labs/refs/heads/main/openapi/ava-labs-platform-api-openapi.yml