NEAR Protocol staking API

The staking API from NEAR Protocol — 2 operation(s) for staking.

OpenAPI Specification

near-staking-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  description: Low-latency indexed account, token, and public-key lookup APIs for wallets and explorers. Embedded portal clients may forward an optional `apiKey` query parameter, but the public FastNEAR API does not require it.
  title: FastNEAR accounts staking API
  version: 3.0.3
servers:
- description: Mainnet
  url: https://api.fastnear.com
- description: Testnet
  url: https://test.api.fastnear.com
tags:
- name: staking
paths:
  /v0/account/{account_id}/staking:
    get:
      description: Fetch staking pool account IDs for one account — pool IDs only, no block-height metadata.
      operationId: account_staking_v0
      parameters:
      - description: NEAR account ID to inspect.
        example: mob.near
        in: path
        name: account_id
        required: true
        schema:
          type: string
      - description: Optional API key forwarded by embedded portal clients. The public FastNEAR API does not require it.
        in: query
        name: apiKey
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              example:
                account_id: mob.near
                pools:
                - zavodil.poolv1.near
              schema:
                $ref: '#/components/schemas/V0StakingResponse'
          description: Staking pool account IDs for the requested account
        '400':
          content:
            application/json:
              schema:
                type: string
          description: Bad Request
        '500':
          content:
            application/json:
              schema:
                type: string
          description: Internal Server Error
      summary: Lookup staking pool account IDs for an account
      tags:
      - staking
      x-fastnear-slug: account_staking
      x-fastnear-title: FastNEAR API - V0 Account Staking
  /v1/account/{account_id}/staking:
    get:
      description: Retrieve staking pool rows for an account, including block-height metadata for each pool relationship.
      operationId: account_staking_v1
      parameters:
      - description: NEAR account ID to inspect.
        example: mob.near
        in: path
        name: account_id
        required: true
        schema:
          type: string
      - description: Optional API key forwarded by embedded portal clients. The public FastNEAR API does not require it.
        in: query
        name: apiKey
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              example:
                account_id: mob.near
                pools:
                - last_update_block_height: null
                  pool_id: zavodil.poolv1.near
              schema:
                $ref: '#/components/schemas/V1StakingResponse'
          description: Indexed staking pool rows for the requested account
        '400':
          content:
            application/json:
              schema:
                type: string
          description: Bad Request
        '500':
          content:
            application/json:
              schema:
                type: string
          description: Internal Server Error
      summary: Lookup indexed staking pools for an account
      tags:
      - staking
      x-fastnear-slug: account_staking
      x-fastnear-title: FastNEAR API - V1 Account Staking
components:
  schemas:
    PoolRow:
      additionalProperties: false
      properties:
        last_update_block_height:
          format: uint64
          minimum: 0
          nullable: true
          type: integer
        pool_id:
          type: string
      required:
      - pool_id
      - last_update_block_height
      type: object
    V0StakingResponse:
      additionalProperties: false
      properties:
        account_id:
          type: string
        pools:
          items:
            type: string
          type: array
      required:
      - account_id
      - pools
      type: object
    V1StakingResponse:
      additionalProperties: false
      properties:
        account_id:
          type: string
        pools:
          items:
            $ref: '#/components/schemas/PoolRow'
          type: array
      required:
      - account_id
      - pools
      type: object