Cockroach Labs Databases API
Manage databases within a CockroachDB cluster, including creation, listing, updating, and deletion.
Manage databases within a CockroachDB cluster, including creation, listing, updating, and deletion.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/cockroach-labs-databases-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: CockroachDB Cloud Databases API
description: The CockroachDB Cloud API is a REST interface that provides programmatic access to manage the lifecycle of clusters within a CockroachDB Cloud organization. It enables developers and operators to create, configure, scale, and delete CockroachDB Serverless and Dedicated clusters without using the web console. The API supports cluster provisioning, node management, network authorization, customer-managed encryption keys, backup and restore, log and metric export, role management, and folder organization. Authentication is handled via bearer tokens, and the API is rate-limited to 10 requests per second per user.
version: '2024-09-16'
contact:
name: Cockroach Labs Support
url: https://support.cockroachlabs.com
termsOfService: https://www.cockroachlabs.com/cloud-terms-and-conditions/
servers:
- url: https://cockroachlabs.cloud
description: CockroachDB Cloud Production Server
security:
- bearerAuth: []
tags:
- name: Databases
description: Manage databases within a CockroachDB cluster, including creation, listing, updating, and deletion.
paths:
/api/v1/clusters/{cluster_id}/databases:
get:
operationId: ListDatabases
summary: List databases
description: Returns a list of databases for the specified cluster. Supports pagination via page, limit, asOfTime, and sortOrder parameters.
tags:
- Databases
parameters:
- $ref: '#/components/parameters/clusterId'
- $ref: '#/components/parameters/paginationPage'
- $ref: '#/components/parameters/paginationLimit'
- $ref: '#/components/parameters/paginationAsOfTime'
- $ref: '#/components/parameters/paginationSortOrder'
responses:
'200':
description: List of databases returned successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/ListDatabasesResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
post:
operationId: CreateDatabase
summary: Create a database
description: Creates a new database within the specified cluster. Requires CLUSTER_ADMIN role at organization, folder, or cluster scope.
tags:
- Databases
parameters:
- $ref: '#/components/parameters/clusterId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateDatabaseRequest'
responses:
'200':
description: Database created successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Database'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/api/v1/clusters/{cluster_id}/databases/{name}:
patch:
operationId: EditDatabase
summary: Update a database
description: Updates the configuration of an existing database within the specified cluster. Requires CLUSTER_ADMIN role.
tags:
- Databases
parameters:
- $ref: '#/components/parameters/clusterId'
- $ref: '#/components/parameters/databaseName'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateDatabaseRequest'
responses:
'200':
description: Database updated successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Database'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: DeleteDatabase
summary: Delete a database
description: Deletes a database from the specified cluster by name. Requires CLUSTER_ADMIN role at organization, folder, or cluster scope.
tags:
- Databases
parameters:
- $ref: '#/components/parameters/clusterId'
- $ref: '#/components/parameters/databaseName'
responses:
'200':
description: Database deleted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Database'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
components:
schemas:
Database:
type: object
description: Represents a database within a CockroachDB cluster.
properties:
name:
type: string
description: Name of the database.
table_count:
type: integer
description: Number of tables in the database.
Error:
type: object
description: Standard error response returned by the API.
properties:
code:
type: integer
description: HTTP status code of the error.
message:
type: string
description: Human-readable description of the error.
details:
type: array
description: Additional detail objects providing error context.
items:
type: object
ListDatabasesResponse:
type: object
description: Paginated list of databases in a cluster.
properties:
databases:
type: array
description: Array of database objects.
items:
$ref: '#/components/schemas/Database'
pagination:
$ref: '#/components/schemas/PaginationResponse'
CreateDatabaseRequest:
type: object
description: Request body for creating a new database.
required:
- name
properties:
name:
type: string
description: Name for the new database.
PaginationResponse:
type: object
description: Pagination metadata included in list responses.
properties:
next:
type: string
description: Token or cursor for retrieving the next page of results.
last:
type: string
description: Token or cursor for the last page of results.
time:
type: string
format: date-time
description: Server time at which the paginated query was executed.
UpdateDatabaseRequest:
type: object
description: Request body for updating an existing database.
properties:
new_name:
type: string
description: New name for the database.
parameters:
paginationPage:
name: pagination.page
in: query
description: Page number for paginated results, starting from 1.
schema:
type: string
clusterId:
name: cluster_id
in: path
required: true
description: Unique identifier of the CockroachDB Cloud cluster.
schema:
type: string
paginationLimit:
name: pagination.limit
in: query
description: Maximum number of results to return per page.
schema:
type: integer
format: int32
minimum: 1
maximum: 500
paginationSortOrder:
name: pagination.sort_order
in: query
description: Sort direction for paginated results. Accepted values are ASC and DESC.
schema:
type: string
enum:
- ASC
- DESC
paginationAsOfTime:
name: pagination.as_of_time
in: query
description: RFC3339 timestamp to return results as they were at a specific point in time (time-travel query).
schema:
type: string
format: date-time
databaseName:
name: name
in: path
required: true
description: Name of the database.
schema:
type: string
responses:
NotFound:
description: The requested resource was not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Authentication credentials are missing or invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: The request body or parameters are invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: Bearer token authentication. Generate a token in the CockroachDB Cloud Console under Organization Settings > API Access.
externalDocs:
description: CockroachDB Cloud API Documentation
url: https://www.cockroachlabs.com/docs/cockroachcloud/cloud-api