Search + K

Command Palette

Search for a command to run...

Sign In

Create a new AI Gateway Dynamic Route.

POST /accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes
Copy endpoint
https://api.cloudflare.com/client/v4

Create a new AI Gateway Dynamic Route.

Parameters

path Path Parameters

Name Type
account_id required
string
gateway_id required
string

Request Body

application/json
{ elements: ({ id: string;outputs: { next: { ... }; };type: "start"; } | {
id: string;
outputs: { false: { ... };true: { ... }; };
properties: { conditions?: {}; };
type: "conditional";
}
| { id: string;outputs: { };type: "percentage"; } | {
id: string;
outputs: { fallback: { ... };success: { ... }; };
properties: {
key: string;
limit: number;
limitType: "count" | "cost";
window: number;
}
;
type: "rate";
}
| {
id: string;
outputs: { fallback: { ... };success: { ... }; };
properties: {
model: string;
provider: string;
retries: number;
timeout: number;
}
;
type: "model";
}
| { id: string;outputs: { };type: "end"; }
)[]
;name: string; }

Responses

200 application/json

Success

{ result: {
account_tag: string;
created_at: string;
deployment: {
comment?: string | null;
created_at: string;
deployment_id: string;
version_id: string;
}
;
elements: ({ id: string;outputs: { ... };type: "start"; } | {
id: string;
outputs: { ... };
properties: { ... };
type: "conditional";
}
| { id: string;outputs: { ... };type: "percentage"; } | {
id: string;
outputs: { ... };
properties: { ... };
type: "rate";
}
| {
id: string;
outputs: { ... };
properties: { ... };
type: "model";
}
| { id: string;outputs: { ... };type: "end"; }
)[]
;
gateway_id: string;
id: string;
modified_at: string;
name: string;
version: {
active: "true" | "false";
comment?: string | null;
created_at: string;
data: string;
version_id: string;
}
;
}
;success: boolean; }

Client Errors

400 application/json

Bad Request

{ errors: { message: string; }[];result: {};success: boolean; }