CockroachDB Role Management API

Manage role-based access control, including assigning and removing roles for users across organization, folder, and cluster scopes.

Operations 6

GET /api/v1/roles List role grants #
GET /api/v1/roles/{user_id} Get all roles for a user #
PUT /api/v1/roles/{user_id} Set roles for a user #
POST /api/v1/roles/{user_id}/{resource_type}/{resource_id}/{role_name} Add user to role #
DELETE /api/v1/roles/{user_id}/{resource_type}/{resource_id}/{role_name} Remove user from role #
GET /api/v1/users/persons-by-email Get person users by email #

Work with this as data

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

MCP server

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

https://apis.io/mcp

Tools for apis

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

Call it yourself

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

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

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

OpenAPI Specification

cockroachdb-role-management-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: CockroachDB Cloud Role Management 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: Role Management
  description: Manage role-based access control, including assigning and removing roles for users across organization, folder, and cluster scopes.
paths:
  /api/v1/roles:
    get:
      operationId: ListRoleGrants
      summary: List role grants
      description: Returns a list of all role grants across the organization. Supports pagination.
      tags:
      - Role Management
      parameters:
      - $ref: '#/components/parameters/paginationPage'
      - $ref: '#/components/parameters/paginationLimit'
      - $ref: '#/components/parameters/paginationAsOfTime'
      - $ref: '#/components/parameters/paginationSortOrder'
      responses:
        '200':
          description: List of role grants returned successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListRoleGrantsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /api/v1/roles/{user_id}:
    get:
      operationId: GetAllRolesForUser
      summary: Get all roles for a user
      description: Returns all role grants assigned to the specified user across all resource scopes.
      tags:
      - Role Management
      parameters:
      - $ref: '#/components/parameters/userId'
      responses:
        '200':
          description: User roles retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAllRolesForUserResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      operationId: SetRolesForUser
      summary: Set roles for a user
      description: Replaces all role grants for the specified user with the provided set of roles. Requires ORG_ADMIN role.
      tags:
      - Role Management
      parameters:
      - $ref: '#/components/parameters/userId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetRolesForUserRequest'
      responses:
        '200':
          description: User roles updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAllRolesForUserResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /api/v1/roles/{user_id}/{resource_type}/{resource_id}/{role_name}:
    post:
      operationId: AddUserToRole
      summary: Add user to role
      description: Grants a specific role to a user for a particular resource. Requires ORG_ADMIN role.
      tags:
      - Role Management
      parameters:
      - $ref: '#/components/parameters/userId'
      - $ref: '#/components/parameters/resourceType'
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/roleName'
      responses:
        '200':
          description: User added to role successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAllRolesForUserResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      operationId: RemoveUserFromRole
      summary: Remove user from role
      description: Revokes a specific role from a user for a particular resource. Requires ORG_ADMIN role.
      tags:
      - Role Management
      parameters:
      - $ref: '#/components/parameters/userId'
      - $ref: '#/components/parameters/resourceType'
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/roleName'
      responses:
        '200':
          description: User removed from role successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAllRolesForUserResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/v1/users/persons-by-email:
    get:
      operationId: GetPersonUsersByEmail
      summary: Get person users by email
      description: Looks up person (human) user accounts by email address. Useful for resolving user IDs before assigning roles.
      tags:
      - Role Management
      parameters:
      - name: email
        in: query
        required: true
        description: Email address to look up.
        schema:
          type: string
          format: email
      responses:
        '200':
          description: User accounts returned successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPersonUsersByEmailResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  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
    GetPersonUsersByEmailResponse:
      type: object
      description: Person user accounts matching the queried email address.
      properties:
        users:
          type: array
          description: Array of user account objects.
          items:
            type: object
    GetAllRolesForUserResponse:
      type: object
      description: All role grants assigned to a specific user.
      properties:
        roles:
          type: array
          description: Array of role grant objects.
          items:
            type: object
    SetRolesForUserRequest:
      type: object
      description: Request body for setting all roles for a user.
      required:
      - roles
      properties:
        roles:
          type: array
          description: Complete set of role grants to assign to the user.
          items:
            type: object
    ListRoleGrantsResponse:
      type: object
      description: Paginated list of role grants in the organization.
      properties:
        grants:
          type: array
          description: Array of role grant objects.
          items:
            type: object
        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'
  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
    resourceType:
      name: resource_type
      in: path
      required: true
      description: Type of resource the role is scoped to. Accepted values include ORGANIZATION, FOLDER, CLUSTER.
      schema:
        type: string
        enum:
        - ORGANIZATION
        - FOLDER
        - CLUSTER
    paginationPage:
      name: pagination.page
      in: query
      description: Page number for paginated results, starting from 1.
      schema:
        type: string
    resourceId:
      name: id
      in: path
      required: true
      description: Unique identifier of the resource.
      schema:
        type: string
    roleName:
      name: role_name
      in: path
      required: true
      description: Name of the role to grant or revoke.
      schema:
        type: string
    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
    userId:
      name: user_id
      in: path
      required: true
      description: Unique identifier of the user.
      schema:
        type: string
  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