| POST | /api/refine | Sends your Prompt Studio form to the AI and streams the refined prompt back as it generates. | Sign-in |
| GET | /api/prompts/history | Returns the prompts you've saved in this workspace, newest first, paged at 100. | Sign-in |
| POST | /api/prompts/history | Saves a freshly generated prompt to your workspace so you can re-open or iterate on it later. | Sign-in |
| DELETE | /api/prompts/history/[id] | Removes a single saved prompt from your workspace. Other workspaces' prompts are not addressable here. | Sign-in |
| GET | /api/agents | Lists the agents you've created in this workspace. | Sign-in |
| POST | /api/agents | Creates a new agent with the persona, model, knowledge, and widget settings you choose. | Sign-in |
| GET | /api/agents/[id] | Returns the full configuration for one of your agents. | Sign-in |
| PATCH | /api/agents/[id] | Updates settings on one of your agents — system prompt, colors, channels, tools, anything editable. | Sign-in |
| DELETE | /api/agents/[id] | Deletes the agent and every related record (knowledge, conversations, contacts, sessions) in one operation. | Sign-in |
| GET | /api/agents/analytics | Aggregated session, message, contact, channel, and conversion counts for your workspace. | Sign-in |
| GET | /api/widget/[token] | Returns the embeddable chat widget as JavaScript. Loaded by the <script> tag on your website. | Public |
| POST | /api/agent/[token]/chat | The visitor sends a message; the agent reads its knowledge base and streams a reply back. | Public |
| POST | /api/agent/[token]/lead | Saves a visitor's name, email, or phone when they choose to share it. Also fires your lead webhook. | Public |
| POST | /api/agent/[token]/handoff | Visitor asks for a human; fires your handoff webhook with the full transcript attached. | Public |
| POST | /api/agent/[token]/csat | Captures the visitor's satisfaction rating (0–5) at the end of a conversation. | Public |