Create a dynamic route
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
config: {
schemaVersion: 2,
entryNodeId: '<string>',
nodes: [{id: '<string>', data: {}, position: {x: 123, y: 123}}],
edges: [
{
id: '<string>',
source: '<string>',
target: '<string>',
sourceHandle: '<string>'
}
],
cacheAwareRouting: true,
sessionAffinity: true,
defaultAction: {
model: '<string>',
modelFallbacks: ['<string>'],
providerOrder: ['<string>'],
providerOnly: ['<string>'],
providerIgnore: ['<string>'],
allowFallbacks: true
},
rules: [
{
id: '<string>',
name: '<string>',
enabled: true,
condition: {value: '<string>', metadataKey: '<string>'},
action: {
model: '<string>',
modelFallbacks: ['<string>'],
providerOrder: ['<string>'],
providerOnly: ['<string>'],
providerIgnore: ['<string>'],
allowFallbacks: true
}
}
]
},
slug: '<string>',
description: '<string>'
})
};
fetch('https://api.phaseo.app/v1/routing/dynamic-routes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/routing/dynamic-routes"
payload = {
"name": "<string>",
"config": {
"schemaVersion": 2,
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"data": {},
"position": {
"x": 123,
"y": 123
}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"sourceHandle": "<string>"
}
],
"cacheAwareRouting": True,
"sessionAffinity": True,
"defaultAction": {
"model": "<string>",
"modelFallbacks": ["<string>"],
"providerOrder": ["<string>"],
"providerOnly": ["<string>"],
"providerIgnore": ["<string>"],
"allowFallbacks": True
},
"rules": [
{
"id": "<string>",
"name": "<string>",
"enabled": True,
"condition": {
"value": "<string>",
"metadataKey": "<string>"
},
"action": {
"model": "<string>",
"modelFallbacks": ["<string>"],
"providerOrder": ["<string>"],
"providerOnly": ["<string>"],
"providerIgnore": ["<string>"],
"allowFallbacks": True
}
}
]
},
"slug": "<string>",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.phaseo.app/v1/routing/dynamic-routes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"config": {
"schemaVersion": 2,
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"data": {},
"position": {
"x": 123,
"y": 123
}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"sourceHandle": "<string>"
}
],
"cacheAwareRouting": true,
"sessionAffinity": true,
"defaultAction": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
},
"rules": [
{
"id": "<string>",
"name": "<string>",
"enabled": true,
"condition": {
"value": "<string>",
"metadataKey": "<string>"
},
"action": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
}
}
]
},
"slug": "<string>",
"description": "<string>"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/routing/dynamic-routes"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"config\": {\n \"schemaVersion\": 2,\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"data\": {},\n \"position\": {\n \"x\": 123,\n \"y\": 123\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"sourceHandle\": \"<string>\"\n }\n ],\n \"cacheAwareRouting\": true,\n \"sessionAffinity\": true,\n \"defaultAction\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n },\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"condition\": {\n \"value\": \"<string>\",\n \"metadataKey\": \"<string>\"\n },\n \"action\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n }\n }\n ]\n },\n \"slug\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phaseo.app/v1/routing/dynamic-routes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"config\": {\n \"schemaVersion\": 2,\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"data\": {},\n \"position\": {\n \"x\": 123,\n \"y\": 123\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"sourceHandle\": \"<string>\"\n }\n ],\n \"cacheAwareRouting\": true,\n \"sessionAffinity\": true,\n \"defaultAction\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n },\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"condition\": {\n \"value\": \"<string>\",\n \"metadataKey\": \"<string>\"\n },\n \"action\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n }\n }\n ]\n },\n \"slug\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/routing/dynamic-routes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'config' => [
'schemaVersion' => 2,
'entryNodeId' => '<string>',
'nodes' => [
[
'id' => '<string>',
'data' => [
],
'position' => [
'x' => 123,
'y' => 123
]
]
],
'edges' => [
[
'id' => '<string>',
'source' => '<string>',
'target' => '<string>',
'sourceHandle' => '<string>'
]
],
'cacheAwareRouting' => true,
'sessionAffinity' => true,
'defaultAction' => [
'model' => '<string>',
'modelFallbacks' => [
'<string>'
],
'providerOrder' => [
'<string>'
],
'providerOnly' => [
'<string>'
],
'providerIgnore' => [
'<string>'
],
'allowFallbacks' => true
],
'rules' => [
[
'id' => '<string>',
'name' => '<string>',
'enabled' => true,
'condition' => [
'value' => '<string>',
'metadataKey' => '<string>'
],
'action' => [
'model' => '<string>',
'modelFallbacks' => [
'<string>'
],
'providerOrder' => [
'<string>'
],
'providerOnly' => [
'<string>'
],
'providerIgnore' => [
'<string>'
],
'allowFallbacks' => true
]
]
]
],
'slug' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/routing/dynamic-routes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"config\": {\n \"schemaVersion\": 2,\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"data\": {},\n \"position\": {\n \"x\": 123,\n \"y\": 123\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"sourceHandle\": \"<string>\"\n }\n ],\n \"cacheAwareRouting\": true,\n \"sessionAffinity\": true,\n \"defaultAction\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n },\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"condition\": {\n \"value\": \"<string>\",\n \"metadataKey\": \"<string>\"\n },\n \"action\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n }\n }\n ]\n },\n \"slug\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"status": "active",
"version": 2,
"config": {
"schemaVersion": 2,
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"type": "start",
"data": {},
"position": {
"x": 123,
"y": 123
}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"sourceHandle": "<string>"
}
],
"cacheAwareRouting": true,
"sessionAffinity": true,
"defaultAction": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"routingMode": "balanced",
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
},
"rules": [
{
"id": "<string>",
"name": "<string>",
"enabled": true,
"condition": {
"field": "always",
"operator": "equals",
"value": "<string>",
"metadataKey": "<string>"
},
"action": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"routingMode": "balanced",
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
}
}
]
},
"key_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"versions": [
{
"version": 2,
"status": "draft",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
],
"description": "<string>",
"deployed_version": 2,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "error_type",
"ok": false,
"message": "Human-readable error message",
"description": "Additional error details.",
"generation_id": "G-abc123",
"status_code": 502,
"error_type": "system",
"error_origin": "upstream",
"reason": "all_candidates_failed",
"attempt_count": 2,
"failed_providers": [
"google-ai-studio",
"openai"
],
"failed_statuses": [
403,
429
],
"upstream_error": {
"code": "PERMISSION_DENIED",
"message": "The caller does not have permission.",
"description": "<string>",
"param": "<string>"
},
"failure_sample": [
{
"provider": "<string>",
"type": "<string>",
"status": 123,
"upstream_error_code": "<string>",
"upstream_error_message": "<string>",
"upstream_error_description": "<string>",
"upstream_error_param": "<string>",
"upstream_payload_preview": "<string>",
"retryable": true
}
],
"provider_failure_diagnostics": {
"category": "credentials_not_configured",
"hint": "<string>",
"provider": "<string>"
},
"routing_diagnostics": {
"filterStages": [
{
"stage": "<string>",
"beforeCount": 123,
"afterCount": 123,
"droppedProviders": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
}
]
},
"provider_candidate_diagnostics": {
"totalProviders": 123,
"supportsEndpointCount": 123,
"candidateCount": 123,
"droppedUnsupportedEndpoint": [
"<string>"
],
"droppedMissingAdapter": [
{
"providerId": "<string>",
"endpoint": "<string>"
}
]
},
"provider_enablement": {
"capability": "<string>",
"providersBefore": [
"<string>"
],
"providersAfter": [
"<string>"
],
"dropped": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
},
"missing_pricing_providers": [
"<string>"
],
"provider_payment_required_provider": "openai",
"provider_payment_required_support_notice": "Our upstream provider billing appears to be unavailable. If this persists, contact support.",
"details": [
{}
]
}{
"error": "error_type",
"ok": false,
"message": "Human-readable error message",
"description": "Additional error details.",
"generation_id": "G-abc123",
"status_code": 502,
"error_type": "system",
"error_origin": "upstream",
"reason": "all_candidates_failed",
"attempt_count": 2,
"failed_providers": [
"google-ai-studio",
"openai"
],
"failed_statuses": [
403,
429
],
"upstream_error": {
"code": "PERMISSION_DENIED",
"message": "The caller does not have permission.",
"description": "<string>",
"param": "<string>"
},
"failure_sample": [
{
"provider": "<string>",
"type": "<string>",
"status": 123,
"upstream_error_code": "<string>",
"upstream_error_message": "<string>",
"upstream_error_description": "<string>",
"upstream_error_param": "<string>",
"upstream_payload_preview": "<string>",
"retryable": true
}
],
"provider_failure_diagnostics": {
"category": "credentials_not_configured",
"hint": "<string>",
"provider": "<string>"
},
"routing_diagnostics": {
"filterStages": [
{
"stage": "<string>",
"beforeCount": 123,
"afterCount": 123,
"droppedProviders": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
}
]
},
"provider_candidate_diagnostics": {
"totalProviders": 123,
"supportsEndpointCount": 123,
"candidateCount": 123,
"droppedUnsupportedEndpoint": [
"<string>"
],
"droppedMissingAdapter": [
{
"providerId": "<string>",
"endpoint": "<string>"
}
]
},
"provider_enablement": {
"capability": "<string>",
"providersBefore": [
"<string>"
],
"providersAfter": [
"<string>"
],
"dropped": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
},
"missing_pricing_providers": [
"<string>"
],
"provider_payment_required_provider": "openai",
"provider_payment_required_support_notice": "Our upstream provider billing appears to be unavailable. If this persists, contact support.",
"details": [
{}
]
}Routing
Create dynamic route
Create a versioned dynamic routing policy.
POST
/
routing
/
dynamic-routes
Create a dynamic route
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
config: {
schemaVersion: 2,
entryNodeId: '<string>',
nodes: [{id: '<string>', data: {}, position: {x: 123, y: 123}}],
edges: [
{
id: '<string>',
source: '<string>',
target: '<string>',
sourceHandle: '<string>'
}
],
cacheAwareRouting: true,
sessionAffinity: true,
defaultAction: {
model: '<string>',
modelFallbacks: ['<string>'],
providerOrder: ['<string>'],
providerOnly: ['<string>'],
providerIgnore: ['<string>'],
allowFallbacks: true
},
rules: [
{
id: '<string>',
name: '<string>',
enabled: true,
condition: {value: '<string>', metadataKey: '<string>'},
action: {
model: '<string>',
modelFallbacks: ['<string>'],
providerOrder: ['<string>'],
providerOnly: ['<string>'],
providerIgnore: ['<string>'],
allowFallbacks: true
}
}
]
},
slug: '<string>',
description: '<string>'
})
};
fetch('https://api.phaseo.app/v1/routing/dynamic-routes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/routing/dynamic-routes"
payload = {
"name": "<string>",
"config": {
"schemaVersion": 2,
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"data": {},
"position": {
"x": 123,
"y": 123
}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"sourceHandle": "<string>"
}
],
"cacheAwareRouting": True,
"sessionAffinity": True,
"defaultAction": {
"model": "<string>",
"modelFallbacks": ["<string>"],
"providerOrder": ["<string>"],
"providerOnly": ["<string>"],
"providerIgnore": ["<string>"],
"allowFallbacks": True
},
"rules": [
{
"id": "<string>",
"name": "<string>",
"enabled": True,
"condition": {
"value": "<string>",
"metadataKey": "<string>"
},
"action": {
"model": "<string>",
"modelFallbacks": ["<string>"],
"providerOrder": ["<string>"],
"providerOnly": ["<string>"],
"providerIgnore": ["<string>"],
"allowFallbacks": True
}
}
]
},
"slug": "<string>",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.phaseo.app/v1/routing/dynamic-routes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"config": {
"schemaVersion": 2,
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"data": {},
"position": {
"x": 123,
"y": 123
}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"sourceHandle": "<string>"
}
],
"cacheAwareRouting": true,
"sessionAffinity": true,
"defaultAction": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
},
"rules": [
{
"id": "<string>",
"name": "<string>",
"enabled": true,
"condition": {
"value": "<string>",
"metadataKey": "<string>"
},
"action": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
}
}
]
},
"slug": "<string>",
"description": "<string>"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/routing/dynamic-routes"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"config\": {\n \"schemaVersion\": 2,\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"data\": {},\n \"position\": {\n \"x\": 123,\n \"y\": 123\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"sourceHandle\": \"<string>\"\n }\n ],\n \"cacheAwareRouting\": true,\n \"sessionAffinity\": true,\n \"defaultAction\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n },\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"condition\": {\n \"value\": \"<string>\",\n \"metadataKey\": \"<string>\"\n },\n \"action\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n }\n }\n ]\n },\n \"slug\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phaseo.app/v1/routing/dynamic-routes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"config\": {\n \"schemaVersion\": 2,\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"data\": {},\n \"position\": {\n \"x\": 123,\n \"y\": 123\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"sourceHandle\": \"<string>\"\n }\n ],\n \"cacheAwareRouting\": true,\n \"sessionAffinity\": true,\n \"defaultAction\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n },\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"condition\": {\n \"value\": \"<string>\",\n \"metadataKey\": \"<string>\"\n },\n \"action\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n }\n }\n ]\n },\n \"slug\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/routing/dynamic-routes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'config' => [
'schemaVersion' => 2,
'entryNodeId' => '<string>',
'nodes' => [
[
'id' => '<string>',
'data' => [
],
'position' => [
'x' => 123,
'y' => 123
]
]
],
'edges' => [
[
'id' => '<string>',
'source' => '<string>',
'target' => '<string>',
'sourceHandle' => '<string>'
]
],
'cacheAwareRouting' => true,
'sessionAffinity' => true,
'defaultAction' => [
'model' => '<string>',
'modelFallbacks' => [
'<string>'
],
'providerOrder' => [
'<string>'
],
'providerOnly' => [
'<string>'
],
'providerIgnore' => [
'<string>'
],
'allowFallbacks' => true
],
'rules' => [
[
'id' => '<string>',
'name' => '<string>',
'enabled' => true,
'condition' => [
'value' => '<string>',
'metadataKey' => '<string>'
],
'action' => [
'model' => '<string>',
'modelFallbacks' => [
'<string>'
],
'providerOrder' => [
'<string>'
],
'providerOnly' => [
'<string>'
],
'providerIgnore' => [
'<string>'
],
'allowFallbacks' => true
]
]
]
],
'slug' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/routing/dynamic-routes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"config\": {\n \"schemaVersion\": 2,\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"data\": {},\n \"position\": {\n \"x\": 123,\n \"y\": 123\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"sourceHandle\": \"<string>\"\n }\n ],\n \"cacheAwareRouting\": true,\n \"sessionAffinity\": true,\n \"defaultAction\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n },\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"condition\": {\n \"value\": \"<string>\",\n \"metadataKey\": \"<string>\"\n },\n \"action\": {\n \"model\": \"<string>\",\n \"modelFallbacks\": [\n \"<string>\"\n ],\n \"providerOrder\": [\n \"<string>\"\n ],\n \"providerOnly\": [\n \"<string>\"\n ],\n \"providerIgnore\": [\n \"<string>\"\n ],\n \"allowFallbacks\": true\n }\n }\n ]\n },\n \"slug\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"status": "active",
"version": 2,
"config": {
"schemaVersion": 2,
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"type": "start",
"data": {},
"position": {
"x": 123,
"y": 123
}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"sourceHandle": "<string>"
}
],
"cacheAwareRouting": true,
"sessionAffinity": true,
"defaultAction": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"routingMode": "balanced",
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
},
"rules": [
{
"id": "<string>",
"name": "<string>",
"enabled": true,
"condition": {
"field": "always",
"operator": "equals",
"value": "<string>",
"metadataKey": "<string>"
},
"action": {
"model": "<string>",
"modelFallbacks": [
"<string>"
],
"routingMode": "balanced",
"providerOrder": [
"<string>"
],
"providerOnly": [
"<string>"
],
"providerIgnore": [
"<string>"
],
"allowFallbacks": true
}
}
]
},
"key_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"versions": [
{
"version": 2,
"status": "draft",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
],
"description": "<string>",
"deployed_version": 2,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "error_type",
"ok": false,
"message": "Human-readable error message",
"description": "Additional error details.",
"generation_id": "G-abc123",
"status_code": 502,
"error_type": "system",
"error_origin": "upstream",
"reason": "all_candidates_failed",
"attempt_count": 2,
"failed_providers": [
"google-ai-studio",
"openai"
],
"failed_statuses": [
403,
429
],
"upstream_error": {
"code": "PERMISSION_DENIED",
"message": "The caller does not have permission.",
"description": "<string>",
"param": "<string>"
},
"failure_sample": [
{
"provider": "<string>",
"type": "<string>",
"status": 123,
"upstream_error_code": "<string>",
"upstream_error_message": "<string>",
"upstream_error_description": "<string>",
"upstream_error_param": "<string>",
"upstream_payload_preview": "<string>",
"retryable": true
}
],
"provider_failure_diagnostics": {
"category": "credentials_not_configured",
"hint": "<string>",
"provider": "<string>"
},
"routing_diagnostics": {
"filterStages": [
{
"stage": "<string>",
"beforeCount": 123,
"afterCount": 123,
"droppedProviders": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
}
]
},
"provider_candidate_diagnostics": {
"totalProviders": 123,
"supportsEndpointCount": 123,
"candidateCount": 123,
"droppedUnsupportedEndpoint": [
"<string>"
],
"droppedMissingAdapter": [
{
"providerId": "<string>",
"endpoint": "<string>"
}
]
},
"provider_enablement": {
"capability": "<string>",
"providersBefore": [
"<string>"
],
"providersAfter": [
"<string>"
],
"dropped": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
},
"missing_pricing_providers": [
"<string>"
],
"provider_payment_required_provider": "openai",
"provider_payment_required_support_notice": "Our upstream provider billing appears to be unavailable. If this persists, contact support.",
"details": [
{}
]
}{
"error": "error_type",
"ok": false,
"message": "Human-readable error message",
"description": "Additional error details.",
"generation_id": "G-abc123",
"status_code": 502,
"error_type": "system",
"error_origin": "upstream",
"reason": "all_candidates_failed",
"attempt_count": 2,
"failed_providers": [
"google-ai-studio",
"openai"
],
"failed_statuses": [
403,
429
],
"upstream_error": {
"code": "PERMISSION_DENIED",
"message": "The caller does not have permission.",
"description": "<string>",
"param": "<string>"
},
"failure_sample": [
{
"provider": "<string>",
"type": "<string>",
"status": 123,
"upstream_error_code": "<string>",
"upstream_error_message": "<string>",
"upstream_error_description": "<string>",
"upstream_error_param": "<string>",
"upstream_payload_preview": "<string>",
"retryable": true
}
],
"provider_failure_diagnostics": {
"category": "credentials_not_configured",
"hint": "<string>",
"provider": "<string>"
},
"routing_diagnostics": {
"filterStages": [
{
"stage": "<string>",
"beforeCount": 123,
"afterCount": 123,
"droppedProviders": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
}
]
},
"provider_candidate_diagnostics": {
"totalProviders": 123,
"supportsEndpointCount": 123,
"candidateCount": 123,
"droppedUnsupportedEndpoint": [
"<string>"
],
"droppedMissingAdapter": [
{
"providerId": "<string>",
"endpoint": "<string>"
}
]
},
"provider_enablement": {
"capability": "<string>",
"providersBefore": [
"<string>"
],
"providersAfter": [
"<string>"
],
"dropped": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
},
"missing_pricing_providers": [
"<string>"
],
"provider_payment_required_provider": "openai",
"provider_payment_required_support_notice": "Our upstream provider billing appears to be unavailable. If this persists, contact support.",
"details": [
{}
]
}This endpoint requires a management API key with
settings:write.Authorizations
Bearer token authentication
Body
application/json
Response
Dynamic route created
Show child attributes
Show child attributes
Last modified on August 30, 2026
Was this page helpful?