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

# Update an API key

> Updates an API key's name, workspaces, or enabled status.



## OpenAPI

````yaml /spec/ai-keys.yaml put /v1/keys/{keyID}
openapi: 3.0.1
info:
  title: AI - API Keys
  description: >-
    Manage API keys for AI workspace access. API keys are used to authenticate
    inference

    requests (chat completions, embeddings, image generation).


    Parameters:

    - `teamID`: To access services in a team (query param or `x-teamid` header)


    Authentication: JWT Bearer token sent via the `Authorization` header.
  termsOfService: '#'
  contact:
    email: info@liara.ir
  version: 1.0.0
servers:
  - url: https://ai.liara.ir
security:
  - jwt: []
tags:
  - name: API Keys
    description: Manage API keys for AI inference
externalDocs:
  description: Find out more about Liara AI
  url: https://liara.ir
paths:
  /v1/keys/{keyID}:
    put:
      tags:
        - API Keys
      summary: Update an API key
      description: Updates an API key's name, workspaces, or enabled status.
      operationId: updateKey
      parameters:
        - name: keyID
          in: path
          required: true
          description: The API key ID
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateKeyRequest'
      responses:
        '200':
          description: Key updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: key updated.
        '401':
          description: Missing authentication
          content: {}
        '404':
          description: Key not found
          content: {}
        '409':
          description: Conflict - workspace does not exist
          content: {}
components:
  schemas:
    UpdateKeyRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 15
          pattern: ^[A-Za-z0-9._~| -]+$
          description: New name for the API key
        workspaces:
          type: array
          items:
            type: string
          description: New array of workspace names
        enabled:
          type: boolean
          description: Enable or disable the API key
  securitySchemes:
    jwt:
      type: apiKey
      description: 'Enter the token with the `Bearer: ` prefix, e.g. "Bearer abcde12345"'
      name: Authorization
      in: header

````