API
The API channel gives you a headless endpoint with no built-in UI. You send messages and receive responses over HTTP. Use it when building custom chat interfaces, mobile apps, or backend-to-backend integrations.
Setup
- Go to Agents in the dashboard
- Click Add Agent and select API
- Copy the agent slug
Making requests
Send a message to your agent:
bash
curl -X POST https://help-api.trypillar.com/api/public/chat/ \-H "x-agent-slug: your-agent-slug" \-H "Content-Type: application/json" \-d '{"message": "How do I upgrade my plan?","conversation_id": "conv_abc123"}'
Omit conversation_id to start a new conversation. Include it to continue an existing one.
Channel settings
Configured in the dashboard under Agents > [your agent] > Channel Settings.
| Setting | Description | Default |
|---|---|---|
| Streaming Enabled | Return responses as a Server-Sent Events stream | Off |
| Response Format | Output format: Markdown, HTML, or Plain Text | Markdown |
Identity
API agents pass user identity directly in the request. There is no linking step — you already know who the user is.
bash
curl -X POST https://help-api.trypillar.com/api/public/chat/ \-H "x-agent-slug: your-agent-slug" \-H "Content-Type: application/json" \-d '{"message": "What is my current plan?","external_user_id": "user_7842"}'
The agent's tools receive external_user_id in the caller context, so they can look up the user's account.
Streaming
When streaming is enabled, responses arrive as Server-Sent Events:
event: token
data: {"content": "You can "}
event: token
data: {"content": "upgrade your plan "}
event: token
data: {"content": "in Settings > Billing."}
event: done
data: {"sources": [...]}
Next steps
- Setting Up Tools — Configure tools for your agent
- Confirmation Flows — Handle confirmation prompts in your custom UI