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

# Edit an api key

> A PATCH-style partial edit: only the fields present in ``updates`` are
overwritten; a field absent is preserved at its stored value, so saving a
description or scope change never silently drops an authorization ``condition`` or
``policy_data`` gate. ``updates`` is the sparse set of present fields (a single dict
rather than flattened params, so "field absent" stays distinct from "field is
``null``" — the partial-edit semantics a flat signature cannot express).



## OpenAPI

````yaml /openapi.json put /api/auth/api-keys/{user_id}
openapi: 3.1.0
info:
  description: The operator HTTP surface served under /api/*.
  title: tai42-skeleton API
  version: 0.1.1
servers: []
security: []
paths:
  /api/auth/api-keys/{user_id}:
    put:
      tags:
        - access-control
      summary: Edit an api key
      description: >-
        A PATCH-style partial edit: only the fields present in ``updates`` are

        overwritten; a field absent is preserved at its stored value, so saving
        a

        description or scope change never silently drops an authorization
        ``condition`` or

        ``policy_data`` gate. ``updates`` is the sparse set of present fields (a
        single dict

        rather than flattened params, so "field absent" stays distinct from
        "field is

        ``null``" — the partial-edit semantics a flat signature cannot express).
      operationId: put_api_auth_api_keys_user_id
      parameters:
        - in: path
          name: user_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyEdit'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data: {}
                required:
                  - data
                type: object
          description: Success.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Malformed request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ApiKeyEdit:
      description: |-
        A partial api-key edit — only the fields present are overwritten; a
        ``null``/``{}``/``""`` value clears an optional gate.
      properties:
        condition:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Condition
        condition_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Condition Id
        condition_kwargs:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Condition Kwargs
        description:
          anyOf:
            - minLength: 1
              type: string
            - type: 'null'
          default: null
          title: Description
        policy_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Policy Data
        scopes:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          title: Scopes
      title: ApiKeyEdit
      type: object
    Error:
      properties:
        error:
          type: string
      required:
        - error
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````