curl --request POST \
--url https://api.opper.ai/management/v1/dynamic-routes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"graph": {},
"name": "<string>"
}
'import requests
url = "https://api.opper.ai/management/v1/dynamic-routes"
payload = {
"graph": {},
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({graph: {}, name: '<string>'})
};
fetch('https://api.opper.ai/management/v1/dynamic-routes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"draft": {
"graph": {},
"layout": {},
"revision": 123,
"validation": "<array>"
},
"route": {
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"draft_revision": 123,
"invocation_model": "<string>",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"uuid": [
123
],
"deleted_at": "2023-11-07T05:31:56Z",
"draft_graph": {},
"draft_layout": {},
"draft_validation": "<array>"
},
"version_count": 123,
"active_version": {
"created_at": "2023-11-07T05:31:56Z",
"note": "<string>",
"uuid": [
123
],
"version_number": 123
},
"latest_version_number": 123
},
"meta": {
"deployed_version": {
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"draft_revision": 123,
"note": "<string>",
"route_name": "<string>",
"uuid": [
123
],
"version_number": 123,
"graph": {},
"layout": {},
"validation": "<array>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"allowed_plans": [
"<string>"
],
"current_plan": "<string>",
"error": "<string>",
"required_scope": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Create a dynamic route
Creates a route with the given graph as its draft. The name becomes the model id callers use: {"model": "<name>"} on chat completions, responses, messages or the native call endpoint. Send deploy: true to validate and publish the draft as version 1 in the same call; otherwise the route exists but serves nothing until it is deployed. A graph that does not parse is refused; one that parses but fails validation is saved as a draft with its issues and cannot be deployed until fixed. Requires the dynamic_routes:write scope.
curl --request POST \
--url https://api.opper.ai/management/v1/dynamic-routes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"graph": {},
"name": "<string>"
}
'import requests
url = "https://api.opper.ai/management/v1/dynamic-routes"
payload = {
"graph": {},
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({graph: {}, name: '<string>'})
};
fetch('https://api.opper.ai/management/v1/dynamic-routes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"draft": {
"graph": {},
"layout": {},
"revision": 123,
"validation": "<array>"
},
"route": {
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"draft_revision": 123,
"invocation_model": "<string>",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"uuid": [
123
],
"deleted_at": "2023-11-07T05:31:56Z",
"draft_graph": {},
"draft_layout": {},
"draft_validation": "<array>"
},
"version_count": 123,
"active_version": {
"created_at": "2023-11-07T05:31:56Z",
"note": "<string>",
"uuid": [
123
],
"version_number": 123
},
"latest_version_number": 123
},
"meta": {
"deployed_version": {
"created_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"draft_revision": 123,
"note": "<string>",
"route_name": "<string>",
"uuid": [
123
],
"version_number": 123,
"graph": {},
"layout": {},
"validation": "<array>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"allowed_plans": [
"<string>"
],
"current_plan": "<string>",
"error": "<string>",
"required_scope": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Authorizations
Management API authentication. Pass an op-mak-… management token as a Bearer token. Runtime op-… API keys are rejected with 403 — they belong on the data-plane endpoints. Mint a management key from the platform UI under Settings → API keys.
Body
The route graph (see DynamicRouteGraph): a START element; the answering and branching nodes; an END element; each wired to the next through its outputs.
Route name and the model id callers use to invoke it: lowercase letters and digits plus '.' '_' '-'; up to 128 characters; unique per organization.
When true the draft is validated and deployed as version 1 in the same call; the response then carries deployed_version in meta.
Free-text description shown in the platform.
Editor canvas positions keyed by element id. Opaque to the gateway; omit when authoring from code.
Release note recorded on the deployed version. Only read when deploy is true.