Download OpenAPI specification:Download
TiDB Cloud API is in beta.
This API manages TiDB Cloud Premium instances. For more information about TiDB Cloud API, see TiDB Cloud API Overview.
The TiDB Cloud Premium API (v1beta2) provides REST endpoints to manage TiDB Cloud Premium instances and related resources.
You can use this API to manage the following resources:
This guide helps you make your first API call to the TiDB Cloud Premium API. You will learn how to authenticate a request, build a request, and interpret the response.
Create a TiDB Cloud account if you do not already have one.
In the TiDB Cloud console, go to Organization > API Keys and create an API key. For more information, see API key management.
Make your first API call.
To get all TiDB Cloud Premium instances in your organization, run the following command in your terminal. Replace YOUR_PUBLIC_KEY and YOUR_PRIVATE_KEY with your own key values.
curl --digest \
--user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \
--request GET \
--url 'https://cloud.tidbapi.com/v1beta2/tidbs' \
--header 'Accept: application/json'
The API returns a JSON list of your TiDB Cloud Premium instances. If none exist, the response contains an empty list.
The TiDB Cloud API uses HTTP Digest Authentication. It protects your private key from being sent over the network. For more details about HTTP Digest Authentication, refer to the IETF RFC.
Organization Owner role. You can check permissions of owner.401 error.Only the owner of an organization can create an API key.
To create an API key in an organization, perform the following steps:
Organization Owner currently.To view details of an API key, perform the following steps:
Only the owner of an organization can modify an API key.
To edit an API key in an organization, perform the following steps:
Only the owner of an organization can delete an API key.
To delete an API key in an organization, perform the following steps:
Manage the lifecycle and configuration of TiDB Cloud Premium instances, including passwords, CA certificates, and cloud provider information.
Lists all TiDB Cloud Premium instances in your organization. You can filter results by service plan, region, name, or ID.
| servicePlan | string Enum: "Starter" "Essential" "Premium" "BYOC" "Dedicated" The plan of the service. If specified, only TiDB Cloud Premium instances of the specified plan are returned.
|
| regionIds | Array of strings A list of region IDs. If specified, only TiDB Cloud Premium instances in these regions are returned. |
| name | string The display name to filter by. If specified, only TiDB Cloud Premium instances whose display name contains this value are returned. |
| tidbIds | Array of strings A list of TiDB Cloud Premium instance IDs. If specified, only the ones matching these IDs are returned. |
| pageSize | integer <int32> Default: "10" The maximum number of TiDB Cloud Premium instances to return. If not specified, at most 10 will be returned. The maximum value is |
| pageToken | string The pagination token received from a previous List TiDB Cloud Premium instances request. Use this token to retrieve the next page of results. Note: When paginating, all other parameters must match the original request. |
| skip | integer <int32> The number of TiDB Cloud Premium instances to skip before returning results. If the value exceeds the total number of TiDB Cloud Premium instances, the response is |
curl --location 'https://cloud.tidbapi.com/v1beta2/tidbs' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "tidbs": [
- {
- "name": "string",
- "tidbId": "string",
- "displayName": "foo-bar",
- "regionId": "string",
- "cloudProvider": "aws",
- "regionDisplayName": "string",
- "state": "CREATING",
- "rootPassword": "my-shining-password",
- "minRcu": "string",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "highAvailabilityType": "REGIONAL",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "creator": "string",
- "createTime": "2019-08-24T14:15:22Z",
- "updateTime": "2019-08-24T14:15:22Z",
- "endpoints": [
- {
- "host": "string",
- "port": 0,
- "connectionType": "PUBLIC",
- "connectionReachability": {
- "reachable": true,
- "detail": {
- "serviceActive": true,
- "endpointActive": true,
- "dnsReachable": true,
- "message": "string"
}
}
}
], - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "name": "string",
- "customerManagedEncryptionKeyId": "string",
- "regionId": "string",
- "cloudProvider": "aws",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": {
- "accountId": "string"
}, - "aliyunPrincipal": {
- "ramRoleArn": "string"
}, - "createTime": "2019-08-24T14:15:22Z"
}
}, - "tidbVersion": "string"
}
], - "totalSize": 0,
- "nextPageToken": "string"
}Creates a new TiDB Cloud Premium instance. If the tidb.cloud/project label is provided, the instance will be created in the specified project.
| validateOnly | boolean If set to |
The TiDB Cloud Premium instance to create.
| displayName required | string [ 4 .. 64 ] characters ^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$ The user-defined name of the TiDB Cloud Premium instance. |
| regionId required | string The unique identifier of the region where the TiDB Cloud Premium instance is deployed, in the format of |
| rootPassword | string [ 8 .. 64 ] characters ^.{8,64}$ The root password of the TiDB Cloud Premium instance. It must be between 8 and 64 characters long and can contain letters, numbers, and special characters. |
| maxRcu required | string <int64> The maximum number of Request Capacity Units (RCUs) for the TiDB Cloud Premium instance. |
| servicePlan required | string Enum: "Starter" "Essential" "Premium" "BYOC" "Dedicated" The plan of the service.
|
object The annotations for the TiDB Cloud Premium instance. The following lists some predefined annotations:
| |
object The labels for the TiDB Cloud Premium instance.
| |
object The dual-layer data encryption configuration for the TiDB Cloud Premium instance. |
{- "displayName": "foo-bar",
- "regionId": "string",
- "rootPassword": "my-shining-password",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "regionId": "string",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": { },
- "aliyunPrincipal": { }
}
}
}{- "name": "string",
- "tidbId": "string",
- "displayName": "foo-bar",
- "regionId": "string",
- "cloudProvider": "aws",
- "regionDisplayName": "string",
- "state": "CREATING",
- "rootPassword": "my-shining-password",
- "minRcu": "string",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "highAvailabilityType": "REGIONAL",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "creator": "string",
- "createTime": "2019-08-24T14:15:22Z",
- "updateTime": "2019-08-24T14:15:22Z",
- "endpoints": [
- {
- "host": "string",
- "port": 0,
- "connectionType": "PUBLIC",
- "connectionReachability": {
- "reachable": true,
- "detail": {
- "serviceActive": true,
- "endpointActive": true,
- "dnsReachable": true,
- "message": "string"
}
}
}
], - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "name": "string",
- "customerManagedEncryptionKeyId": "string",
- "regionId": "string",
- "cloudProvider": "aws",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": {
- "accountId": "string"
}, - "aliyunPrincipal": {
- "ramRoleArn": "string"
}, - "createTime": "2019-08-24T14:15:22Z"
}
}, - "tidbVersion": "string"
}Retrieves details of a specific TiDB Cloud Premium instance.
| tidbId required | string The ID of the TiDB Cloud Premium instance to retrieve. |
curl --location 'https://cloud.tidbapi.com/v1beta2/tidbs/{tidb_id}' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "name": "string",
- "tidbId": "string",
- "displayName": "foo-bar",
- "regionId": "string",
- "cloudProvider": "aws",
- "regionDisplayName": "string",
- "state": "CREATING",
- "rootPassword": "my-shining-password",
- "minRcu": "string",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "highAvailabilityType": "REGIONAL",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "creator": "string",
- "createTime": "2019-08-24T14:15:22Z",
- "updateTime": "2019-08-24T14:15:22Z",
- "endpoints": [
- {
- "host": "string",
- "port": 0,
- "connectionType": "PUBLIC",
- "connectionReachability": {
- "reachable": true,
- "detail": {
- "serviceActive": true,
- "endpointActive": true,
- "dnsReachable": true,
- "message": "string"
}
}
}
], - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "name": "string",
- "customerManagedEncryptionKeyId": "string",
- "regionId": "string",
- "cloudProvider": "aws",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": {
- "accountId": "string"
}, - "aliyunPrincipal": {
- "ramRoleArn": "string"
}, - "createTime": "2019-08-24T14:15:22Z"
}
}, - "tidbVersion": "string"
}Deletes a TiDB Cloud Premium instance by tidbId.
| tidbId required | string The ID of the TiDB Cloud Premium instance to delete. |
| validateOnly | boolean If set to |
curl --location --request DELETE 'https://cloud.tidbapi.com/v1beta2/tidbs/{tidb_id}' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "name": "string",
- "tidbId": "string",
- "displayName": "foo-bar",
- "regionId": "string",
- "cloudProvider": "aws",
- "regionDisplayName": "string",
- "state": "CREATING",
- "rootPassword": "my-shining-password",
- "minRcu": "string",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "highAvailabilityType": "REGIONAL",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "creator": "string",
- "createTime": "2019-08-24T14:15:22Z",
- "updateTime": "2019-08-24T14:15:22Z",
- "endpoints": [
- {
- "host": "string",
- "port": 0,
- "connectionType": "PUBLIC",
- "connectionReachability": {
- "reachable": true,
- "detail": {
- "serviceActive": true,
- "endpointActive": true,
- "dnsReachable": true,
- "message": "string"
}
}
}
], - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "name": "string",
- "customerManagedEncryptionKeyId": "string",
- "regionId": "string",
- "cloudProvider": "aws",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": {
- "accountId": "string"
}, - "aliyunPrincipal": {
- "ramRoleArn": "string"
}, - "createTime": "2019-08-24T14:15:22Z"
}
}, - "tidbVersion": "string"
}Updates the configuration of a specific TiDB Cloud Premium instance. You can modify the following fields: displayName and maxRcu.
| tidb.tidbId required | string The ID of the TiDB Cloud Premium instance to update. |
| validateOnly | boolean If set to |
The TiDB Cloud Premium instance to update.
| displayName | string [ 4 .. 64 ] characters ^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$ The user-defined name of the cluster. |
| maxRcu | string <int64> The maximum number of Request Capacity Units (RCUs) for the TiDB Cloud Premium instance. |
{- "displayName": "foo-bar",
- "maxRcu": "string"
}{- "name": "string",
- "tidbId": "string",
- "displayName": "foo-bar",
- "regionId": "string",
- "cloudProvider": "aws",
- "regionDisplayName": "string",
- "state": "CREATING",
- "rootPassword": "my-shining-password",
- "minRcu": "string",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "highAvailabilityType": "REGIONAL",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "creator": "string",
- "createTime": "2019-08-24T14:15:22Z",
- "updateTime": "2019-08-24T14:15:22Z",
- "endpoints": [
- {
- "host": "string",
- "port": 0,
- "connectionType": "PUBLIC",
- "connectionReachability": {
- "reachable": true,
- "detail": {
- "serviceActive": true,
- "endpointActive": true,
- "dnsReachable": true,
- "message": "string"
}
}
}
], - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "name": "string",
- "customerManagedEncryptionKeyId": "string",
- "regionId": "string",
- "cloudProvider": "aws",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": {
- "accountId": "string"
}, - "aliyunPrincipal": {
- "ramRoleArn": "string"
}, - "createTime": "2019-08-24T14:15:22Z"
}
}, - "tidbVersion": "string"
}Sets a new password for the TiDB Cloud Premium instance's root user. The new password is not returned in the response for security reasons, so save your password in a secure location.
| tidbId required | string The ID of the TiDB Cloud Premium instance for which to reset the root password. |
| rootPassword required | string [ 8 .. 64 ] characters ^.{8,64}$ The new root password. It must be between 8 and 64 characters long. |
{- "rootPassword": "my-shining-password"
}{ }Retrieves the TiDB Cloud account ID and external ID for the underlying cloud infrastructure of a specific TiDB Cloud Premium instance.
| tidbId required | string The ID of the TiDB Cloud Premium instance for which to retrieve cloud provider information. |
curl --location 'https://cloud.tidbapi.com/v1beta2/tidbs/{tidb_id}/cloudProviderInfo' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "tidbId": "string",
- "cloudProvider": "aws",
- "tidbCloudAccountId": "string",
- "tidbCloudAccountExternalId": "string"
}Retrieves the download URL for the CA certificate required to establish TLS (Transport Layer Security) connections to a specific TiDB Cloud Premium instance.
| tidbId required | string The ID of the TiDB Cloud Premium instance for which to retrieve the CA certificate. |
curl --location 'https://cloud.tidbapi.com/v1beta2/tidbs/{tidb_id}/caCertificateUrl' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "uri": "string"
}Lists all backups for a specific TiDB Cloud Premium instance. You can filter results by state, region, trigger type, or time range.
| tidbId required | string The ID of the TiDB Cloud Premium instance for which to list backups. |
| states | Array of strings Items Enum: "UNKNOWN" "PENDING" "RUNNING" "SUCCEEDED" "FAILED" "CANCELLED" A list of backup states. If specified, only backups matching these states are returned.
|
| regionIds | Array of strings A list of region IDs. If specified, only backups in these regions are returned. |
| triggerTypes | Array of strings Items Enum: "AUTO" "MANUAL" A list of backup trigger types. If specified, only backups matching these trigger types are returned.
|
| startTime | string <date-time> The inclusive start of the backup time range, in the ISO 8601 format. If specified, only backups at or after this time are returned. |
| endTime | string <date-time> The inclusive end of the backup time range, in the ISO 8601 format. If specified, only backups at or before this time are returned. |
| pageSize | integer <int32> Default: "10" The maximum number of backups to return. If not specified, at most 10 backups will be returned. The maximum value is |
| pageToken | string The pagination token received from a previous List backups for a TiDB Cloud Premium instance request. Use this token to retrieve the next page of results. Note: When paginating, all other parameters must match the original request. |
| skip | integer <int32> The number of backups to skip before returning results. If the value exceeds the total number of backups, the response is |
curl --location 'https://cloud.tidbapi.com/v1beta2/tidbs/{tidb_id}/backups' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "backups": [
- {
- "id": "string",
- "tidbId": "string",
- "organizationId": "string",
- "servicePlan": "Premium",
- "displayName": "string",
- "description": "string",
- "createTime": "2019-08-24T14:15:22Z",
- "sizeBytes": "string",
- "state": "UNKNOWN",
- "type": "SNAPSHOT",
- "triggerType": "AUTO",
- "expirationTime": "2019-08-24T14:15:22Z",
- "backupTs": "string",
- "regionId": "string",
- "customerManaged": true,
- "encryptionKeyId": "string"
}
], - "totalSize": 0,
- "nextPageToken": "string"
}Deletes a backup by backupId.
| tidbId required | string The ID of the TiDB Cloud Premium instance. |
| backupId required | string The ID of the backup to delete. |
curl --location --request DELETE 'https://cloud.tidbapi.com/v1beta2/tidbs/{tidb_id}/backups/{backup_id}' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{ }Restores a new TiDB Cloud Premium instance from a backup. Supported restore modes: SNAPSHOT, PITR, DEDICATED_SNAPSHOT, and CLASSIC_SNAPSHOT.
required | object The configuration of the TiDB Cloud Premium instance to create. Note: Currently, only TiDB Cloud Premium instances with |
| sourceTidbId | string The ID of the source TiDB Cloud Premium instance containing the backup data. |
| restoreMode required | string (v1beta2RestoreMode) Enum: "SNAPSHOT" "PITR" "DEDICATED_SNAPSHOT" "CLASSIC_SNAPSHOT" The mode used to restore a TiDB Cloud Premium instance.
|
| backupId | string The ID of the backup to restore from. This field is required when |
| pointInTime | string <date-time> The point in time to restore data to, in the ISO 8601 format. This field is required when |
object The classic backup storage configuration. This field is required when | |
| validateOnly | boolean If set to |
{- "tidb": {
- "displayName": "foo-bar",
- "regionId": "string",
- "rootPassword": "my-shining-password",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "regionId": "string",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": { },
- "aliyunPrincipal": { }
}
}
}, - "sourceTidbId": "string",
- "restoreMode": "SNAPSHOT",
- "backupId": "string",
- "pointInTime": "2019-08-24T14:15:22Z",
- "classicBackupStorage": {
- "cloudProvider": "aws",
- "regionId": "string",
- "bucketUri": "s3://my-backup-bucket/tidb-backups/",
- "auth": {
- "accessKeyId": "string",
- "accessKeySecret": "string"
}
}, - "validateOnly": true
}{- "tidb": {
- "name": "string",
- "tidbId": "string",
- "displayName": "foo-bar",
- "regionId": "string",
- "cloudProvider": "aws",
- "regionDisplayName": "string",
- "state": "CREATING",
- "rootPassword": "my-shining-password",
- "minRcu": "string",
- "maxRcu": "string",
- "servicePlan": "Starter",
- "highAvailabilityType": "REGIONAL",
- "annotations": {
- "property1": "string",
- "property2": "string"
}, - "labels": {
- "property1": "string",
- "property2": "string"
}, - "creator": "string",
- "createTime": "2019-08-24T14:15:22Z",
- "updateTime": "2019-08-24T14:15:22Z",
- "endpoints": [
- {
- "host": "string",
- "port": 0,
- "connectionType": "PUBLIC",
- "connectionReachability": {
- "reachable": true,
- "detail": {
- "serviceActive": true,
- "endpointActive": true,
- "dnsReachable": true,
- "message": "string"
}
}
}
], - "dualLayerDataEncryption": {
- "noEncryption": { },
- "defaultKey": { },
- "cmek": {
- "name": "string",
- "customerManagedEncryptionKeyId": "string",
- "regionId": "string",
- "cloudProvider": "aws",
- "servicePlan": "Starter",
- "awsKms": {
- "kmsKeyArn": "string"
}, - "aliyunKms": {
- "kmsKeyId": "string",
- "kmsInstanceId": "string"
}, - "awsPrincipal": {
- "accountId": "string"
}, - "aliyunPrincipal": {
- "ramRoleArn": "string"
}, - "createTime": "2019-08-24T14:15:22Z"
}
}, - "tidbVersion": "string"
}
}Retrieves the restore progress of a TiDB Cloud Premium instance, including the completion percentage and any error messages.
| tidbId required | string The ID of the TiDB Cloud Premium instance. |
curl --location 'https://cloud.tidbapi.com/v1beta2/tidbs/{tidb_id}:getRestoreStatus' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "state": "UNKNOWN",
- "message": "string",
- "progress": 0
}Lists the regions where you can create a TiDB Cloud Premium instance. You can filter results by cloud provider or service plan.
| cloudProvider | string The cloud provider. If specified, only regions belonging to the specified cloud provider are returned. |
| servicePlan | string Enum: "Starter" "Essential" "Premium" "BYOC" "Dedicated" The plan of the service. If specified, only regions that support the specified service plan are returned. |
| pageSize | integer <int32> Default: "10" The maximum number of regions to return. If not specified, at most 10 regions will be returned. The maximum value is |
| pageToken | string The pagination token received from a previous List regions request. Use this token to retrieve the next page of results. Note: When paginating, all other parameters must match the original request. |
| skip | integer <int32> The number of regions to skip before returning results. If the value exceeds the total number of regions, the response is |
curl --location 'https://cloud.tidbapi.com/v1beta2/regions' \ --digest --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \ --header 'Accept: application/json'
{- "regions": [
- {
- "name": "regions/aws-us-west-2",
- "regionId": "aws-us-west-2",
- "cloudProvider": "aws",
- "displayName": "Oregon (us-west-2)",
- "provider": "aws",
- "servicePlans": [
- "Starter",
- "Essential",
- "Premium"
]
}
], - "totalSize": 0,
- "nextPageToken": "string"
}