⚖️ Chantal API

Rwanda Legal AI — REST API Documentation v2.1

Authentication

All authenticated endpoints require a Bearer token in the Authorization header. Tokens are obtained via Supabase Auth (Google OAuth or email/password).

API key authentication is also supported via the X-API-Key header for programmatic access.

Authorization: Bearer YOUR_SUPABASE_JWT
// or
X-API-Key: cha_YOUR_API_KEY
⚡ Rate Limits: Free tier: 50 requests/day · Premium: 500/day · API keys: 100/hour (configurable)

Chat

POST /api/chat Auth Required
Send a message to Chantal and receive a streamed SSE response.
messagestringThe user's message (required)
sessionIdstringConversation session ID (required)

Conversations

GET /api/conversations Auth
List user's conversations with pagination and search.
pagenumberPage number (default: 1)
limitnumberItems per page (default: 20, max: 50)
qstringSearch query (matches title)
categorystringFilter: research, draft, case, general

Legal Corpus

GET /api/corpus Public
Search and browse the Rwandan legal corpus. Full-text search supported.
qstringFull-text search query
categorystringFilter: constitution, criminal, civil, commercial, labor, land, tax, family
pagenumberPage (default: 1)
limitnumberItems (default: 20, max: 50)
GET /api/corpus/:id Public
Get full content of a legal document by ID.

Teams

POST /api/teams Auth
Create a new team/firm account.
namestringTeam name (min 2 chars)
GET /api/teams Auth
List user's teams and memberships.
GET /api/teams/:id Auth
Get team details, members, and pending invites.
POST /api/teams/:id/invite Auth (Owner)
Invite a member by email. Generates a token valid for 7 days.
emailstringInvite recipient email
rolestringadmin or member (default: member)
POST /api/teams/join Auth
Accept a team invite.
tokenstringInvite token from email
DELETE /api/teams/:id/members/:memberId Auth (Owner)
Remove a member from the team.

API Keys

POST /api/keys Auth
Generate a new API key. The raw key is returned only once — save it immediately.
namestringKey name (default: "Default Key")
scopesstring[]Permissions: chat, corpus (default: both)
GET /api/keys Auth
List your API keys (prefix only — full key is not retrievable).
DELETE /api/keys/:id Auth
Revoke an API key. Max 5 active keys per user.

Health & Status

GET /api/health Public
Detailed health check — API, database, AI gateway connectivity, memory, uptime.
GET /api/status Public
Service status with component breakdown for public status page.

Quick Start

Search the legal corpus

curl https://chantal-api.ikanisa.com/api/corpus?q=criminal+law&category=criminal

Chat with Chantal (requires auth)

curl -X POST https://chantal-api.ikanisa.com/api/chat \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message":"What are bail provisions in Rwanda?","sessionId":"my-session-1"}'

Generate an API key

curl -X POST https://chantal-api.ikanisa.com/api/keys \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"My Integration","scopes":["chat","corpus"]}'