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

# Update an API Key

> Update the name, operation, or scoped teams of an existing API key.



## OpenAPI

````yaml /openapi.yaml put /v1/api-keys/{id}
openapi: 3.1.0
info:
  title: px0 API
  description: >
    px[0] is an open-source prompt infrastructure toolkit for managing prompts
    in production. It replaces hardcoded prompt strings with versioned
    templates, in-process caching, and OpenTelemetry observability, so teams can
    iterate on prompts without touching application code. This is the OpenAPI
    specification for all the public APIs of px0.
  version: 1.0.0
servers:
  - url: http://localhost:3000
    description: Local development server
security: []
paths:
  /v1/api-keys/{id}:
    put:
      tags:
        - API Keys
      summary: Update an API Key
      description: Update the name, operation, or scoped teams of an existing API key.
      operationId: updateAPIKey
      parameters:
        - name: id
          in: path
          required: true
          description: The unique UUID of the API Key to update.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAPIKeyRequest'
      responses:
        '200':
          description: API key updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  api_key:
                    $ref: '#/components/schemas/APIKey'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: API key not found
        '500':
          description: Internal Server Error
      security:
        - BearerAuth: []
components:
  schemas:
    UpdateAPIKeyRequest:
      type: object
      properties:
        name:
          type: string
          description: Descriptive name for the key.
        team_ids:
          type: array
          description: >-
            Optional list of teams the key can access. Omit or pass an empty
            array for organization-wide access.
          items:
            type: string
            format: uuid
        operation:
          type: string
          enum:
            - read_render
            - all
            - admin
    APIKey:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique API Key identifier.
        name:
          type: string
          description: Human-readable name given to the API key.
        org_id:
          type: string
          format: uuid
          description: UUID of the organization.
        team_id:
          type: string
          format: uuid
          nullable: true
          description: Optional UUID of the team.
        operation:
          type: string
          enum:
            - read_render
            - all
            - admin
          description: The scope of operations.
        created_at:
          type: string
          format: date-time
          description: Timestamp when the API Key was created.
        last_used_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp when the API Key was last used. Null if never used.
      required:
        - id
        - name
        - org_id
        - operation
        - created_at
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use an access token retrieved from login (Bearer sess_...) or a
        programmatic API key (Bearer ak_...).

````