For developers

173 API endpoints. Built like an OS.

LexPrime OS exposes a comprehensive REST API across AI tools, case management, trust accounting, payments, communications, the client portal, and 12 SA practice-area modules. All AI runs on local Ollama — no client data leaves SA jurisdiction.

173

Total endpoints

27

AI endpoints

11

Categories

12

Practice modules

Quick start

LexPrime OS is a Next.js application — the API lives under /api/ (or /demo/api/ on the demo). All endpoints accept and return JSON.

Base URL (self-hosted):

https://yourfirm.lexprime.co.za/demo/api

Authentication (firm-side):

POST /auth/login
Content-Type: application/json

{
  "email": "attorney@yourfirm.co.za",
  "password": "your-password"
}

# Response: { "success": true, "user": { "id": "...", "role": "attorney" } }
# The user ID is then passed as ?userId=xxx on subsequent calls

Example — draft a document with AI:

POST /ai/draft
Content-Type: application/json

{
  "caseId": "cmqgdtdr...",
  "docType": "summons",
  "instructions": "RAF claim, rear-end collision, moderate whiplash"
}

# Response: { "document": "IN THE HIGH COURT OF SOUTH AFRICA...", "docType": "summons" }
# Runs on local Ollama — no data sent to external APIs

Auth model

Email + password (bcrypt 12 rounds). 2FA via TOTP/SMS/email optional. Role-based access control enforced per-endpoint. Client portal uses separate portal auth.

AI runs locally

All 27 AI endpoints call Ollama at 127.0.0.1:11434. No external API calls. Client data never leaves your server. POPIA Section 72 compliant by design.

Self-hosted

Deployed on your SA VPS. SQLite for demo; PostgreSQL recommended for production. PM2 process manager. Apache or Nginx reverse proxy. Full data sovereignty.

Endpoint reference

All 173 endpoints by category

Click a category to expand. Each endpoint shows HTTP method, path, description, and auth requirement.

Authentication & Users
10 endpoints

Login, registration, password reset, user management, 2FA, sessions.

POST
/auth/loginAuthenticate user with email + password
Public
POST
/auth/registerRegister a new user (admin only)
Auth required
GET
/auth/meGet current user profile
Auth required
POST
/auth/forgot-passwordTrigger password reset email
Public
POST
/auth/reset-passwordReset password with token
Public
GETPOST
/auth/usersList or create users (admin only)
Auth required
GETPUTDELETE
/auth/users/[id]Get, update, or delete a user
Auth required
POST
/auth/users/[id]/deleteSoft-delete a user (preserve audit trail)
Auth required
GETPOST
/2faGet 2FA status or enable 2FA (TOTP/SMS/email)
Auth required
POST
/2fa/verifyVerify 2FA code and complete login
Auth required
AI Toolkit (21 endpoints)
27 endpoints

All 21 AI features. Each runs on local Ollama — no client data leaves SA. AI must be enabled in settings.

POST
/aiGeneral AI chat endpoint (system prompt + user message)
Auth required
POST
/ai/draftDraft a legal document (summons, pleading, affidavit, etc.)
Auth required
POST
/ai/searchNatural-language legal search across knowledge base
Auth required
POST
/ai/summarizeGenerate AI case summary
Auth required
POST
/ai/timelineBuild chronological timeline of case events
Auth required
POST
/ai/deadlinesExtract prescription and filing deadlines from documents
Auth required
POST
/ai/riskAssess factual, legal, and procedural risks in a case
Auth required
POST
/ai/next-stepsGenerate recommended action items for a case
Auth required
POST
/ai/client-commDraft client communications (updates, demands, reminders)
Auth required
POST
/ai/document-compareCompare two documents with risk-aware diff
Auth required
POST
/ai/medical-summarySummarise medical records for RAF / personal injury
Auth required
POST
/ai/judgmentAnalyse court judgment — extract holdings and principles
Auth required
POST
/ai/judge-analyticsAnalyse judge tendencies and historical success rates
Auth required
POST
/ai/precedentFind similar cases in firm database
Auth required
POST
/ai/contract-reviewAI contract analysis — risks, obligations, key dates
Auth required
POST
/ai/predictivePredict case outcome based on historical data
Auth required
POST
/ai/settlementEstimate settlement value based on case parameters
Auth required
POST
/ai/compliancePOPIA / FICA / trust accounting compliance audit on text
Auth required
POST
/ai/conflict-checkConflict-of-interest check against firm client database
Auth required
POST
/ai/memoGenerate structured legal memo (issues, analysis, recommendations)
Auth required
POST
/ai/intakeAI-assisted matter intake — extract parties, facts, claims
Auth required
POST
/ai/estimateEstimate matter complexity and billable hours
Auth required
POST
/ai/time-trackingAI-categorised time tracking for billable activities
Auth required
POST
/ai/bulk-importAI-categorise bulk document uploads
Auth required
POST
/ai/bulk-import/confirmConfirm and persist bulk-import categorisation
Auth required
GET
/ai/modelsList available Ollama models
Auth required
POST
/ai/testTest Ollama connection and model response
Auth required
Cases & Matters
9 endpoints

Case management — create, update, list, search. Includes court dates, notes, tasks, experts, documents, settlements, trust transactions.

GETPOST
/casesList cases (with filters) or create a new case
Auth required
GETPUTDELETE
/cases/[id]Get, update, or archive a case
Auth required
GETPOST
/cases/[id]/notesCase notes (chronological)
Auth required
GETPOST
/cases/[id]/tasksTasks linked to a case
Auth required
GETPOST
/cases/[id]/court-datesCourt dates and hearing schedule
Auth required
GETPOST
/cases/[id]/documentsDocuments linked to a case
Auth required
GETPOST
/cases/[id]/expertsExpert witnesses linked to a case
Auth required
GETPOST
/cases/[id]/settlementsSettlement offers and negotiations
Auth required
GET
/cases/[id]/trustTrust transactions for a case
Auth required
Practice-Area Modules
23 endpoints

Specialised endpoints for each of the 12 SA practice-area modules.

GETPOST
/conveyancingConveyancing matters — list or create
Auth required
GETPUT
/conveyancing/[id]Get or update a conveyancing matter
Auth required
GETPOST
/conveyancing/[id]/milestonesTransfer milestones (deeds office workflow)
Auth required
GETPOST
/litigationLitigation matters — list or create
Auth required
GETPUT
/litigation/[id]Get or update a litigation matter
Auth required
GETPOST
/family-lawFamily law matters (divorce, custody, maintenance)
Auth required
GETPUT
/family-law/[id]Get or update a family law matter
Auth required
GETPOST
/labourLabour / CCMA matters
Auth required
GETPUT
/labour/[id]Get or update a labour matter
Auth required
GETPOST
/criminalCriminal law matters (dockets, bail, appearances)
Auth required
GETPUT
/criminal/[id]Get or update a criminal matter
Auth required
GETPOST
/corporateCorporate / commercial matters
Auth required
GETPUT
/corporate/[id]Get or update a corporate matter
Auth required
GETPOST
/estatesWills & estates matters
Auth required
GETPUT
/estates/[id]Get or update an estates matter
Auth required
GETPOST
/immigrationImmigration matters (visas, DHA)
Auth required
GETPUT
/immigration/[id]Get or update an immigration matter
Auth required
GETPOST
/ipIntellectual property matters (CIPC / WIPO)
Auth required
GETPUT
/ip/[id]Get or update an IP matter
Auth required
GETPOST
/maritimeMaritime / admiralty matters
Auth required
GETPUT
/maritime/[id]Get or update a maritime matter
Auth required
GETPOST
/collectionsCollections matters (s129, EAO)
Auth required
GETPUT
/collections/[id]Get or update a collections matter
Auth required
Documents & Templates
8 endpoints

Document management, versioning, OCR, AI template generation.

GETPOST
/documentsList or upload documents
Auth required
GETPUTDELETE
/documents/[id]Get, update, or delete a document
Auth required
GETPOST
/documents/[id]/versionsDocument version history
Auth required
GET
/documents/versionsList all versions across documents
Auth required
POST
/documents/generateGenerate a document from a template
Auth required
GETPOST
/document-templatesList or create document templates
Auth required
GETPUTDELETE
/document-templates/[id]Get, update, or delete a template
Auth required
POST
/document-templates/[id]/generateGenerate a document from a specific template
Auth required
Trust Accounting & Banking
11 endpoints

Trust transactions, bank accounts, reconciliation, accounting exports (Pastel / Sage compatible).

GETPOST
/bank-accountsList or add bank accounts
Auth required
GETPUTDELETE
/bank-accounts/[id]Get, update, or delete a bank account
Auth required
GETPOST
/bank-accounts/[id]/transactionsBank transactions for an account
Auth required
GETPOST
/reconciliationReconciliation batches
Auth required
GETPOST
/accounting-exportsList or create accounting exports
Auth required
POST
/accounting-exports/[id]/generateGenerate CSV export (Sage / Xero / Pastel format)
Auth required
GETPOST
/billingBilling records
Auth required
GETPOST
/invoicesInvoices — list or create
Auth required
GETPUT
/invoices/[id]Get or update an invoice
Auth required
GETPOST
/expensesExpenses — list or create
Auth required
GETPUTDELETE
/expenses/[id]Get, update, or delete an expense
Auth required
Payments
10 endpoints

SA payment gateway integration — PayFast, Ozow, Yoco. AI allocation of payments to matters.

GETPOST
/paymentsList payments or record a manual payment
Auth required
POST
/payments/initiateInitiate a gateway payment (PayFast/Ozow/Yoco)
Auth required
GETPOST
/payments/gatewaysList or configure payment gateways
Auth required
POST
/payments/webhook/payfastPayFast webhook handler (signature verified)
Public
POST
/payments/webhook/ozowOzow webhook handler (signature verified)
Public
GETPOST
/payments/proofPayment proof uploads
Auth required
GETDELETE
/payments/proof/[id]Get or delete a payment proof
Auth required
GET
/payments/proof/listList payment proofs (with filters)
Auth required
POST
/payments/ai-allocateAI-allocate a payment to matter(s)
Auth required
GET
/payments/portal-invoicesPortal-side invoice list (for clients)
Portal auth
Communications
11 endpoints

WhatsApp, email, internal notes. Centralised inbox with case auto-linking.

GETPOST
/communicationsList or log a communication
Auth required
GETPOST
/whatsappWhatsApp integration status and outbound messages
Auth required
POST
/whatsapp/webhookInbound WhatsApp webhook (from gateway)
Public
GETPOST
/emailEmail integration — list or send
Auth required
GET
/email/messagesEmail messages with filters
Auth required
POST
/email/fetchFetch new emails from IMAP
Auth required
GETPOST
/matter-chat/[caseId]/messagesTeam chat messages for a matter
Auth required
POST
/matter-chat/[caseId]/pinPin a chat message
Auth required
POST
/matter-chat/[caseId]/reactionsAdd a reaction to a chat message
Auth required
GETPOST
/chatInternal chat — list or send
Auth required
GETPOST
/chat/[id]/messagesMessages in a chat thread
Auth required
Client Portal
10 endpoints

Client-facing portal — cases, documents, invoices, payments, communications.

POST
/portal/authClient portal login
Public
GET
/portal/casesCases visible to the logged-in client
Portal auth
GET
/portal/documentsDocuments shared with the client
Portal auth
GET
/portal/communicationsCommunications with the client
Portal auth
GETPOST
/portal/messagesClient-firm secure messaging
Portal auth
GET
/portal/paymentsClient's invoices and payment history
Portal auth
POST
/portal/forgot-passwordClient portal password reset
Public
GETPOST
/portal-uploadsDocuments uploaded by client via portal
Portal auth
POST
/portal-uploads/[id]/reviewFirm reviews a client-uploaded document
Auth required
GET
/portal-activityAudit log of client portal activity
Auth required
Compliance & Risk
8 endpoints

FICA verification, e-signatures, prescription alerts, conflict checks.

GETPOST
/ficaFICA records — list or create
Auth required
GETPUT
/fica/[id]Get or update a FICA record
Auth required
POST
/fica/[id]/verifyMark FICA record as verified
Auth required
GETPOST
/signing-requestsE-signature requests — list or create
Auth required
GETPUT
/signing-requests/[id]Get or update a signing request
Auth required
GETPOST
/prescription-alertsPrescription deadline alerts
Auth required
GETPUT
/prescription-alerts/[id]Get or update a prescription alert
Auth required
POST
/prescription-alerts/checkRun prescription check across all matters
Auth required
Other Modules
28 endpoints

Workflow automation, notifications, leads, reports, search, system settings.

GETPOST
/workflowsWorkflow rules — list or create
Auth required
GETPUTDELETE
/workflows/[id]Get, update, or delete a workflow
Auth required
GETPOST
/tasksTasks — list or create
Auth required
GETPUTDELETE
/tasks/[id]Get, update, or delete a task
Auth required
GETPOST
/leadsLeads (CRM pipeline) — list or create
Auth required
GETPUT
/leads/[id]Get or update a lead
Auth required
POST
/leads/[id]/convertConvert a lead to a client + matter
Auth required
GETPOST
/expertsExpert witnesses — list or create
Auth required
GETPUTDELETE
/experts/[id]Get, update, or delete an expert
Auth required
GET
/notificationsUser notifications
Auth required
POST
/notifications/[id]/readMark a notification as read
Auth required
POST
/notifications/read-allMark all notifications as read
Auth required
GET
/alertsSystem alerts (prescription, deadlines, etc.)
Auth required
GET
/reportsStandard reports
Auth required
GET
/reports/advancedAdvanced analytics and custom reports
Auth required
POST
/searchGlobal search across cases, clients, documents
Auth required
POST
/search/advancedAdvanced search with multiple filters
Auth required
GETPUT
/settingsSystem settings (firm name, branding, etc.)
Auth required
PUT
/settings/themeUpdate theme (light/dark, colors)
Auth required
POST
/settings/logoUpload firm logo
Auth required
GETPUT
/modulesGet or toggle module activation
Auth required
GETPOST
/client-updatesClient status updates
Auth required
POST
/client-updates/broadcastBroadcast update to multiple clients
Auth required
GETPUT
/receptionistAI receptionist settings
Auth required
GET
/superadminSuper admin panel data (superadmin only)
Auth required
GET
/gatewayPayment gateway status
Auth required
GET
/sseServer-sent events stream (real-time updates)
Auth required
GET
/sse/eventsSSE event stream (alternative endpoint)
Auth required

Multi-tenant API (roadmap)

The current API is self-hosted per firm — each customer runs their own instance. A hosted multi-tenant API at api.lexprime.co.za/v1with OAuth2, per-firm rate limiting, and webhook subscriptions is on the 2027 roadmap. If you're an IT consultant or systems integrator evaluating LexPrime for multiple firms,email us— we want to talk.

Want to integrate with LexPrime OS?

Whether you're an IT consultant recommending legal software, a developer building a complementary tool, or a firm with custom integration needs — we'd love to talk.