The API channel lets you query your agent from your own code. Instead of using a pre-built UI like the widget or Telegram AI agent, you send questions to the API and get answers back — giving you full control over how and where the agent appears.
When to use the API channel
The API channel is useful when you want to:
- Embed the agent in a mobile app with your own custom UI
- Integrate the agent into an existing product or flow
- Use the agent as part of an automation pipeline
- Build something the other channels don't support
Setting up the channel
Go to your agent → Channels tab → Add Channel → API.
Give it a name and click Add Channel. That's it — the channel is created and assigned a channel ID.
Getting your API key
Go to API Keys in the sidebar. Create a new API key if you don't have one already. This key authenticates your requests.
Keep your API key secret — don't expose it in frontend JavaScript or public repositories.
Making requests
Send a POST request to the Vosaire API with your message and session ID:
POST https://api.vosaire.com/api/chat
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"channel_id": "your-channel-uuid",
"session_id": "unique-session-per-user",
"message": "What is your refund policy?"
}
The session_id is how Vosaire tracks conversation context — use a consistent ID per user or conversation so the agent remembers previous messages in the thread. A UUID per user session works well.
Response:
{
"reply": "Our refund policy allows returns within 30 days of purchase...",
"conversation_id": "conv_abc123",
"sources": [...]
}
Handling conversation history
The API maintains conversation context server-side — as long as you use the same session_id, the agent will remember the previous turns in the conversation. You don't need to send message history in each request.
Rate limits
Rate limits depend on your plan. If you hit a rate limit, the API returns a 429 status. Implement exponential backoff in your integration to handle this gracefully.