Gaius-Lex API
Welcome to the documentation of the Gaius-Lex API, an AI platform for legal analysis.
Overview
The Gaius-Lex API groups its endpoints into these categories:
- Documents - Uploading and reading organization documents (
/api/v1/upload,/api/v1/external/documents/{file_id}) - Search - Searching legal sources (
/api/v1/search,/api/v1/available-sources) - Answer - Answers to legal questions, optionally simplified; webhook and polling modes (
/api/v1/answer) - OCR - Asynchronous text recognition (
/api/v1/ocr/poll) - Anonymization - Synchronous text anonymization (
/api/v1/anonymization) - Document Verification - Asynchronous verification of citations and sources (
/api/v1/doc-verification/poll) - Contract Analysis - Abusive clauses, theses and rule compliance (
/api/v1/abusivity,/api/v1/theses-analysis,/api/v1/alignment,/api/v1/rule-analysis/poll) - Company Registry - KRS and NIP lookups (
/api/v1/krs,/api/v1/krs-text-analysis,/api/v1/krs-agreement) - API Keys - Managing the organization's API keys (
/core_api/api-key/create)
The legal agent is described in the Agent API (v2) folder of the API reference (/api/v2/chat-sessions).
Authentication
Every endpoint requires the Authorization header:
Authorization: Api-Key <YOUR_API_KEY>
Most endpoints return 401 when the API key is missing or invalid.
Base URL
https://api.gaius-lex.pl
How it works
Most endpoints are asynchronous (webhook + polling):
- Send a POST request to the main endpoint (e.g.
POST /api/v1/answer) or to itspollendpoint (e.g.POST /api/v1/answer/poll). - You receive a
request_id(status 202). - Poll
GET .../poll/{request_id}. - Read the result (status 200).
Synchronous endpoints (POST /api/v1/anonymization, KRS lookups) return the result immediately.
Agent API (v2)
The legal agent works in chat sessions, with the same API key:
POST /api/v2/chat-sessions/creates a session. Withfirst_turnit also starts the agent and returns202;active_turn_idis the running turn.GET /api/v2/chat-sessions/{session_id}/turns/{turn_id}/eventsstreams the turn's progress as server-sent events. Each event carries the complete current version of a message or of the turn. After a dropped connection, resume with theLast-Event-IDheader.POST /api/v2/chat-sessions/{session_id}/turnssends the next message. Answer a question from the agent through.../questions/{message_id}/answers, or reject it through.../reject.
GET /api/v2/chat-sessions/{session_id} returns the whole session history. Sessions belong to the API key that created them.
Get started
Go to the API reference or to the Agent API (v2) for the details of every endpoint.