---
title: "Update an AI Gateway Custom Policy"
method: PUT
path: "/v1/ai-gateways/{gatewayId}/custom-policies/{customPolicyIdOrName}"
tags: ["AI Gateway Custom Policies"]
---

# Update an AI Gateway Custom Policy

`PUT /v1/ai-gateways/{gatewayId}/custom-policies/{customPolicyIdOrName}`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v1/ai-gateways/{gatewayId}/custom-policies/{customPolicyIdOrName}`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Updates the configuration of an existing AI Gateway custom policy.

## Path parameters

- `gatewayId` string, uuid, required: Contains a unique identifier used for this resource.
- `customPolicyIdOrName` string, uuid, required: Contains a unique identifier used for this resource.

## Request body

- union: Request payload to update an existing AI Gateway custom policy.
  - intersection
    - [`UpdateAIGatewayCustomPolicyInstalledRequest`](https://skmtc.dev/kong/apis/konnect-api/revisions/5da43f6209ea/schema?at=%2Fcomponents%2Fschemas%2FUpdateAIGatewayCustomPolicyInstalledRequest)
  - intersection
    - [`UpdateAIGatewayCustomPolicyStreamingRequest`](https://skmtc.dev/kong/apis/konnect-api/revisions/5da43f6209ea/schema?at=%2Fcomponents%2Fschemas%2FUpdateAIGatewayCustomPolicyStreamingRequest)

## Response `200`

Custom policy updated successfully.

- union: An AI Gateway custom policy.
  - intersection
    - [`AIGatewayCustomPolicyInstalled`](https://skmtc.dev/kong/apis/konnect-api/revisions/5da43f6209ea/schema?at=%2Fcomponents%2Fschemas%2FAIGatewayCustomPolicyInstalled)
  - intersection
    - [`AIGatewayCustomPolicyStreaming`](https://skmtc.dev/kong/apis/konnect-api/revisions/5da43f6209ea/schema?at=%2Fcomponents%2Fschemas%2FAIGatewayCustomPolicyStreaming)

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `429`: Too Many Requests

## Changes

- **2026-11-20** `757a21fb79f2`: 5 breaking, 2 warning, 4 info
  - the `oneOf[#/components/schemas/UpdateAIGatewayCustomPolicyInstalledRequest]/schema` request property's minLength was increased from `0` to `1`
  - the `oneOf[#/components/schemas/UpdateAIGatewayCustomPolicyStreamingRequest]/handler` request property's minLength was increased from `0` to `1`
  - the `oneOf[#/components/schemas/UpdateAIGatewayCustomPolicyStreamingRequest]/schema` request property's minLength was increased from `0` to `1`
  - the `oneOf[#/components/schemas/AIGatewayCustomPolicyInstalled]/managed_by/additionalProperties/` response property's maxLength was increased from `63` to `127` for the response status `200`
  - …7 more
- **2026-10-23** `30af8b28f6ef`: 1 breaking, 2 warning
  - added `#/components/schemas/InvalidParameterMinimumTime, #/components/schemas/InvalidParameterMaximumTime` to the `invalid_parameters/items/` response property `oneOf` list for the response status `400`
  - added the new `key_invalid` enum value to the `invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule` response property for the response status `400`
  - added the new `unique` enum value to the `invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule` response property for the response status `400`
- **2026-09-30** `f530bf400198`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/konnect-api/changes/v1/ai-gateways/:gatewayId/custom-policies/:customPolicyIdOrName/put.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api/revisions/5da43f6209ea?raw)
