All guides

REST API Reference

Complete reference for the Panacea REST API — authentication, endpoints, request and response formats.

2 min read323 words

The Panacea REST API lets you integrate AI-powered Q&A, wiki management, and session handling into your own applications.

Base URL

https://panacea.aevr.online/api/v1

Authentication

Include your API key in the Authorization header:

Authorization: Bearer pk_live_xxxxxxxxxxxx

Widget sessions use a short-lived JWT issued by POST /api/v1/auth/widget-token — not a static API key.

Error format

{
  "error": "NOT_FOUND",
  "message": "Session not found"
}

Sessions

POST /sessions

Create a new conversation session.

Response includes: sessionId, ownership (ai | pending_handover | human | closed)

GET /sessions/:id

Get session details including current ownership and turn count.

POST /sessions/:id/messages

Send a customer message and receive an AI response.

{ "content": "How do I reset my password?" }

Response:

{
  "answer": "To reset your password...",
  "sources": [{ "path": "auth/password-reset", "confidence": 0.91 }],
  "confidence": 0.91
}

GET /sessions/:id/messages

Get all turns (messages) in a session.

POST /sessions/:id/escalate

Manually escalate a session to a human agent.

{ "reason": "Customer requested human support" }

POST /sessions/:id/reaction

Submit a reaction to the most recent AI response.

{ "reaction": "thumbs_up" }

Valid values: "thumbs_up" | "thumbs_down" | "flag" | "copy".

POST /sessions/resume

Resume a previous session within the session resume window.


Wiki

GET /wiki

List wiki entries. Supports ?q= for full-text search, ?page=, ?limit= (max 100).

GET /wiki/:path

Get a single entry by path.

POST /wiki

Create a wiki entry. Requires admin or trainer role.

{
  "path": "billing/refund-policy",
  "title": "Refund Policy",
  "content": "We offer...",
  "visibility": "public"
}

visibility is "internal" by default.

PATCH /wiki/:path

Update fields on an existing entry.

DELETE /wiki/:path

Delete an entry. Returns 204 No Content.


Ingest

POST /ingest

Submit a URL or raw text for AI processing into the wiki.

{ "url": "https://docs.example.com/getting-started" }

Or raw text:

{
  "text": "Our refund policy...",
  "pathPrefix": "docs/billing"
}

Response: 202 Accepted


Escalation / Inbox

GET /inbox

List escalated sessions. Filter with ?status=pending|claimed|resolved|closed.

POST /inbox/takeover

Claim the next available pending escalation.

GET /inbox/:escalationId

Get escalation details.

POST /inbox/:escalationId/message

Send a message from an agent to the customer.

{ "content": "Hi! I am here to help." }

POST /inbox/:escalationId/handback

Hand the session back to the AI agent.

POST /inbox/:escalationId/resolve

Mark an escalation as resolved.


Analytics

GET /analytics?days=N

Retrieve aggregated performance metrics. N defaults to 30, max 90.

Response (Tier 1, all plans):

{
  "containmentRate": 0.84,
  "escalationRate": 0.16,
  "totalSessions": 1204,
  "totalQueries": 3891,
  "kbCoverageScore": 0.88,
  "avgLatencyMs": 420
}

Pro plan adds reactions.helpfulRate, flaggedForReviewRate, and avgHumanHandleTimeMs.

GET /analytics/kb-gaps

Returns queries that had no matching wiki entry — useful for prioritising what to ingest.


Health

GET /health

Returns system status and the most recent run result per agent.


Webhooks

GET /webhooks

List registered webhook endpoints.

POST /webhooks

Register a new webhook. Requires admin or trainer role.

{
  "url": "https://your-server.example.com/panacea-hook",
  "events": ["handover.requested", "entry.updated"],
  "secret": "your-signing-secret"
}

Related guides