> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update API Key Access

> Change which features an API key can use (OpenLIT Enterprise).



## OpenAPI

````yaml PATCH /api/api-key/{id}
openapi: 3.0.0
info:
  title: API Keys API
  description: >-
    Create, list, update the feature access of, and delete OpenLIT API keys.
    These endpoints require a signed-in OpenLIT session; Bearer API keys are
    rejected with `403`, so a key can't list, create, change, or delete keys.
  version: 1.0.0
servers:
  - url: http://localhost:3000
security: []
paths:
  /api/api-key/{id}:
    patch:
      summary: Update API Key Access
      description: >-
        Changes which features an existing key can use. Send `scopes: null` for
        full access or a list of features to restrict the key. Changes apply to
        API requests immediately. Requires OpenLIT Enterprise with role-based
        access control and a signed-in session; an API key cannot change its own
        access. The community edition responds with `403`.
      operationId: updateApiKeyAccess
      parameters:
        - $ref: '#/components/parameters/ApiKeyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - scopes
              properties:
                scopes:
                  description: '`null` for full access, or the features the key may use.'
                  type: array
                  nullable: true
                  minItems: 1
                  items:
                    $ref: '#/components/schemas/ApiKeyScope'
                  example:
                    - prompts
                    - vault
      responses:
        '200':
          description: The key's updated access.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  scopes:
                    type: array
                    nullable: true
                    items:
                      $ref: '#/components/schemas/ApiKeyScope'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          description: No signed-in user. Key access can't be changed with an API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such key in the current database configuration.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - sessionAuth: []
components:
  parameters:
    ApiKeyId:
      name: id
      in: path
      required: true
      description: The API key ID (not the secret value).
      schema:
        type: string
  schemas:
    ApiKeyScope:
      type: string
      description: >-
        A feature an API key can use: `ingest` (OTLP telemetry ingestion),
        `telemetry` (`/api/telemetry/*`, `/api/metrics/*`), `prompts`
        (`/api/prompt/*`), `vault` (`/api/vault/*`), `rule_engine`
        (`/api/rule-engine/*`), `evaluation` (`/api/evaluation/*`), `chat`
        (`/api/chat/*`), `controller` (`/api/controller/*`), `db_config`
        (`/api/db-config*`).
      enum:
        - ingest
        - telemetry
        - prompts
        - vault
        - rule_engine
        - evaluation
        - chat
        - controller
        - db_config
    Error:
      type: object
      properties:
        error:
          type: string
  responses:
    BadRequest:
      description: Invalid JSON, an invalid name, or an invalid list of features.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        The request used a Bearer API key, the caller lacks the required
        permission, the edition or license doesn't support restricting keys, or
        the caller's role doesn't include a requested feature.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    sessionAuth:
      type: apiKey
      in: cookie
      name: next-auth.session-token
      description: Signed-in OpenLIT browser session.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.