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

# Update API Key

> Update name and/or permissions for an API key.

Updates the name and/or permissions associated with this API key.
Requires the `update:api_credentials` permission, available to users with a `member` or `owner` role in the organization that owns the application.

Allowed permissions for API keys:
    `read:organizations`, `update:organizations`,
    `read:applications`, `update:applications`,
    `read:traces`, `write:traces`.

Returns:
    The API key with updated fields and timestamp.

Note:
    For permissions, this completely replaces the existing permissions with the new list.
    Name and permissions are both optional - provide only the fields you want to update.



## OpenAPI

````yaml PATCH /api-keys/{api_key}
openapi: 3.1.0
info:
  title: Unomiq Management API
  description: >-

    API for managing settings for organizations, applications and API keys.


    ## Authentication


    All API endpoints require authentication via JWT token in the Authorization
    header:


    ```

    Authorization: Bearer <your_jwt_token>

    ```
        
  version: 1.0.0
servers:
  - url: https://management-api.unomiq.com
    description: Production
security: []
paths:
  /api-keys/{api_key}:
    patch:
      tags:
        - api-keys
      summary: Update Api Key
      description: >-
        Update name and/or permissions for an API key.


        Updates the name and/or permissions associated with this API key.

        Requires the `update:api_credentials` permission, available to users
        with a `member` or `owner` role in the organization that owns the
        application.


        Allowed permissions for API keys:
            `read:organizations`, `update:organizations`,
            `read:applications`, `update:applications`,
            `read:traces`, `write:traces`.

        Returns:
            The API key with updated fields and timestamp.

        Note:
            For permissions, this completely replaces the existing permissions with the new list.
            Name and permissions are both optional - provide only the fields you want to update.
      operationId: update_api_key_api_keys__api_key__patch
      parameters:
        - name: api_key
          in: path
          required: true
          schema:
            type: string
            title: Api Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyUpdateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ApiKeyUpdateRequest:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Name
          description: The API key's name
        permissions:
          anyOf:
            - items:
                type: string
                enum:
                  - read:applications
                  - read:organizations
                  - read:traces
                  - update:applications
                  - update:organizations
                  - write:traces
              type: array
              minItems: 1
            - type: 'null'
          title: Permissions
          description: List of permissions to grant to this credential.
      type: object
      title: ApiKeyUpdateRequest
    ApiKeyUpdateResponse:
      properties:
        api_key:
          type: string
          title: Api Key
        name:
          type: string
          title: Name
        permissions:
          items:
            type: string
            enum:
              - read:applications
              - read:organizations
              - read:traces
              - update:applications
              - update:organizations
              - write:traces
          type: array
          title: Permissions
        updated_at:
          type: string
          title: Updated At
      type: object
      required:
        - api_key
        - name
        - permissions
        - updated_at
      title: ApiKeyUpdateResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````