Search documentation

Search documentation

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

  1. Go to Agents in the dashboard
  2. Click Add Agent and select API
  3. 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.

SettingDescriptionDefault
Streaming EnabledReturn responses as a Server-Sent Events streamOff
Response FormatOutput format: Markdown, HTML, or Plain TextMarkdown

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