{
  "opencollection": "1.0.0",
  "info": {
    "name": "CockroachDB Cloud APIKeys RoleManagement API",
    "version": "2024-09-16"
  },
  "request": {
    "auth": {
      "type": "bearer",
      "token": "{{bearerToken}}"
    }
  },
  "items": [
    {
      "info": {
        "name": "RoleManagement",
        "type": "folder"
      },
      "items": [
        {
          "info": {
            "name": "List role grants",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://cockroachlabs.cloud/api/v1/roles",
            "params": [
              {
                "name": "pagination.page",
                "value": "",
                "type": "query",
                "description": "Page number for paginated results, starting from 1."
              },
              {
                "name": "pagination.limit",
                "value": "",
                "type": "query",
                "description": "Maximum number of results to return per page."
              },
              {
                "name": "pagination.as_of_time",
                "value": "",
                "type": "query",
                "description": "RFC3339 timestamp to return results as they were at a specific point in time (time-travel query)."
              },
              {
                "name": "pagination.sort_order",
                "value": "",
                "type": "query",
                "description": "Sort direction for paginated results. Accepted values are ASC and DESC."
              }
            ]
          },
          "docs": "Returns a list of all role grants across the organization. Supports pagination."
        },
        {
          "info": {
            "name": "Get all roles for a user",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://cockroachlabs.cloud/api/v1/roles/:user_id",
            "params": [
              {
                "name": "user_id",
                "value": "",
                "type": "path",
                "description": "Unique identifier of the user."
              }
            ]
          },
          "docs": "Returns all role grants assigned to the specified user across all resource scopes."
        },
        {
          "info": {
            "name": "Set roles for a user",
            "type": "http"
          },
          "http": {
            "method": "PUT",
            "url": "https://cockroachlabs.cloud/api/v1/roles/:user_id",
            "params": [
              {
                "name": "user_id",
                "value": "",
                "type": "path",
                "description": "Unique identifier of the user."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Replaces all role grants for the specified user with the provided set of roles. Requires ORG_ADMIN role."
        },
        {
          "info": {
            "name": "Add user to role",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://cockroachlabs.cloud/api/v1/roles/:user_id/:resource_type/:resource_id/:role_name",
            "params": [
              {
                "name": "user_id",
                "value": "",
                "type": "path",
                "description": "Unique identifier of the user."
              },
              {
                "name": "resource_type",
                "value": "",
                "type": "path",
                "description": "Type of resource the role is scoped to. Accepted values include ORGANIZATION, FOLDER, CLUSTER."
              },
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "Unique identifier of the resource."
              },
              {
                "name": "role_name",
                "value": "",
                "type": "path",
                "description": "Name of the role to grant or revoke."
              }
            ]
          },
          "docs": "Grants a specific role to a user for a particular resource. Requires ORG_ADMIN role."
        },
        {
          "info": {
            "name": "Remove user from role",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://cockroachlabs.cloud/api/v1/roles/:user_id/:resource_type/:resource_id/:role_name",
            "params": [
              {
                "name": "user_id",
                "value": "",
                "type": "path",
                "description": "Unique identifier of the user."
              },
              {
                "name": "resource_type",
                "value": "",
                "type": "path",
                "description": "Type of resource the role is scoped to. Accepted values include ORGANIZATION, FOLDER, CLUSTER."
              },
              {
                "name": "id",
                "value": "",
                "type": "path",
                "description": "Unique identifier of the resource."
              },
              {
                "name": "role_name",
                "value": "",
                "type": "path",
                "description": "Name of the role to grant or revoke."
              }
            ]
          },
          "docs": "Revokes a specific role from a user for a particular resource. Requires ORG_ADMIN role."
        },
        {
          "info": {
            "name": "Get person users by email",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://cockroachlabs.cloud/api/v1/users/persons-by-email",
            "params": [
              {
                "name": "email",
                "value": "",
                "type": "query",
                "description": "Email address to look up."
              }
            ]
          },
          "docs": "Looks up person (human) user accounts by email address. Useful for resolving user IDs before assigning roles."
        }
      ]
    }
  ],
  "bundled": true
}