PingCAP Schema API

Endpoints for retrieving database and table schema information from the TiDB information schema.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 4

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /schema List all database schemas · Get all database schemas #
Ask an LLM
“Which databases does my TiDB instance know about?”
“Can I get the full information schema for every database at once?”
Tell an agent
List all schemas on this TiDB instance.
Show the information schema for every database.
GET /schema/{db} Get the schema of one database · Get database schema #
Ask an LLM
“What tables and columns exist in a particular database?”
“Can I get only table IDs and names for a large schema?”
Tell an agent
Show the schema of database {db}.
List only the table IDs and names in {db}.
GET /schema/{db}/{table} Get a table's full schema · Get table schema #
Ask an LLM
“What column types and indexes does a specific table have?”
“Can I look up a table by its numeric table ID?”
Tell an agent
Show the full schema of table {table} in {db}.
Get the column and index definitions for {db}.{table}.
GET /db-table/{tableID} Look up a table by its ID · Get table info by table ID #
Ask an LLM
“How do I find which database and table a table ID belongs to?”
“What is the current info schema version for a table?”
Tell an agent
Look up table {tableID} by its numeric ID.
Show the database, table and info schema version for table ID {tableID}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/pingcap:pingcap-schema-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

pingcap-schema-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: TiDB HTTP Schema API
  description: The TiDB HTTP API is a built-in administrative interface available on self-managed TiDB server instances, accessible on port 10080 by default.
  version: '1.0'
  contact:
    name: TiDB GitHub
    url: https://github.com/pingcap/tidb/blob/master/docs/tidb_http_api.md
  termsOfService: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost:10080
  description: Local TiDB Node (default status port)
tags:
- name: Schema
  description: Endpoints for retrieving database and table schema information from the TiDB information schema.
paths:
  /schema:
    get:
      operationId: getAllSchemas
      summary: Get all database schemas
      description: Returns schema information for all databases known to this TiDB instance. The response includes table names, column definitions, and index information as represented in the TiDB information schema.
      tags:
      - Schema
      responses:
        '200':
          description: All database schemas retrieved successfully.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DatabaseSchema'
  /schema/{db}:
    get:
      operationId: getDatabaseSchema
      summary: Get database schema
      description: Returns schema information for all tables in the specified database. Optionally set id_name_only to true to return only table IDs and names without the full column and index details, which is faster for large schemas.
      tags:
      - Schema
      parameters:
      - $ref: '#/components/parameters/db'
      - name: id_name_only
        in: query
        description: If true, returns only table IDs and names without full schema details.
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: Database schema retrieved successfully.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TableSchema'
        '404':
          description: The specified database was not found.
  /schema/{db}/{table}:
    get:
      operationId: getTableSchema
      summary: Get table schema
      description: Returns the full schema definition for the specified table, including all column names, types, default values, and index definitions. Can also look up a table by numeric table_id or multiple table_ids for batch retrieval.
      tags:
      - Schema
      parameters:
      - $ref: '#/components/parameters/db'
      - $ref: '#/components/parameters/table'
      - name: table_id
        in: query
        description: Optional numeric table ID for lookup by ID instead of name.
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: Table schema retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TableSchema'
        '404':
          description: The specified database or table was not found.
  /db-table/{tableID}:
    get:
      operationId: getTableByID
      summary: Get table info by table ID
      description: Returns database information, table information, and the current TiDB info schema version for a specific table identified by its numeric table ID. This is useful for reverse lookups when you have a table ID from region information but need the associated database and table names.
      tags:
      - Schema
      parameters:
      - name: tableID
        in: path
        description: The numeric TiDB internal table ID.
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: Table information retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TableByIDResponse'
        '404':
          description: No table with the specified ID was found.
components:
  parameters:
    table:
      name: table
      in: path
      description: The table name within the specified database.
      required: true
      schema:
        type: string
    db:
      name: db
      in: path
      description: The database name.
      required: true
      schema:
        type: string
  schemas:
    TableSchema:
      type: object
      description: Schema information for a TiDB table.
      properties:
        id:
          type: integer
          description: The internal numeric TiDB table ID.
        name:
          $ref: '#/components/schemas/CIStr'
        charset:
          type: string
          description: The character set of the table.
        collate:
          type: string
          description: The collation of the table.
        cols:
          type: array
          description: The list of column definitions in the table.
          items:
            $ref: '#/components/schemas/ColumnInfo'
        index_info:
          type: array
          description: The list of index definitions on the table.
          items:
            $ref: '#/components/schemas/IndexInfo'
    DatabaseSchema:
      type: object
      description: Schema information for a TiDB database.
      properties:
        db_name:
          $ref: '#/components/schemas/CIStr'
        charset:
          type: string
          description: The character set of the database.
        collate:
          type: string
          description: The collation of the database.
    TableByIDResponse:
      type: object
      description: Database and table information looked up by table ID.
      properties:
        db_info:
          $ref: '#/components/schemas/DatabaseSchema'
        table_info:
          $ref: '#/components/schemas/TableSchema'
    CIStr:
      type: object
      description: A case-insensitive string pair used in TiDB schema objects.
      properties:
        O:
          type: string
          description: The original case-preserved string value.
        L:
          type: string
          description: The lowercase version of the string.
    ColumnInfo:
      type: object
      description: A column definition within a TiDB table schema.
      properties:
        id:
          type: integer
          description: The internal numeric column ID.
        name:
          $ref: '#/components/schemas/CIStr'
        field_type:
          type: object
          description: The MySQL field type descriptor for this column.
    IndexInfo:
      type: object
      description: An index definition on a TiDB table.
      properties:
        id:
          type: integer
          description: The internal numeric index ID.
        idx_name:
          $ref: '#/components/schemas/CIStr'
        tbl_name:
          $ref: '#/components/schemas/CIStr'
        idx_cols:
          type: array
          description: The columns included in this index.
          items:
            type: object
        is_unique:
          type: boolean
          description: Whether this is a unique index.
        is_primary:
          type: boolean
          description: Whether this is the primary key index.
externalDocs:
  description: TiDB HTTP API Reference
  url: https://github.com/pingcap/tidb/blob/master/docs/tidb_http_api.md