Send a Message
/api/v1/chatSend a message to your bot and get an AI reply based on its knowledge base, guardrails, and language settings. The bot maintains full conversation history within a session_id.
Required scope: chat
Request body
textstringbodyrequiredThe user's message. Max 4,000 characters. Control characters are stripped automatically.
session_idstringbodyConversation thread identifier. Omit to start a new session — the generated ID is returned in the response. Reuse the same ID to continue an existing conversation.
visitor_timezonestringbodydefault: UTCIANA timezone of the visitor (e.g. "America/New_York"). Used by the bot for time-sensitive questions.
Response
replystringThe bot's text reply.
session_idstringThe session ID. Pass this back in your next request to continue the thread.
Examples
curl -X POST https://api.personaliai.com/api/v1/chat \
-H "Authorization: Bearer chatty_sk_your_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Do you offer a free trial?",
"session_id": "visitor-xyz-789",
"visitor_timezone": "America/Chicago"
}'import httpx
r = httpx.post(
"https://api.personaliai.com/api/v1/chat",
headers={"Authorization": "Bearer chatty_sk_your_key"},
json={"text": "Do you offer a free trial?", "session_id": "visitor-xyz-789"},
)
print(r.json()["reply"])const res = await fetch(
"https://api.personaliai.com/api/v1/chat",
{
method: "POST",
headers: {
Authorization: "Bearer chatty_sk_your_key",
"Content-Type": "application/json",
},
body: JSON.stringify({ text: "Do you offer a free trial?", session_id: "visitor-xyz-789" }),
}
);
const { reply, session_id } = await res.json();body, _ := json.Marshal(map[string]string{
"text": "Do you offer a free trial?",
"session_id": "visitor-xyz-789",
})
req, _ := http.NewRequest("POST",
"https://api.personaliai.com/api/v1/chat",
bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer chatty_sk_your_key")
req.Header.Set("Content-Type", "application/json")200 OK:
{
"reply": "Yes! We offer a 14-day free trial on all paid plans — no credit card required.",
"session_id": "visitor-xyz-789"
}To reset a conversation, call DELETE /api/v1/conversations/{session_id} — the next message with the same session_id starts fresh.