curl --request GET \
--url https://api.edenai.run/v3/manage/routing-policies/{name}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.edenai.run/v3/manage/routing-policies/{name}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.edenai.run/v3/manage/routing-policies/{name}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.edenai.run/v3/manage/routing-policies/{name}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.edenai.run/v3/manage/routing-policies/{name}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.edenai.run/v3/manage/routing-policies/{name}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/manage/routing-policies/{name}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"scope": "organization",
"description": "<string>",
"enabled": true,
"strategy": "fallback",
"targets": [
{
"model": "<string>",
"weight": 50,
"retries": 1,
"credentials": "auto",
"routing": {
"sort": "cost",
"sticky": true,
"allow_fallbacks": true,
"allowed_providers": [
"<string>"
],
"ignored_providers": [
"<string>"
],
"order": [
"<string>"
],
"max_price": {
"input": 1,
"output": 1
},
"zero_data_retention": true
},
"region": "<string>"
}
],
"defaults": {
"routing": {
"sort": "cost",
"sticky": true,
"allow_fallbacks": true,
"allowed_providers": [
"<string>"
],
"ignored_providers": [
"<string>"
],
"order": [
"<string>"
],
"max_price": {
"input": 1,
"output": 1
},
"zero_data_retention": true
},
"credentials": "auto",
"retries": 0
},
"lock": [
"sort"
],
"fallbacks": [
"<string>"
],
"version": 123,
"etag": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "jsmith@example.com",
"updated_by": "jsmith@example.com"
}Get a routing policy
Returns one routing policy: your personal one of that name if you have one, else the organization’s (scope=organization reads the organization’s even when a personal one shadows it). The ETag header carries its version, to send back as If-Match on a conditional replace. With a management key, the organization’s policies are managed (manage:read to read, manage:write to write). With your own API key or session token, your personal policies are managed, and the organization’s can be read.
curl --request GET \
--url https://api.edenai.run/v3/manage/routing-policies/{name}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.edenai.run/v3/manage/routing-policies/{name}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.edenai.run/v3/manage/routing-policies/{name}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.edenai.run/v3/manage/routing-policies/{name}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.edenai.run/v3/manage/routing-policies/{name}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.edenai.run/v3/manage/routing-policies/{name}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/manage/routing-policies/{name}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"scope": "organization",
"description": "<string>",
"enabled": true,
"strategy": "fallback",
"targets": [
{
"model": "<string>",
"weight": 50,
"retries": 1,
"credentials": "auto",
"routing": {
"sort": "cost",
"sticky": true,
"allow_fallbacks": true,
"allowed_providers": [
"<string>"
],
"ignored_providers": [
"<string>"
],
"order": [
"<string>"
],
"max_price": {
"input": 1,
"output": 1
},
"zero_data_retention": true
},
"region": "<string>"
}
],
"defaults": {
"routing": {
"sort": "cost",
"sticky": true,
"allow_fallbacks": true,
"allowed_providers": [
"<string>"
],
"ignored_providers": [
"<string>"
],
"order": [
"<string>"
],
"max_price": {
"input": 1,
"output": 1
},
"zero_data_retention": true
},
"credentials": "auto",
"retries": 0
},
"lock": [
"sort"
],
"fallbacks": [
"<string>"
],
"version": 123,
"etag": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "jsmith@example.com",
"updated_by": "jsmith@example.com"
}Authorizations
A management key (mgmt-eden...) to manage the organization's routing policies, or your own API key (sk-eden...) or session token to manage your personal ones, sent as Authorization: Bearer <key>.
Path Parameters
The policy's handle, as called with @edenai/{name}.
Query Parameters
Only policies of this scope: user for your personal ones, organization for the organization's. Without it, both. A management key only ever sees the organization's.
organization, user Response
A routing policy as the management API returns it.
organization for a shared policy, user for a personal one.
organization- Organizationuser- User
organization, user fallback- Fallbackload_balance- Load balancecheapest- Cheapestfastest- Fastest
fallback, load_balance, cheapest, fastest Show child attributes
Show child attributes
Settings applied to every target unless the target overrides them.
Show child attributes
Show child attributes
sort- sortsticky- stickyallow_fallbacks- allow_fallbacksallowed_providers- allowed_providersignored_providers- ignored_providersorder- ordermax_price- max_pricezero_data_retention- zero_data_retentionregion- region
sort, sticky, allow_fallbacks, allowed_providers, ignored_providers, order, max_price, zero_data_retention, region The version, as the If-Match header expects it.
Email of the creator, or null for an API write.
Email of the last editor, or null for an API write.