Couchbase API Keys API

Endpoints for managing API keys used to authenticate with the Management API.

Documentation

Specifications

Other Resources

OpenAPI Specification

couchbase-api-keys-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Couchbase Analytics Service REST Allowed CIDRs API Keys API
  description: The Couchbase Analytics Service REST API provides access to the Analytics service for running complex analytical queries on operational data without impacting performance of key-value operations. It supports SQL++ queries for analytics, management of links to external data sources, and configuration of user-defined libraries. The service enables real-time analytics on JSON data alongside transactional workloads.
  version: '7.6'
  contact:
    name: Couchbase Support
    url: https://support.couchbase.com
  termsOfService: https://www.couchbase.com/terms-of-use
servers:
- url: https://localhost:8095
  description: Analytics Service (default port)
- url: https://localhost:18095
  description: Analytics Service (SSL)
security:
- basicAuth: []
tags:
- name: API Keys
  description: Endpoints for managing API keys used to authenticate with the Management API.
paths:
  /v4/organizations/{organizationId}/apikeys:
    get:
      operationId: listApiKeys
      summary: List API keys
      description: Returns the list of API keys configured for the organization.
      tags:
      - API Keys
      parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/perPage'
      responses:
        '200':
          description: Successful retrieval of API keys
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse'
        '401':
          description: Unauthorized access
        '429':
          description: Rate limit exceeded
    post:
      operationId: createApiKey
      summary: Create an API key
      description: Creates a new API key for authenticating with the Management API.
      tags:
      - API Keys
      parameters:
      - $ref: '#/components/parameters/organizationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreateRequest'
      responses:
        '201':
          description: API key created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreateResponse'
        '400':
          description: Invalid API key configuration
        '401':
          description: Unauthorized access
        '429':
          description: Rate limit exceeded
components:
  parameters:
    page:
      name: page
      in: query
      required: false
      description: Page number for pagination
      schema:
        type: integer
        minimum: 1
        default: 1
    perPage:
      name: perPage
      in: query
      required: false
      description: Number of items per page
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 25
    organizationId:
      name: organizationId
      in: path
      required: true
      description: The UUID of the organization
      schema:
        type: string
        format: uuid
  schemas:
    ApiKeyCreateRequest:
      type: object
      description: Request to create an API key
      required:
      - name
      - organizationRoles
      properties:
        name:
          type: string
          description: Name for the API key
        description:
          type: string
          description: Description of the API key
        expiry:
          type: number
          description: Expiry time in days (0 for no expiry)
        organizationRoles:
          type: array
          description: Organization-level roles
          items:
            type: string
            enum:
            - organizationOwner
            - organizationMember
            - projectCreator
        resources:
          type: array
          description: Project-specific role assignments
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
                description: Project UUID
              roles:
                type: array
                items:
                  type: string
                  enum:
                  - projectOwner
                  - projectManager
                  - projectViewer
                  - projectDataReaderWriter
                  - projectDataReader
        allowedCIDRs:
          type: array
          description: CIDRs allowed to use this API key
          items:
            type: string
    PaginatedResponse:
      type: object
      description: Paginated response wrapper
      properties:
        cursor:
          type: object
          description: Pagination cursor information
          properties:
            pages:
              type: object
              properties:
                page:
                  type: integer
                  description: Current page number
                next:
                  type: integer
                  description: Next page number
                previous:
                  type: integer
                  description: Previous page number
                last:
                  type: integer
                  description: Last page number
                perPage:
                  type: integer
                  description: Items per page
                totalItems:
                  type: integer
                  description: Total number of items
        data:
          type: array
          description: List of items
          items: {}
    ApiKeyCreateResponse:
      type: object
      description: Response after creating an API key
      properties:
        id:
          type: string
          format: uuid
          description: API key UUID
        token:
          type: string
          description: The API key secret token (only returned once at creation time)
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic Authentication using Couchbase Server credentials.
externalDocs:
  description: Couchbase Analytics Service REST API Documentation
  url: https://docs.couchbase.com/server/current/analytics/rest-analytics.html