openapi: 3.2.0 info: title: CockroachDB Cloud Service Accounts 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. 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: Service Accounts description: Manage service accounts used for machine-to-machine authentication within the organization. paths: /api/v1/service-accounts: get: operationId: ListServiceAccounts summary: List service accounts description: Returns a list of service accounts in the organization. Supports pagination. tags: - Service Accounts parameters: - $ref: '#/components/parameters/paginationPage' - $ref: '#/components/parameters/paginationLimit' - $ref: '#/components/parameters/paginationAsOfTime' - $ref: '#/components/parameters/paginationSortOrder' responses: '200': description: List of service accounts returned successfully. content: application/json: schema: $ref: '#/components/schemas/ListServiceAccountsResponse' '401': $ref: '#/components/responses/Unauthorized' post: operationId: CreateServiceAccount summary: Create a service account description: Creates a new service account for machine-to-machine authentication. Requires ORG_ADMIN role. tags: - Service Accounts requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateServiceAccountRequest' responses: '200': description: Service account created successfully. content: application/json: schema: $ref: '#/components/schemas/ServiceAccount' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /api/v1/service-accounts/{id}: get: operationId: GetServiceAccount summary: Get a service account description: Retrieves details of a specific service account by ID. tags: - Service Accounts parameters: - $ref: '#/components/parameters/resourceId' responses: '200': description: Service account retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/ServiceAccount' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' patch: operationId: UpdateServiceAccount summary: Update a service account description: Updates the name or description of an existing service account. Requires ORG_ADMIN role. tags: - Service Accounts parameters: - $ref: '#/components/parameters/resourceId' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateServiceAccountSpecification' responses: '200': description: Service account updated successfully. content: application/json: schema: $ref: '#/components/schemas/ServiceAccount' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' delete: operationId: DeleteServiceAccount summary: Delete a service account description: Permanently deletes a service account by ID. All associated API keys are also revoked. Requires ORG_ADMIN role. tags: - Service Accounts parameters: - $ref: '#/components/parameters/resourceId' responses: '200': description: Service account deleted successfully. content: application/json: schema: $ref: '#/components/schemas/ServiceAccount' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' components: parameters: paginationLimit: name: pagination.limit in: query description: Maximum number of results to return per page. schema: type: integer format: int32 minimum: 1 maximum: 500 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 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 resourceId: name: id in: path required: true description: Unique identifier of the resource. schema: type: string paginationPage: name: pagination.page in: query description: Page number for paginated results, starting from 1. schema: type: string schemas: 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 CreateServiceAccountRequest: type: object description: Request body for creating a new service account. required: - name properties: name: type: string description: Name for the new service account. description: type: string description: Optional description of the service account. UpdateServiceAccountSpecification: type: object description: Specification for updating a service account. properties: name: type: string description: New name for the service account. description: type: string description: New description for the service account. ServiceAccount: type: object description: A service account used for machine-to-machine authentication within a CockroachDB Cloud organization. properties: id: type: string description: Unique identifier of the service account. name: type: string description: Name of the service account. description: type: string description: Description of the service account's purpose. creator_id: type: string description: User ID of the account creator. created_at: type: string format: date-time description: Timestamp when the service account was created. ListServiceAccountsResponse: type: object description: Paginated list of service accounts. properties: service_accounts: type: array description: Array of service account objects. items: $ref: '#/components/schemas/ServiceAccount' pagination: $ref: '#/components/schemas/PaginationResponse' 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. responses: BadRequest: description: The request body or parameters are invalid. content: application/json: schema: $ref: '#/components/schemas/Error' 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' 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