C
Chatty

Analytics Summary

GET/api/v1/analytics

Returns aggregated metrics — message counts, session counts, lead counts, and knowledge base size — for the bot.

Required scope: read

Query parameters

sincestringquery

ISO 8601 datetime string. Only messages/leads on or after this timestamp are counted. Omit it (or pass nothing) for lifetime totals — there's no default 30-day window.

Example: 2026-07-01T00:00:00Z

Response

bot_idstring
The bot this summary is for.
sincestring
Echoes back the since filter you passed, or null if omitted.
total_messagesinteger
All messages (user + assistant) in the period.
user_messagesinteger
Messages sent by visitors.
bot_messagesinteger
Messages sent by the assistant.
unique_sessionsinteger
Distinct conversation sessions in the period.
total_leadsinteger
Leads captured by the bot in the period.
knowledge_sourcesinteger
Total knowledge sources currently attached to the bot (not filtered by since).
knowledge_kbinteger
Total size of the knowledge base, in kilobytes (not filtered by since).

Examples

Lifetime totals
curl "https://api.chatty.personaliai.com/api/v1/analytics" \
  -H "Authorization: Bearer chatty_sk_your_key"
Since July 1
curl "https://api.chatty.personaliai.com/api/v1/analytics?since=2026-07-01T00:00:00Z" \
  -H "Authorization: Bearer chatty_sk_your_key"

200 OK:

{
  "bot_id": "a1b2c3d4-...",
  "since": "2026-07-01T00:00:00Z",
  "total_messages": 4821,
  "user_messages": 2410,
  "bot_messages": 2411,
  "unique_sessions": 962,
  "total_leads": 147,
  "knowledge_sources": 12,
  "knowledge_kb": 340
}

Notes

  • Counts reflect the database at request time — there's no caching delay.
  • There's no separate per-day/hourly breakdown endpoint — call this repeatedly with different since values if you need a time series.