> ## 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.)

Updates an API key's settings.

## Permissions

User must be **owner** or **admin**.

## What Can Be Updated

* Name and description
* Scopes (permissions)
* Rate limits (per minute/hour)
* Allowed IP addresses
* Expiration date

**Note**: The API key value itself cannot be changed. To rotate a key, delete and create a new one.

## Example

```bash theme={null}
curl -X PUT http://localhost:3001/api/organizations/{organizationId}/api-keys/{id} \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated API Key Name",
    "scopes": ["read:user", "write:webhooks"]
  }'
```

## Security Considerations

* Changing scopes immediately affects API access
* Rate limit changes take effect on next request
* IP restrictions are enforced in real-time


## OpenAPI

````yaml PUT /organizations/{organizationId}/api-keys/{id}
openapi: 3.1.0
info:
  title: Timbrix API
  description: >-
    REST API with OAuth2 server for managing organizations, members, and
    webhooks
  version: '1.0'
  contact: {}
servers:
  - url: http://sandbox.mintlify.com
    description: Sandbox environment
  - url: http://localhost:3001/api
    description: Local development
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
        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

````