Add a custom role
const url = 'http://localhost:11044/api/v1/config/router/roles';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"description":"example","id":"example","model":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”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
Body of POST /config/router/roles: a custom role of this world’s own, which a context can then use
object
What the role is for
Lowercase letters, digits and underscores, starting with a letter
The model it uses
Example generated
{ "description": "example", "id": "example", "model": "example"}Responses
Section titled “Responses”Added
The change was applied and the world’s config saved; it takes effect on the next request
object
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
Invalid name, taken name, or unknown model
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
Why it was refused, written to be shown. Carries the router’s own sentence, which names the context, role or model at fault
Always false

