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

# Update an existing API key by ID

> Update an existing API key by ID



## OpenAPI

````yaml /api/openapi.json post /api/auth/api-key/update
openapi: 3.1.0
info:
  title: Aquila API
  version: 1.0.0
  description: >-
    Event-driven reconnaissance platform API. All /api/* routes except
    /api/public/* require an authenticated session (cookie), an X-Api-Key
    header, or a bearer token. Auth endpoints under /api/auth/* are generated by
    Better Auth.
servers:
  - url: https://aquila.attaxr.com
  - url: http://localhost
security: []
tags:
  - name: AI
  - name: Agents
  - name: Bulk Delete
  - name: Chat
  - name: Constraints
  - name: Dashboard
  - name: Events
  - name: JS
  - name: JS Analysis
  - name: JS Monitoring
  - name: Leads
  - name: MCP Key
  - name: Models
  - name: Notification Channels
  - name: Notification Event Preferences
  - name: Notifications
  - name: OOB
  - name: Provider Keys
  - name: Public Shares
  - name: Reinforcements
  - name: Reports
  - name: Scans
  - name: Schedules
  - name: Shares
  - name: Tools
  - name: User Profiles
  - name: V1
  - name: Vulnerabilities
  - name: Workflows
paths:
  /api/auth/api-key/update:
    post:
      tags:
        - Auth
      summary: Update an existing API key by ID
      description: Update an existing API key by ID
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                configId:
                  type: string
                  description: >-
                    The configuration ID to use for the API key lookup. If not
                    provided, the default configuration will be used.
                keyId:
                  type: string
                  description: The id of the Api Key
                userId:
                  type: string
                  description: >-
                    The id of the user which the api key belongs to.
                    server-only. Eg: "some-user-id"
                name:
                  type: string
                  description: The name of the key
                enabled:
                  type: boolean
                  description: Whether the Api Key is enabled or not
                remaining:
                  type: number
                  description: The number of remaining requests
                refillAmount:
                  type: number
                  description: The refill amount
                refillInterval:
                  type: number
                  description: The refill interval
                metadata: {}
                expiresIn:
                  type:
                    - number
                    - 'null'
                  description: Expiration time of the Api Key in seconds
                rateLimitEnabled:
                  type: boolean
                  description: Whether the key has rate limiting enabled.
                rateLimitTimeWindow:
                  type: number
                  description: >-
                    The duration in milliseconds where each request is counted.
                    server-only. Eg: 1000
                rateLimitMax:
                  type: number
                  description: >-
                    Maximum amount of requests allowed within a window. Once the
                    `maxRequests` is reached, the request will be rejected until
                    the `timeWindow` has passed, at which point the `timeWindow`
                    will be reset. server-only. Eg: 100
                permissions:
                  type:
                    - object
                    - 'null'
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: array
                    items:
                      type: string
                  description: Update the permissions on the API Key. server-only.
              required:
                - keyId
      responses:
        '200':
          description: API key updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID
                  name:
                    type: string
                    nullable: true
                    description: The name of the key
                  start:
                    type: string
                    nullable: true
                    description: >-
                      Shows the first few characters of the API key, including
                      the prefix. This allows you to show those few characters
                      in the UI to make it easier for users to identify the API
                      key.
                  prefix:
                    type: string
                    nullable: true
                    description: The API Key prefix. Stored as plain text.
                  userId:
                    type: string
                    description: The owner of the user id
                  refillInterval:
                    type: number
                    nullable: true
                    description: >-
                      The interval in milliseconds between refills of the
                      `remaining` count. Example: 3600000 // refill every hour
                      (3600000ms = 1h)
                  refillAmount:
                    type: number
                    nullable: true
                    description: The amount to refill
                  lastRefillAt:
                    type: string
                    format: date-time
                    nullable: true
                    description: The last refill date
                  enabled:
                    type: boolean
                    description: Sets if key is enabled or disabled
                    default: true
                  rateLimitEnabled:
                    type: boolean
                    description: Whether the key has rate limiting enabled
                  rateLimitTimeWindow:
                    type: number
                    nullable: true
                    description: The duration in milliseconds
                  rateLimitMax:
                    type: number
                    nullable: true
                    description: Maximum amount of requests allowed within a window
                  requestCount:
                    type: number
                    description: >-
                      The number of requests made within the rate limit time
                      window
                  remaining:
                    type: number
                    nullable: true
                    description: >-
                      Remaining requests (every time api key is used this should
                      updated and should be updated on refill as well)
                  lastRequest:
                    type: string
                    format: date-time
                    nullable: true
                    description: When last request occurred
                  expiresAt:
                    type: string
                    format: date-time
                    nullable: true
                    description: Expiry date of a key
                  createdAt:
                    type: string
                    format: date-time
                    description: created at
                  updatedAt:
                    type: string
                    format: date-time
                    description: updated at
                  metadata:
                    type: object
                    nullable: true
                    additionalProperties: true
                    description: Extra metadata about the apiKey
                  permissions:
                    type: string
                    nullable: true
                    description: Permissions for the api key (stored as JSON string)
                required:
                  - id
                  - userId
                  - enabled
                  - rateLimitEnabled
                  - requestCount
                  - createdAt
                  - updatedAt
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
          description: >-
            Bad Request. Usually due to missing parameters, or invalid
            parameters.
        '401':
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
          description: Unauthorized. Due to missing or invalid authentication.
        '403':
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
          description: >-
            Forbidden. You do not have permission to access this resource or to
            perform this action.
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
          description: Not Found. The requested resource was not found.
        '429':
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
          description: >-
            Too Many Requests. You have exceeded the rate limit. Try again
            later.
        '500':
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
          description: >-
            Internal Server Error. This is a problem with the server that you
            cannot fix.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Personal API key sent as a bearer token.

````