{
  "components": {
    "schemas": {
      "ErrorResponse": {
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "server.adminObjectBackendPatchRequest": {
        "properties": {
          "access_key_id": {
            "type": "string"
          },
          "account_id": {
            "type": "string"
          },
          "bucket": {
            "type": "string"
          },
          "credential_kind": {
            "type": "string"
          },
          "endpoint": {
            "type": "string"
          },
          "external_id": {
            "type": "string"
          },
          "force_path_style": {
            "type": "boolean"
          },
          "max_session_ttl_sec": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "role_arn": {
            "type": "string"
          },
          "scheme": {
            "type": "string"
          },
          "secret_access_key": {
            "type": "string"
          },
          "sts_endpoint": {
            "type": "string"
          }
        },
        "required": [
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.adminObjectBackendRequest": {
        "properties": {
          "access_key_id": {
            "type": "string"
          },
          "account_id": {
            "type": "string"
          },
          "bucket": {
            "type": "string"
          },
          "credential_kind": {
            "type": "string"
          },
          "endpoint": {
            "type": "string"
          },
          "external_id": {
            "type": "string"
          },
          "force_path_style": {
            "type": "boolean"
          },
          "max_session_ttl_sec": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "role_arn": {
            "type": "string"
          },
          "scheme": {
            "type": "string"
          },
          "secret_access_key": {
            "type": "string"
          },
          "sts_endpoint": {
            "type": "string"
          }
        },
        "required": [
          "public_key",
          "private_key",
          "name",
          "scheme",
          "endpoint",
          "sts_endpoint",
          "region",
          "account_id",
          "force_path_style",
          "bucket",
          "prefix",
          "credential_kind",
          "role_arn",
          "access_key_id",
          "secret_access_key",
          "external_id",
          "max_session_ttl_sec"
        ],
        "type": "object"
      },
      "server.adminObjectBackendView": {
        "properties": {
          "access_key_id": {
            "type": "string"
          },
          "account_id": {
            "type": "string"
          },
          "bucket": {
            "type": "string"
          },
          "credential_kind": {
            "type": "string"
          },
          "endpoint": {
            "type": "string"
          },
          "force_path_style": {
            "type": "boolean"
          },
          "has_external_id": {
            "type": "boolean"
          },
          "has_secret": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "max_session_ttl_sec": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "organization_id": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "role_arn": {
            "type": "string"
          },
          "scheme": {
            "type": "string"
          },
          "sts_endpoint": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "organization_id",
          "scheme",
          "endpoint",
          "region",
          "force_path_style",
          "bucket",
          "prefix",
          "credential_kind",
          "role_arn",
          "has_secret",
          "has_external_id",
          "max_session_ttl_sec"
        ],
        "type": "object"
      },
      "server.adminObjectNamespaceRequest": {
        "properties": {
          "namespace_id": {
            "type": "string"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          }
        },
        "required": [
          "public_key",
          "private_key",
          "namespace_id"
        ],
        "type": "object"
      },
      "server.adminQuotaResponse": {
        "properties": {
          "config": {
            "$ref": "#/components/schemas/server.quotaConfigResponse"
          },
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "usage": {
            "$ref": "#/components/schemas/server.quotaUsageResponse"
          }
        },
        "required": [
          "tenant_id",
          "status",
          "config",
          "usage"
        ],
        "type": "object"
      },
      "server.adminTenantCreateRequest": {
        "properties": {
          "display_name": {
            "type": "string"
          },
          "label": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "max_file_count": {
            "format": "int64",
            "type": "integer"
          },
          "max_file_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_media_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "max_storage_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_video_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "tidbcloud_spending_limit": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "public_key",
          "private_key",
          "display_name",
          "label"
        ],
        "type": "object"
      },
      "server.adminTenantCreateResponse": {
        "properties": {
          "api_key": {
            "type": "string"
          },
          "cloud_provider": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "label": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "region": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "display_name",
          "label",
          "api_key",
          "status"
        ],
        "type": "object"
      },
      "server.adminTenantDeleteResponse": {
        "properties": {
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "status"
        ],
        "type": "object"
      },
      "server.adminTenantListResponse": {
        "properties": {
          "next_page": {
            "format": "int64",
            "type": "integer"
          },
          "page": {
            "format": "int64",
            "type": "integer"
          },
          "page_size": {
            "format": "int64",
            "type": "integer"
          },
          "tenants": {
            "items": {
              "$ref": "#/components/schemas/server.adminTenantResponse"
            },
            "type": "array"
          }
        },
        "required": [
          "tenants",
          "page",
          "page_size"
        ],
        "type": "object"
      },
      "server.adminTenantPoolRequest": {
        "properties": {
          "pool_size": {
            "format": "int64",
            "type": "integer"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          }
        },
        "required": [
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.adminTenantPoolResponse": {
        "properties": {
          "free_size": {
            "format": "int64",
            "type": "integer"
          },
          "organization_id": {
            "type": "string"
          },
          "pool_id": {
            "type": "string"
          },
          "pool_size": {
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "pool_id",
          "pool_size",
          "free_size",
          "status"
        ],
        "type": "object"
      },
      "server.adminTenantQuotaRequest": {
        "properties": {
          "max_file_count": {
            "format": "int64",
            "type": "integer"
          },
          "max_file_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_media_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "max_storage_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_video_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "tidbcloud_spending_limit": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.adminTenantQuotaSummary": {
        "properties": {
          "config": {
            "$ref": "#/components/schemas/server.quotaConfigResponse"
          },
          "usage": {
            "$ref": "#/components/schemas/server.quotaUsageResponse"
          }
        },
        "required": [
          "config",
          "usage"
        ],
        "type": "object"
      },
      "server.adminTenantResponse": {
        "properties": {
          "display_name": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "label": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "quota": {
            "$ref": "#/components/schemas/server.adminTenantQuotaSummary"
          },
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "display_name",
          "label",
          "status",
          "kind"
        ],
        "type": "object"
      },
      "server.controlPlaneRevokeByAPIKeyRequest": {
        "properties": {
          "api_key": {
            "type": "string"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "api_key",
          "tenant_id",
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.controlPlaneTokenMutationResponse": {
        "properties": {
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "token_id": {
            "type": "string"
          }
        },
        "required": [
          "token_id",
          "tenant_id",
          "status"
        ],
        "type": "object"
      },
      "server.credentialProvisionRequest": {
        "properties": {
          "Credential": {
            "$ref": "#/components/schemas/tenant.CredentialProvisionRequest"
          },
          "Quota": {
            "$ref": "#/components/schemas/server.quotaRequest"
          }
        },
        "type": "object"
      },
      "server.embeddingConfigPutRequest": {
        "properties": {
          "api_base": {
            "type": "string"
          },
          "api_key": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "server.embeddingConfigResponse": {
        "properties": {
          "api_base": {
            "type": "string"
          },
          "api_key": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "generation": {
            "format": "int64",
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "source"
        ],
        "type": "object"
      },
      "server.extractConfigPutRequest": {
        "properties": {},
        "type": "object"
      },
      "server.extractConfigResponse": {
        "properties": {
          "api_base": {
            "type": "string"
          },
          "api_key": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "protocol": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "source"
        ],
        "type": "object"
      },
      "server.generateTokenRequest": {
        "properties": {
          "key_name": {
            "type": "string"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "ttl_seconds": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "tenant_id",
          "key_name",
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.generateTokenResponse": {
        "properties": {
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "issued_at": {
            "format": "date-time",
            "type": "string"
          },
          "key_name": {
            "type": "string"
          },
          "scope_kind": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "token": {
            "type": "string"
          },
          "token_id": {
            "type": "string"
          }
        },
        "required": [
          "token",
          "token_id",
          "tenant_id",
          "key_name",
          "scope_kind",
          "status",
          "issued_at"
        ],
        "type": "object"
      },
      "server.quotaConfigResponse": {
        "properties": {
          "max_file_count": {
            "format": "int64",
            "type": "integer"
          },
          "max_file_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_media_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "max_storage_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_video_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "tidbcloud_spending_limit": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "max_storage_size",
          "max_file_size",
          "max_file_count",
          "max_media_llm_files",
          "max_video_llm_files"
        ],
        "type": "object"
      },
      "server.quotaRequest": {
        "properties": {
          "max_file_count": {
            "format": "int64",
            "type": "integer"
          },
          "max_file_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_media_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "max_storage_size": {
            "format": "int64",
            "type": "integer"
          },
          "max_video_llm_files": {
            "format": "int64",
            "type": "integer"
          },
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "tidbcloud_spending_limit": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "tenant_id",
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.quotaResponse": {
        "properties": {
          "config": {
            "$ref": "#/components/schemas/server.quotaConfigResponse"
          },
          "provider": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "supports_update": {
            "type": "boolean"
          },
          "tenant_id": {
            "type": "string"
          },
          "usage": {
            "$ref": "#/components/schemas/server.quotaUsageResponse"
          }
        },
        "required": [
          "tenant_id",
          "provider",
          "status",
          "supports_update",
          "config",
          "usage"
        ],
        "type": "object"
      },
      "server.quotaUsageResponse": {
        "properties": {
          "file_count": {
            "format": "int64",
            "type": "integer"
          },
          "media_file_count": {
            "format": "int64",
            "type": "integer"
          },
          "reserved_bytes": {
            "format": "int64",
            "type": "integer"
          },
          "storage_bytes": {
            "format": "int64",
            "type": "integer"
          },
          "video_file_count": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "storage_bytes",
          "reserved_bytes",
          "file_count",
          "media_file_count",
          "video_file_count"
        ],
        "type": "object"
      },
      "server.tokenDeleteRequest": {
        "properties": {
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.tokenListItem": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "expired": {
            "type": "boolean"
          },
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "issued_at": {
            "format": "date-time",
            "type": "string"
          },
          "issued_by_metadata_json": {},
          "issued_by_provider": {
            "type": "string"
          },
          "issued_by_subject_key": {
            "type": "string"
          },
          "key_name": {
            "type": "string"
          },
          "revoked_at": {
            "format": "date-time",
            "type": "string"
          },
          "scope_kind": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "token_id": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "token_id",
          "tenant_id",
          "key_name",
          "scope_kind",
          "status",
          "expired",
          "issued_at",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "server.tokenListResponse": {
        "properties": {
          "next_offset": {
            "format": "int64",
            "type": "integer"
          },
          "tokens": {
            "items": {
              "$ref": "#/components/schemas/server.tokenListItem"
            },
            "type": "array"
          },
          "truncated_tenants": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "tokens"
        ],
        "type": "object"
      },
      "server.tokenStatusTransitionRequest": {
        "properties": {
          "private_key": {
            "type": "string"
          },
          "public_key": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "tenant_id",
          "public_key",
          "private_key"
        ],
        "type": "object"
      },
      "server.tokenStatusTransitionResponse": {
        "properties": {
          "status": {
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "token_id": {
            "type": "string"
          }
        },
        "required": [
          "token_id",
          "tenant_id",
          "status"
        ],
        "type": "object"
      },
      "tenant.CredentialProvisionRequest": {
        "properties": {
          "PrivateKey": {
            "type": "string"
          },
          "PublicKey": {
            "type": "string"
          }
        },
        "required": [
          "PublicKey",
          "PrivateKey"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "TiDBCloudJWT": {
        "description": "TiDB Cloud user JWT: `Bearer \u003cjwt\u003e`. The target organization must be passed as the `orgId` query parameter on every request.",
        "in": "header",
        "name": "X-TiDB-Cloud-Authorization",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "description": "Control-plane API for managing drive9 tenants, quotas, object backends, tenant pools and API keys from TiDB Cloud. Authenticated with a TiDB Cloud user JWT (X-TiDB-Cloud-Authorization: Bearer \u003cjwt\u003e). Every request must carry the numeric orgId query parameter selecting the organization.",
    "license": {
      "name": "Apache-2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "title": "Drive9 Control Plane API — TiDB Cloud JWT",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/v1/admin/object-backends": {
      "get": {
        "operationId": "get-v1-admin-object-backends",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "backends": {
                      "items": {
                        "$ref": "#/components/schemas/server.adminObjectBackendView"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "backends"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "List of object backend views."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "List object backends of the authenticated organization"
      },
      "post": {
        "operationId": "post-v1-admin-object-backends",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminObjectBackendRequest"
              }
            }
          },
          "description": "Object backend definition (scheme, bucket, credentials).",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminObjectBackendView"
                }
              }
            },
            "description": "Created object backend."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Create an object backend"
      }
    },
    "/v1/admin/object-backends/{backend_id}": {
      "delete": {
        "operationId": "delete-v1-admin-object-backends-by-backend_id",
        "parameters": [
          {
            "in": "path",
            "name": "backend_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "status"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "id and status."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Delete an object backend"
      },
      "get": {
        "operationId": "get-v1-admin-object-backends-by-backend_id",
        "parameters": [
          {
            "in": "path",
            "name": "backend_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminObjectBackendView"
                }
              }
            },
            "description": "Object backend view."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Get one object backend"
      },
      "patch": {
        "operationId": "patch-v1-admin-object-backends-by-backend_id",
        "parameters": [
          {
            "in": "path",
            "name": "backend_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminObjectBackendPatchRequest"
              }
            }
          },
          "description": "Fields to update (all optional).",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminObjectBackendView"
                }
              }
            },
            "description": "Updated object backend."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Update an object backend (partial patch)"
      },
      "put": {
        "operationId": "put-v1-admin-object-backends-by-backend_id",
        "parameters": [
          {
            "in": "path",
            "name": "backend_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminObjectBackendPatchRequest"
              }
            }
          },
          "description": "Fields to update (all optional).",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminObjectBackendView"
                }
              }
            },
            "description": "Updated object backend."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Update an object backend (PUT alias of PATCH)"
      }
    },
    "/v1/admin/tenant-pool": {
      "delete": {
        "operationId": "delete-v1-admin-tenant-pool",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "private_key": {
                    "type": "string"
                  },
                  "public_key": {
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "description": "Optional public_key/private_key credentials.",
          "required": false
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantPoolResponse"
                }
              }
            },
            "description": "Pool delete accepted; cleanup runs asynchronously."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Delete the organization tenant pool"
      },
      "get": {
        "operationId": "get-v1-admin-tenant-pool",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantPoolResponse"
                }
              }
            },
            "description": "Pool status."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Get the organization tenant pool status"
      },
      "patch": {
        "operationId": "patch-v1-admin-tenant-pool",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminTenantPoolRequest"
              }
            }
          },
          "description": "New target size.",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantPoolResponse"
                }
              }
            },
            "description": "Resize accepted; runs asynchronously."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Resize the organization tenant pool"
      },
      "post": {
        "operationId": "post-v1-admin-tenant-pool",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminTenantPoolRequest"
              }
            }
          },
          "description": "Pool target size and options.",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantPoolResponse"
                }
              }
            },
            "description": "Pool create accepted; provisioning is asynchronous."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Create a free-tenant pool for the organization"
      }
    },
    "/v1/admin/tenants": {
      "get": {
        "operationId": "get-v1-admin-tenants",
        "parameters": [
          {
            "in": "query",
            "name": "display_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "label",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantListResponse"
                }
              }
            },
            "description": "Paginated tenant list with quota snapshots."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "List tenants of the authenticated organization"
      },
      "post": {
        "operationId": "post-v1-admin-tenants",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminTenantCreateRequest"
              }
            }
          },
          "description": "Tenant creation options including optional quota fields.",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantCreateResponse"
                }
              }
            },
            "description": "Tenant accepted; provisioning is asynchronous."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Create a tenant (claims from the organization tenant pool, or provisions directly)"
      }
    },
    "/v1/admin/tenants/{tenant_id}": {
      "delete": {
        "operationId": "delete-v1-admin-tenants-by-tenant_id",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "private_key": {
                    "type": "string"
                  },
                  "public_key": {
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "description": "Optional public_key/private_key credentials for cluster-backed deprovisioning.",
          "required": false
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantDeleteResponse"
                }
              }
            },
            "description": "Tenant delete accepted; cleanup runs asynchronously."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Delete a tenant (async cleanup)"
      },
      "get": {
        "operationId": "get-v1-admin-tenants-by-tenant_id",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminTenantResponse"
                }
              }
            },
            "description": "Tenant details."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Get one tenant with quota config and usage"
      }
    },
    "/v1/admin/tenants/{tenant_id}/embedding-config": {
      "get": {
        "operationId": "get-v1-admin-tenants-by-tenant_id-embedding-config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.embeddingConfigResponse"
                }
              }
            },
            "description": "Effective embedding config (api_key masked)."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Get tenant embedding configuration"
      },
      "put": {
        "operationId": "put-v1-admin-tenants-by-tenant_id-embedding-config",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.embeddingConfigPutRequest"
              }
            }
          },
          "description": "Embedding provider configuration.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.embeddingConfigResponse"
                }
              }
            },
            "description": "Persisted embedding config."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Write tenant embedding configuration"
      }
    },
    "/v1/admin/tenants/{tenant_id}/extract-config/{media_type}": {
      "get": {
        "description": "media_type is one of image, audio or video.",
        "operationId": "get-v1-admin-tenants-by-tenant_id-extract-config-by-media_type",
        "parameters": [
          {
            "in": "path",
            "name": "media_type",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.extractConfigResponse"
                }
              }
            },
            "description": "Effective extract config (provider keys masked)."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Get tenant extract configuration"
      },
      "put": {
        "description": "media_type is one of image, audio or video.",
        "operationId": "put-v1-admin-tenants-by-tenant_id-extract-config-by-media_type",
        "parameters": [
          {
            "in": "path",
            "name": "media_type",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.extractConfigPutRequest"
              }
            }
          },
          "description": "Partial extract config update.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.extractConfigResponse"
                }
              }
            },
            "description": "Persisted extract config."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Write tenant extract configuration"
      }
    },
    "/v1/admin/tenants/{tenant_id}/object-namespace": {
      "delete": {
        "operationId": "delete-v1-admin-tenants-by-tenant_id-object-namespace",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "namespace_id": {
                      "type": "string"
                    },
                    "tenant_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "tenant_id",
                    "namespace_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "tenant_id and empty namespace_id."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Clear the tenant object namespace binding"
      },
      "get": {
        "operationId": "get-v1-admin-tenants-by-tenant_id-object-namespace",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "namespace_id": {
                      "type": "string"
                    },
                    "tenant_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "tenant_id",
                    "namespace_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "tenant_id and namespace_id."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Get the tenant object namespace binding"
      },
      "put": {
        "operationId": "put-v1-admin-tenants-by-tenant_id-object-namespace",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminObjectNamespaceRequest"
              }
            }
          },
          "description": "namespace_id to bind.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "namespace_id": {
                      "type": "string"
                    },
                    "tenant_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "tenant_id",
                    "namespace_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "tenant_id and namespace_id."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Set the tenant object namespace binding"
      }
    },
    "/v1/admin/tenants/{tenant_id}/quota": {
      "post": {
        "operationId": "post-v1-admin-tenants-by-tenant_id-quota",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.adminTenantQuotaRequest"
              }
            }
          },
          "description": "Quota fields to update.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.adminQuotaResponse"
                }
              }
            },
            "description": "Updated quota view."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Update tenant quota limits"
      }
    },
    "/v1/provision": {
      "post": {
        "operationId": "post-v1-provision",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.credentialProvisionRequest"
              }
            }
          },
          "description": "Public and private TiDB Cloud API keys, plus optional quota fields. The authenticated TiDB Cloud credentials may override the body keys (JWT / inner-auth mode).",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "api_key": {
                      "type": "string"
                    },
                    "cloud_provider": {
                      "type": "string"
                    },
                    "organization_id": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "tenant_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "tenant_id",
                    "api_key",
                    "status"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Tenant accepted; provisioning runs asynchronously. Body: tenant_id, api_key, status (and provider-specific fields)."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Provision a new tenant"
      }
    },
    "/v1/quota": {
      "get": {
        "description": "Tenant is selected by the tenant_id query parameter, falling back to the X-Drive9-Tenant-ID header. With a drive9 API key the tenant is implied by the key.",
        "operationId": "get-v1-quota",
        "parameters": [
          {
            "description": "Tenant id fallback when the tenant_id query parameter is absent.",
            "in": "header",
            "name": "X-Drive9-Tenant-ID",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.quotaResponse"
                }
              }
            },
            "description": "Quota configuration and current usage."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Query tenant quota configuration and usage"
      },
      "post": {
        "operationId": "post-v1-quota",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.quotaRequest"
              }
            }
          },
          "description": "Tenant id plus quota fields; public_key/private_key in the body fall back to the X-TiDBCloud-* headers.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.quotaResponse"
                }
              }
            },
            "description": "Updated quota configuration and usage."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Set or update tenant quota limits"
      }
    },
    "/v1/tokens": {
      "get": {
        "description": "With a drive9 key, lists the authenticated tenant's tokens (tenant_id must match when provided). With control-plane credentials, lists organization tokens; tenant_id selects one tenant, omit for org-wide listing.",
        "operationId": "get-v1-tokens",
        "parameters": [
          {
            "in": "query",
            "name": "include_expired",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.tokenListResponse"
                }
              }
            },
            "description": "Token list with pagination."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "List API keys / tokens"
      }
    },
    "/v1/tokens/generate": {
      "post": {
        "operationId": "post-v1-tokens-generate",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.generateTokenRequest"
              }
            }
          },
          "description": "Tenant, key name, TTL; public_key/private_key may be in the body or the X-TiDBCloud-* headers.",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.generateTokenResponse"
                }
              }
            },
            "description": "Generated owner token."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Generate a control-plane owner token for a tenant"
      }
    },
    "/v1/tokens/revoke": {
      "post": {
        "operationId": "post-v1-tokens-revoke",
        "parameters": [
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.controlPlaneRevokeByAPIKeyRequest"
              }
            }
          },
          "description": "api_key to revoke plus optional credentials.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.controlPlaneTokenMutationResponse"
                }
              }
            },
            "description": "Revoked token summary."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Revoke a token by its API key"
      }
    },
    "/v1/tokens/{token_id}": {
      "delete": {
        "operationId": "delete-v1-tokens-by-token_id",
        "parameters": [
          {
            "in": "path",
            "name": "token_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.tokenDeleteRequest"
              }
            }
          },
          "description": "Optional credentials.",
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.controlPlaneTokenMutationResponse"
                }
              }
            },
            "description": "Revoked token summary."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Revoke a token by id (control plane)"
      }
    },
    "/v1/tokens/{token_id}/activate": {
      "post": {
        "operationId": "post-v1-tokens-by-token_id-activate",
        "parameters": [
          {
            "in": "path",
            "name": "token_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.tokenStatusTransitionRequest"
              }
            }
          },
          "description": "Optional credentials.",
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.tokenStatusTransitionResponse"
                }
              }
            },
            "description": "New token status."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Activate a token (disabled → active)"
      }
    },
    "/v1/tokens/{token_id}/deactivate": {
      "post": {
        "operationId": "post-v1-tokens-by-token_id-deactivate",
        "parameters": [
          {
            "in": "path",
            "name": "token_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "TiDB Cloud organization id the caller acts on. Must be a numeric non-zero value.",
            "in": "query",
            "name": "orgId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/server.tokenStatusTransitionRequest"
              }
            }
          },
          "description": "Optional credentials.",
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/server.tokenStatusTransitionResponse"
                }
              }
            },
            "description": "New token status."
          },
          "4XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          },
          "5XX": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Error. Body: {\"error\": string}."
          }
        },
        "summary": "Deactivate a token (active → disabled)"
      }
    }
  },
  "security": [
    {
      "TiDBCloudJWT": []
    }
  ]
}
