> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-revert-104359-revert-104251-parquet-single.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get list of keys

> Returns a list of keys in the organization, ordered by creation date, oldest first. Results are capped at `limit` (default and maximum 250) per page. Every response carries `limit`, `totalCount` and `nextCursor`; pass `nextCursor` as the `cursor` query parameter to fetch the next page, repeating until it is null.

Returns a list of keys in the organization, ordered by creation date, oldest first. Results are capped at `limit` (default and maximum 250) per page. Every response carries `limit`, `totalCount` and `nextCursor`; pass `nextCursor` as the `cursor` query parameter to fetch the next page, repeating until it is null.

<div data-permissions class="api-section">
  <div class="api-section-heading flex flex-col gap-y-4 w-full">
    <div class="flex items-baseline border-b pb-2.5 border-gray-100 dark:border-gray-800 w-full">
      <h4 class="api-section-heading-title flex-1 mb-0">Permission</h4>
    </div>
  </div>

  <div class="py-6">
    The API key must have the `control-plane:organization:view-api-keys` permission.
  </div>
</div>


## OpenAPI

````yaml /_specs/cloud-openapi.json get /v1/organizations/{organizationId}/keys
openapi: 3.1.1
info:
  title: OpenAPI spec for ClickHouse Cloud
  version: '1.0'
  contact:
    name: ClickHouse Support
    url: >-
      https://clickhouse.com/docs/en/cloud/manage/openapi?referrer=openapi-1145498
    email: support@clickhouse.com
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: User management
  - name: Billing
  - name: Role Management
  - name: Service
  - name: Backup
  - name: Snapshot
  - name: API keys
  - name: Prometheus
  - name: ClickPipes
  - name: ClickStack
  - name: Postgres
  - name: UDF
  - name: Query API endpoints
paths:
  /v1/organizations/{organizationId}/keys:
    get:
      tags:
        - API keys
      summary: Get list of keys
      description: >-
        Returns a list of keys in the organization, ordered by creation date,
        oldest first. Results are capped at `limit` (default and maximum 250)
        per page. Every response carries `limit`, `totalCount` and `nextCursor`;
        pass `nextCursor` as the `cursor` query parameter to fetch the next
        page, repeating until it is null.
      operationId: openapiKeyGetList
      parameters:
        - in: path
          name: organizationId
          description: ID of the requested organization.
          required: true
          schema:
            type: string
            format: uuid
        - in: query
          name: limit
          description: Maximum number of results to return.
          schema:
            type: integer
            minimum: 1
            maximum: 250
            default: 250
        - in: query
          name: cursor
          description: >-
            Opaque cursor from a previous response's `nextCursor`, marking where
            to resume the list.
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 200
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
                  result:
                    type: array
                    items:
                      $ref: '#/components/schemas/ApiKey'
                  limit:
                    type: integer
                    description: Maximum number of results returned in this page.
                  totalCount:
                    type: integer
                    description: Total number of results across all pages.
                  nextCursor:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Cursor for the next page, to be sent as the `cursor` query
                      parameter. Null on the last page.
        '400':
          description: >-
            The request cannot be processed due to a client error. Please verify
            your request parameters and try again.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 400
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
        '500':
          description: >-
            An internal server error has occurred. If this issue persists,
            please contact ClickHouse Cloud support for assistance.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP status code.
                    example: 500
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
components:
  schemas:
    ApiKey:
      properties:
        id:
          description: Unique API key ID.
          type: string
          format: uuid
        name:
          description: Name of the key
          type: string
        state:
          description: 'State of the key: ''enabled'', ''disabled''.'
          type: string
          enum:
            - enabled
            - disabled
        roles:
          type: array
          description: >-
            DEPRECATED. Use `assignedRoles` instead. List of roles assigned to
            the key. For organizations that have migrated to custom roles, this
            field is frozen at the pre-migration value and does not reflect
            current role assignments.
          items:
            type: string
            enum:
              - admin
              - developer
              - query_endpoints
          deprecated: true
        assignedRoles:
          type: array
          description: Custom roles and System roles assigned to this API key
          items:
            $ref: '#/components/schemas/AssignedRole'
        keySuffix:
          description: Last 4 letters of the key.
          type: string
        createdAt:
          description: Timestamp the key was created. ISO-8601.
          type: string
          format: date-time
        expireAt:
          description: >-
            Timestamp the key expires. If not present, `null` or is empty the
            key never expires. ISO-8601.
          type:
            - string
            - 'null'
          format: date-time
        usedAt:
          description: >-
            Timestamp the key was used last time, with one-minute precision. If
            not present the key was never used. ISO-8601.
          type: string
          format: date-time
        ipAccessList:
          type: array
          description: List of IP addresses allowed to access the API using this key
          items:
            $ref: '#/components/schemas/IpAccessListEntry'
    AssignedRole:
      properties:
        roleId:
          description: Unique identifier of the role
          type: string
          format: uuid
        roleName:
          description: Human-readable name of the role
          type: string
        roleType:
          description: 'Type of role: system (predefined) or custom (organization-defined)'
          type: string
          enum:
            - system
            - custom
    IpAccessListEntry:
      properties:
        source:
          description: IP or CIDR
          type: string
        description:
          description: >-
            Optional description of IPv4 address or IPv4 CIDR to allow access
            from
          type: string
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Use key ID and key secret obtained in ClickHouse Cloud console:
        https://clickhouse.com/docs/cloud/manage/openapi
      x-permission-scopes: >-
        The scope list of a `security` requirement holds ClickHouse Cloud API
        key permission ids (for example `control-plane:organization:view`), not
        OAuth scopes. OpenAPI has no field for API key permissions, so this is
        the closest available place. A key must hold every permission listed on
        an operation to call it; an operation with no scopes needs none beyond a
        valid key. Every operation declares at most one requirement object,
        always for this scheme, so the list is only ever conjunctive —
        alternative sets of permissions are never expressed.

````