# Dynamic Routing ## List all AI Gateway Dynamic Routes. **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` List all AI Gateway Dynamic Routes. ### Path Parameters - `account_id: string` - `gateway_id: string` ### Returns - `data: { order_by, order_by_direction, page, 2 more }` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `routes: array of { id, account_tag, created_at, 6 more }` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "routes": [ { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } } ] }, "success": true } ``` ## Get an AI Gateway Dynamic Route. **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Get an AI Gateway Dynamic Route. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` ### Returns - `result: { id, created_at, deployment, 5 more }` - `id: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Create a new AI Gateway Dynamic Route. **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` Create a new AI Gateway Dynamic Route. ### Path Parameters - `account_id: string` - `gateway_id: string` ### Body Parameters - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `name: string` ### Returns - `result: { id, created_at, deployment, 5 more }` - `id: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "name": "name" }' ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Update an AI Gateway Dynamic Route. **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Update an AI Gateway Dynamic Route. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` ### Body Parameters - `name: string` ### Returns - `route: { id, account_tag, created_at, 6 more }` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID \ -X PATCH \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "name": "Route Name" }' ``` #### Response ```json { "route": { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Delete an AI Gateway Dynamic Route. **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Delete an AI Gateway Dynamic Route. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` ### Returns - `result: { id, created_at, elements, 3 more }` - `id: string` - `created_at: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID \ -X DELETE \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway Dynamic Route Deployments. **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` List all AI Gateway Dynamic Route Deployments. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` ### Returns - `data: { deployments, order_by, order_by_direction, 2 more }` - `deployments: array of { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID/deployments \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "data": { "deployments": [ { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" } ], "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0 }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Deployment. **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` Create a new AI Gateway Dynamic Route Deployment. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` ### Body Parameters - `version_id: string` ### Returns - `result: { id, created_at, elements, 3 more }` - `id: string` - `created_at: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID/deployments \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "version_id": "54442216" }' ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway Dynamic Route Versions. **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` List all AI Gateway Dynamic Route Versions. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` ### Returns - `data: { order_by, order_by_direction, page, 2 more }` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `versions: array of { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID/versions \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "versions": [ { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } ] }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Version. **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` Create a new AI Gateway Dynamic Route Version. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` ### Body Parameters - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` ### Returns - `result: { id, created_at, elements, 3 more }` - `id: string` - `created_at: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID/versions \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ] }' ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Get an AI Gateway Dynamic Route Version. **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}` Get an AI Gateway Dynamic Route Version. ### Path Parameters - `account_id: string` - `gateway_id: string` - `id: string` - `version_id: string` ### Returns - `result: { id, active, created_at, 6 more }` - `id: string` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version_id: string` - `success: boolean` ### Example ```http curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$GATEWAY_ID/routes/$ID/versions/$VERSION_ID \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "result": { "id": "id", "active": "true", "created_at": "created_at", "data": "data", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version_id": "version_id" }, "success": true } ``` ## Domain Types ### Dynamic Routing List Response - `DynamicRoutingListResponse { data, success }` - `data: { order_by, order_by_direction, page, 2 more }` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `routes: array of { id, account_tag, created_at, 6 more }` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Dynamic Routing Get Response - `DynamicRoutingGetResponse { id, created_at, deployment, 5 more }` - `id: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` ### Dynamic Routing Create Response - `DynamicRoutingCreateResponse { id, created_at, deployment, 5 more }` - `id: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` ### Dynamic Routing Update Response - `DynamicRoutingUpdateResponse { route, success }` - `route: { id, account_tag, created_at, 6 more }` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Dynamic Routing Delete Response - `DynamicRoutingDeleteResponse { id, created_at, elements, 3 more }` - `id: string` - `created_at: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Dynamic Routing List Deployments Response - `DynamicRoutingListDeploymentsResponse { data, success }` - `data: { deployments, order_by, order_by_direction, 2 more }` - `deployments: array of { created_at, deployment_id, version_id }` - `created_at: string` - `deployment_id: string` - `version_id: string` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `success: boolean` ### Dynamic Routing Create Deployment Response - `DynamicRoutingCreateDeploymentResponse { id, created_at, elements, 3 more }` - `id: string` - `created_at: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Dynamic Routing List Versions Response - `DynamicRoutingListVersionsResponse { data, success }` - `data: { order_by, order_by_direction, page, 2 more }` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `versions: array of { active, created_at, data, version_id }` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Dynamic Routing Create Version Response - `DynamicRoutingCreateVersionResponse { id, created_at, elements, 3 more }` - `id: string` - `created_at: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Dynamic Routing Get Version Response - `DynamicRoutingGetVersionResponse { id, active, created_at, 6 more }` - `id: string` - `active: "true" or "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `elements: array of { id, outputs, type } or { id, outputs, properties, type } or { id, outputs, type } or 3 more` - `{ id, outputs, type }` - `id: string` - `outputs: { next }` - `next: { elementId }` - `elementId: string` - `type: "start"` - `"start"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { false, true }` - `false: { elementId }` - `elementId: string` - `true: { elementId }` - `elementId: string` - `properties: { conditions }` - `conditions: optional unknown` - `type: "conditional"` - `"conditional"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "percentage"` - `"percentage"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { key, limit, limitType, window }` - `key: string` - `limit: number` - `limitType: "count" or "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `{ id, outputs, properties, type }` - `id: string` - `outputs: { fallback, success }` - `fallback: { elementId }` - `elementId: string` - `success: { elementId }` - `elementId: string` - `properties: { model, provider, retries, timeout }` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `{ id, outputs, type }` - `id: string` - `outputs: map[ { elementId } ]` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version_id: string`