openapi: 3.1.0
info:
  title: 'NEAR Protocol RPC: Node Status'
  description: >-
    Retrieve detailed information about the current status of a NEAR Protocol
    node
  version: 1.0.0
servers:
  - url: https://rpc.mainnet.fastnear.com
    description: Mainnet
  - url: https://rpc.testnet.fastnear.com
    description: Testnet
paths:
  /:
    post:
      operationId: status
      summary: Get node status
      description: >-
        Retrieves current status of the node including sync info, validator
        status and build information
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                id:
                  type: string
                  example: fastnear
                method:
                  type: string
                  enum:
                    - status
                params:
                  type: array
                  maxItems: 0
                  description: Empty array as this method takes no parameters
                  example: []
            examples:
              mainnet:
                summary: Mainnet Node Status
                value:
                  jsonrpc: '2.0'
                  id: fastnear
                  method: status
                  params: []
              testnet:
                summary: Testnet Node Status
                value:
                  jsonrpc: '2.0'
                  id: fastnear
                  method: status
                  params: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponse'
components:
  schemas:
    JsonRpcResponse:
      type: object
      required:
        - jsonrpc
        - id
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
        id:
          oneOf:
            - type: string
            - type: number
        result:
          type: object
          properties:
            chain_id:
              type: string
              description: Unique chain id.
            detailed_debug_status:
              type:
                - object
                - 'null'
              properties:
                block_production_delay_millis:
                  type: integer
                  format: uint64
                  minimum: 0
                catchup_status:
                  type: array
                  items:
                    type: object
                current_head_status:
                  type: object
                  description: Height and hash of a block
                current_header_head_status:
                  type: object
                  description: Height and hash of a block
                network_info:
                  type: object
                sync_status:
                  type: string
              required:
                - network_info
                - sync_status
                - catchup_status
                - current_head_status
                - current_header_head_status
                - block_production_delay_millis
            genesis_hash:
              type: string
              description: Base58-encoded hash
            latest_protocol_version:
              type: integer
              description: Latest protocol version that this client supports.
              format: uint32
              minimum: 0
            node_key:
              type:
                - string
                - 'null'
              description: 'ed25519: or secp256k1: prefixed public key'
            node_public_key:
              type: string
              description: 'ed25519: or secp256k1: prefixed public key'
            protocol_version:
              type: integer
              description: Currently active protocol version.
              format: uint32
              minimum: 0
            rpc_addr:
              type:
                - string
                - 'null'
              description: >-
                Address for RPC server.  None if node doesn't have RPC endpoint
                enabled.
            sync_info:
              type: object
              properties:
                earliest_block_hash:
                  type:
                    - string
                    - 'null'
                  description: Base58-encoded hash
                earliest_block_height:
                  type:
                    - integer
                    - 'null'
                  format: uint64
                  minimum: 0
                earliest_block_time:
                  type:
                    - string
                    - 'null'
                epoch_id:
                  type:
                    - string
                    - 'null'
                  description: Base58-encoded epoch identifier hash
                epoch_start_height:
                  type:
                    - integer
                    - 'null'
                  format: uint64
                  minimum: 0
                latest_block_hash:
                  type: string
                  description: Base58-encoded hash
                latest_block_height:
                  type: integer
                  format: uint64
                  minimum: 0
                latest_block_time:
                  type: string
                latest_state_root:
                  type: string
                  description: Base58-encoded hash
                syncing:
                  type: boolean
              required:
                - latest_block_hash
                - latest_block_height
                - latest_state_root
                - latest_block_time
                - syncing
              description: Sync status of the node.
            uptime_sec:
              type: integer
              description: Uptime of the node.
              format: int64
            validator_account_id:
              type:
                - string
                - 'null'
              description: NEAR account ID
            validator_public_key:
              type:
                - string
                - 'null'
              description: 'ed25519: or secp256k1: prefixed public key'
            validators:
              type: array
              items:
                type: object
              description: Current epoch validators.
            version:
              type: object
              description: Data structure for semver version and github tag or commit.
              properties:
                build:
                  type: string
                commit:
                  type: string
                rustc_version:
                  type: string
                  default: ''
                version:
                  type: string
              required:
                - version
                - build
                - commit
          required:
            - version
            - chain_id
            - protocol_version
            - latest_protocol_version
            - validators
            - sync_info
            - node_public_key
            - uptime_sec
            - genesis_hash
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            data:
              type: object
