TiKV Regions API

Region management and inspection

OpenAPI Specification

tikv-regions-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: TiKV HTTP Management Configuration Regions API
  description: TiKV exposes an HTTP management API on each node for status monitoring, configuration management, and Prometheus metrics. The default port is 20160 for TiKV nodes and 2379 for PD (Placement Driver) nodes.
  version: '7.1'
  contact:
    name: TiKV Community
    url: https://tikv.org/
  license:
    name: Apache 2.0
    url: https://github.com/tikv/tikv/blob/master/LICENSE
servers:
- url: http://localhost:20160
  description: TiKV node HTTP API (default port)
tags:
- name: Regions
  description: Region management and inspection
paths:
  /region/id/{id}:
    get:
      operationId: getRegionById
      summary: Get Region By ID
      description: Returns information about a specific Raft region by its ID including region metadata, leader, and peers.
      tags:
      - Regions
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Region ID
      responses:
        '200':
          description: Region information returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegionInfo'
        '404':
          description: Region not found
  /region/key/{key}:
    get:
      operationId: getRegionByKey
      summary: Get Region By Key
      description: Returns the Raft region that contains the specified key.
      tags:
      - Regions
      parameters:
      - name: key
        in: path
        required: true
        schema:
          type: string
        description: Key to look up (hex-encoded)
      responses:
        '200':
          description: Region information returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegionInfo'
  /regions/meta:
    get:
      operationId: getAllRegionsMeta
      summary: Get All Regions Metadata
      description: Returns metadata for all Raft regions on this TiKV node.
      tags:
      - Regions
      responses:
        '200':
          description: Regions metadata returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  regions:
                    type: array
                    items:
                      $ref: '#/components/schemas/RegionInfo'
components:
  schemas:
    RegionInfo:
      type: object
      properties:
        id:
          type: integer
          description: Region ID
        start_key:
          type: string
          description: Start key of the region (hex-encoded)
        end_key:
          type: string
          description: End key of the region (hex-encoded)
        region_epoch:
          type: object
          properties:
            conf_ver:
              type: integer
            version:
              type: integer
        peers:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              store_id:
                type: integer
        leader:
          type: object
          properties:
            id:
              type: integer
            store_id:
              type: integer
        written_bytes:
          type: integer
        read_bytes:
          type: integer
        approximate_size:
          type: integer
          description: Approximate region size in bytes
        approximate_keys:
          type: integer
          description: Approximate number of keys in region