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

# Update API key

> Update API key settings (name, scopes, rate limits, etc.)



## OpenAPI

````yaml https://api.timbrix.mx/api/openapi.json put /organizations/{organizationId}/api-keys/{id}
openapi: 3.0.0
info:
  title: Timbrix API
  description: >-
    API de facturación electrónica CFDI 4.0 para México, con servidor OAuth2
    para gestionar organizaciones, miembros y webhooks. Compatible con agentes
    de IA — ver la extensión `x-ai-agent-friendly` en la raíz de esta spec.


    REST API with OAuth2 server for managing organizations, members, and
    webhooks.
  version: '1.0'
  contact: {}
servers: []
security: []
tags:
  - name: organizations
    description: Organization management endpoints
  - name: oauth
    description: OAuth2 authentication and authorization
  - name: webhooks
    description: Webhook configuration and delivery
  - name: users
    description: User information endpoints
  - name: api-keys
    description: API Keys management and validation
paths:
  /organizations/{organizationId}/api-keys/{id}:
    put:
      tags:
        - api-keys
      summary: Update API key
      description: Update API key settings (name, scopes, rate limits, etc.)
      operationId: ApiKeysController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateApiKeyDto'
      responses:
        '200':
          description: API key updated successfully
        '400':
          description: Invalid input data. Check the validation errors in the response.
        '401':
          description: Authentication required. Provide a valid bearer token.
        '403':
          description: Access denied. Only owners and admins can update API keys.
        '404':
          description: API key not found
      security:
        - bearer: []
components:
  schemas:
    UpdateApiKeyDto:
      type: object
      properties:
        name:
          type: string
          description: API key name
          example: Production API Key
          minLength: 3
          maxLength: 50
        description:
          type: string
          description: API key description
          example: Used for production server
          maxLength: 200
        scopes:
          type: array
          description: >-
            API key scopes (permissions). Defaults to ['read:user'] if not
            provided
          example:
            - read:user
            - write:webhooks
          items:
            type: string
            enum:
              - read:user
              - write:user
              - read:organization
              - write:organization
              - read:members
              - write:members
              - read:webhooks
              - write:webhooks
              - read:api-keys
              - write:api-keys
              - read:invoices
              - write:invoices
        rateLimitPerMinute:
          type: number
          description: Rate limit per minute
          example: 60
          minimum: 1
          maximum: 10000
        rateLimitPerHour:
          type: number
          description: Rate limit per hour
          example: 1000
          minimum: 1
          maximum: 100000
        allowedIps:
          description: Allowed IP addresses (CIDR notation supported)
          example:
            - 192.168.1.1
            - 10.0.0.0/24
          type: array
          items:
            type: string
        expiresAt:
          type: string
          description: Expiration date
          example: '2025-12-31T23:59:59Z'
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````