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

# Rotate provider API key

> Rotate the active provider API key for cloud-managed Model Gateway credentials. Currently only `openrouter` is supported.



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/ai.yaml post /api/ai/{provider}/api-key/rotate
openapi: 3.0.3
info:
  title: Insforge AI API
  version: 1.0.0
  description: >-
    Model Gateway helper APIs for OpenRouter key provisioning, model discovery,
    and deprecated compatibility proxy routes
servers: []
security: []
paths:
  /api/ai/{provider}/api-key/rotate:
    post:
      tags:
        - Admin
      summary: Rotate provider API key
      description: >-
        Rotate the active provider API key for cloud-managed Model Gateway
        credentials. Currently only `openrouter` is supported.
      parameters:
        - $ref: '#/components/parameters/AIProvider'
      responses:
        '200':
          description: API key rotated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenRouterKeyResponse'
        '400':
          description: Unsupported provider
        '401':
          description: Unauthorized
        '500':
          description: Failed to rotate API key
      security:
        - bearerAuth: []
components:
  parameters:
    AIProvider:
      name: provider
      in: path
      required: true
      schema:
        type: string
        enum:
          - openrouter
      description: AI provider identifier
  schemas:
    OpenRouterKeyResponse:
      type: object
      properties:
        apiKey:
          type: string
          description: Active OpenRouter API key for admin copy workflows
        maskedKey:
          type: string
          description: Masked OpenRouter API key for display
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````