Get Public Agent
Read a published agent's name, look, language and greeting
curl https://api.voice213.com/api/agents/public/k3x9m2p7q4wzimport { fetchAgent } from "@voice213/agent-client";
const agent = await fetchAgent("k3x9m2p7q4wz");
button.style.background = agent.accent;const response = await fetch("https://api.voice213.com/api/agents/public/k3x9m2p7q4wz");
const agent = await response.json();{
"name": "Lamsa",
"description": "Confirms cash-on-delivery orders",
"avatar": { "from": "#FF9A62", "to": "#F0436E", "url": "https://pub-0123456789abcdef.r2.dev/agents/6a2f/avatar/7.webp" },
"accent": "#F76B1C",
"language": "ar-DZ",
"greeting": "السلام عليكم، معاك متجر لمسة. نتصل بيك باش نأكدو الطلبية تاعك، عندك دقيقة؟"
}{
"error": "This agent is not available"
}Returns what anyone may see of a published agent: its name, description, picture and colours, language and greeting. Use it to build your own call button in the agent's look and language before any call starts. It needs no key and is free. Nothing of the agent's instructions, knowledge or tools is ever returned.
The SDK reads it with fetchAgent(), and the widget element builds itself from it. Responses are cached for 60 seconds. Each IP address can read 120 profiles a minute.
Path
The agent's public id, from its Publish page: 12 lowercase letters and digits, such as k3x9m2p7q4wz.
Response
application/jsonThe agent's name.
Its one-line description, or "".
The agent's look: from and to, its two colours as #RRGGBB (for a gradient), and url, its picture: a square 512×512 WebP, or "" when it has none. Show the picture over the gradient, so the colours fill in while it loads.
The button colour chosen on Publish, as #RRGGBB.
The one language the agent speaks: ar-DZ, ar-TN, ar-MA, ar-LY, ar, fr or en. See Languages & Dialects.
The agent's fixed first message, which you can show before the call starts. It's "" when the agent writes its own opening or waits for the caller.
Errors
| Status | Error | When |
|---|---|---|
404 | This agent is not available | No agent has this id, the agent is a draft, or its link and widget are turned off |
429 | RATE_LIMITED | This IP address read too many profiles this minute |
503 | MAINTENANCE (in code) | Voice213 is down for maintenance |
Was this page helpful?