Skip to content

Add a custom role

POST
/api/v1/config/router/roles
curl --request POST \
--url http://localhost:11044/api/v1/config/router/roles \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "description": "example", "id": "example", "model": "example" }'

A role of this world’s own: a name, what it is for, and the model it uses. A context can then use it.

The custom role to add to this world’s config: id (trimmed; 2-40 lowercase letters, digits and underscores, starting with a letter, and not already a built-in, deployment or custom role), description (required; what the role is for) and model (one of the chat models GET /config/router lists). Any of these failing answers 400; nothing is saved

Media typeapplication/json

Body of POST /config/router/roles: a custom role of this world’s own, which a context can then use

object
description
required

What the role is for

string
id
required

Lowercase letters, digits and underscores, starting with a letter

string
model
required

The model it uses

string

Example generated

{
"description": "example",
"id": "example",
"model": "example"
}

Added

Media type*/*

The change was applied and the world’s config saved; it takes effect on the next request

object
ok
required

Always true. A client that only branches on the status code can ignore it; one that reads the body does not have to special-case the shape

boolean

Invalid name, taken name, or unknown model

Media type*/*

The change was refused and nothing was saved. The status code says which kind of refusal: 400 for something unknown or invalid, 409 while a context still uses the role

object
detail
required

Why it was refused, written to be shown. Carries the router’s own sentence, which names the context, role or model at fault

string
ok
required

Always false

boolean