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

# Update an API key (name/permissions)



## OpenAPI

````yaml /openapi.en.json patch /api/v2/api-keys/{keyId}
openapi: 3.0.0
info:
  title: ItemShop v2 API
  description: >-
    REST API platformy ItemShop v2 (NestJS + Fastify). Wszystkie ścieżki mają
    prefiks /api/v2.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.itemshop.dev
    description: Production
  - url: http://localhost:3000
    description: Local
security: []
tags: []
paths:
  /api/v2/api-keys/{keyId}:
    patch:
      tags:
        - API Keys
      summary: Update an API key (name/permissions)
      operationId: ApiKeyController_updateApiKey
      parameters:
        - name: keyId
          required: true
          in: path
          schema:
            type: string
          description: API key ID (ObjectId)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateApiKeyDto'
      responses:
        '200':
          description: Key updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/ApiKey'
                  message:
                    type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    UpdateApiKeyDto:
      type: object
      properties:
        name:
          type: string
          description: Key name
          example: Plugin survival
        permissions:
          description: Permissions as resource:action. Wildcards 'products:*' / '*'.
          example:
            - products:read
            - orders:write
          type: array
          items:
            type: string
    ApiKey:
      type: object
      properties:
        id:
          type: string
          example: 664f1a2b3c4d5e6f7a8b9c0d
        name:
          type: string
          example: Plugin survival
        permissions:
          type: array
          items:
            type: string
          example:
            - read
            - write
        type:
          type: string
          example: plugin
        keyPreview:
          type: string
          example: isk_a1b2...
        isActive:
          type: boolean
          example: true
        createdAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        statusCode:
          type: integer
          example: 400
        error:
          type: string
          example: Error message
        timestamp:
          type: string
          format: date-time
        path:
          type: string
          example: /api/v2/...
  securitySchemes:
    bearerAuth:
      scheme: bearer
      bearerFormat: JWT
      type: http

````