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

> Update mutable fields on an existing AI Gateway provider key.

# Update an AI Gateway provider key



## OpenAPI

````yaml openapi/ai-gateway.yaml PATCH /provider-keys/{id}
openapi: 3.0.3
info:
  title: AI Gateway APIs
  version: 0.1.0
  description: |
    Control-plane HTTP APIs served by the ai-gateway-control service.
servers:
  - url: https://api.ngrok.ai
security:
  - bearerAuth: []
tags:
  - name: AI Gateway Access Key Configurations
    description: Manage reusable access key configurations (scope and routing rules).
  - name: AI Gateway Access Keys
    description: Manage ngrok-managed access keys associated with AI Gateway endpoints.
  - name: AI Gateway Configuration
    description: >-
      Manage per-account AI Gateway configuration (timeouts, token caps,
      metadata).
  - name: AI Gateway API Keys
    description: Manage customer-facing AI Gateway API Keys.
  - name: AI Gateway Credits
    description: Purchase AI Gateway credits via Stripe Checkout.
  - name: AI Gateway Providers
    description: Manage AI Gateway providers and the models they expose.
  - name: AI Gateway Custom Providers
    description: Manage custom AI Gateway providers and the models they expose.
  - name: AI Gateway Provider Keys
    description: Manage provider keys attached to AI Gateway managed access keys.
  - name: AI Gateway Usage
    description: >-
      Read-only AI Gateway usage events and aggregated usage overview for the
      authenticated account.
paths:
  /provider-keys/{id}:
    parameters:
      - $ref: '#/components/parameters/AIGatewayProviderAPIKeyID'
    patch:
      tags:
        - AI Gateway Provider Keys
      summary: Update an AI Gateway provider key
      description: Update mutable fields on an existing AI Gateway provider key.
      operationId: UpdateAIGatewayProviderAPIKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AIGatewayProviderAPIKeyUpdate'
      responses:
        '200':
          description: The updated AI Gateway provider key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIGatewayProviderAPIKeyDetail'
        default:
          $ref: '#/components/responses/Error'
components:
  parameters:
    AIGatewayProviderAPIKeyID:
      name: id
      in: path
      required: true
      description: Unique identifier for an AI Gateway provider key.
      schema:
        type: string
  schemas:
    AIGatewayProviderAPIKeyUpdate:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          nullable: true
          maxLength: 255
          description: User-defined label for this provider key.
        description:
          type: string
          nullable: true
          maxLength: 255
          description: Human-readable description of this provider key.
        metadata:
          type: string
          nullable: true
          maxLength: 4096
          description: Arbitrary user-defined metadata for this provider key.
    AIGatewayProviderAPIKeyDetail:
      type: object
      additionalProperties: false
      required:
        - id
        - uri
        - createdAt
        - updatedAt
        - providerId
        - name
        - keyRedacted
        - createdBy
        - lastUpdatedBy
      properties:
        id:
          type: string
          description: Unique identifier for this provider key.
        uri:
          type: string
          description: URI of this AI Gateway Provider Key API resource.
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the provider key was created.
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the provider key was last updated.
        providerId:
          type: string
          description: >-
            Which AI provider this key is for, for example `openai` or
            `anthropic`.
        name:
          type: string
          description: User-defined label for this provider key.
        keyRedacted:
          type: string
          description: Redacted display form of the key value.
        description:
          type: string
          description: Human-readable description of this provider key.
        metadata:
          type: string
          description: Arbitrary user-defined metadata for this provider key.
        createdBy:
          $ref: '#/components/schemas/Ref'
        lastUpdatedBy:
          $ref: '#/components/schemas/Ref'
        lastUsed:
          type: string
          format: date-time
          nullable: true
          description: Timestamp when the provider key was last used.
    Ref:
      type: object
      additionalProperties: false
      required:
        - id
        - uri
      properties:
        id:
          type: string
          description: Resource identifier.
        uri:
          type: string
          description: URI for locating the resource.
    Error:
      type: object
      additionalProperties: false
      required:
        - statusCode
        - msg
        - details
      properties:
        errorCode:
          type: string
          description: Stable ngrok error code when available.
        statusCode:
          type: integer
          format: int32
          description: HTTP status code for this error.
        msg:
          type: string
          description: Human-readable error message.
        details:
          type: object
          description: Structured error details.
          additionalProperties:
            type: string
  responses:
    Error:
      description: API error response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````