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

# Create an AI Gateway Custom Policy

`POST /v1/ai-gateways/{gatewayId}/custom-policies`

## Request

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

Registers a new custom policy for the AI Gateway.

## Path parameters

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

## Request body

- union: Request payload to register a new AI Gateway custom policy.
  - intersection
    - [`CreateAIGatewayCustomPolicyInstalledRequest`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FCreateAIGatewayCustomPolicyInstalledRequest)
  - intersection
    - [`CreateAIGatewayCustomPolicyStreamingRequest`](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4/schema?at=%2Fcomponents%2Fschemas%2FCreateAIGatewayCustomPolicyStreamingRequest)

## Response `201`

Custom policy created successfully.

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

## Other responses

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

## Changes

- **2026-11-16** `a209c8bfa7b7`: 4 breaking, 4 info
  - the `type` request property const value `installed` was added
  - the `type` request property const value `streaming` was added
  - removed the enum value `installed` of the request property `oneOf[#/components/schemas/CreateAIGatewayCustomPolicyInstalledRequest]/type`
  - removed the enum value `streaming` of the request property `oneOf[#/components/schemas/CreateAIGatewayCustomPolicyStreamingRequest]/type`
  - …4 more
- **2026-11-12** `0c641a350d72`: 3 breaking
  - the `oneOf[#/components/schemas/CreateAIGatewayCustomPolicyInstalledRequest]/schema` request property's minLength was increased from `0` to `1`
  - the `oneOf[#/components/schemas/CreateAIGatewayCustomPolicyStreamingRequest]/handler` request property's minLength was increased from `0` to `1`
  - the `oneOf[#/components/schemas/CreateAIGatewayCustomPolicyStreamingRequest]/schema` request property's minLength was increased from `0` to `1`
- …earlier changes not shown

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

---

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