Contracts API
Create, manage, and AI-draft legal contracts.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /contracts | List all contracts |
POST | /contracts | Create a contract |
GET | /contracts/:id | Get contract details |
PUT | /contracts/:id | Update a contract |
DELETE | /contracts/:id | Delete a contract |
POST | /contracts/:id/draft-ai | AI-draft contract content |
POST | /contracts/:id/analyze | AI risk analysis |
List Contracts
GET /api/v1/contracts?page=1&page_size=20&status=draftQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
page | int | Page number (default: 1) |
page_size | int | Items per page (default: 20) |
status | string | Filter: draft, active, completed, expired |
type | string | Filter: nda, service_agreement, employment, etc. |
search | string | Search by title or counterparty |
Response:
{
"contracts": [
{
"id": "c3f8a1b2-...",
"title": "NDA - Acme Corp",
"type": "nda",
"status": "draft",
"counterparty": "Acme Corporation",
"risk_score": 35,
"created_at": "2026-03-08T12:00:00Z"
}
],
"total": 42,
"page": 1,
"page_size": 20
}Create Contract
POST /api/v1/contractsRequest Body:
{
"title": "NDA - Acme Corp",
"type": "nda",
"counterparty": "Acme Corporation",
"party_name": "My Company LLC",
"content": "Optional pre-existing content",
"vendor_id": "optional-vendor-uuid"
}| Field | Type | Required | Description |
|---|---|---|---|
title | string | ✅ | Contract title |
type | string | — | nda, service_agreement, employment, consulting, lease |
counterparty | string | — | Other party name |
party_name | string | — | Your party name |
content | string | — | Pre-existing content (if not AI-drafting) |
vendor_id | string | — | Link to existing vendor |
AI Draft
Generate contract content using AI.
POST /api/v1/contracts/:id/draft-ai{
"prompt": "Draft a standard mutual NDA for a 2-year software development partnership",
"party_name": "My Company LLC"
}Response: Returns the updated contract with AI-generated content.
AI drafting uses GPT-5.1 by default. Complex multi-document analysis may use GPT-5.4 for higher accuracy.
AI Risk Analysis
Analyze a contract for risks, missing clauses, and compliance issues.
POST /api/v1/contracts/:id/analyzeResponse:
{
"risk_score": 65,
"analysis": {
"risk_level": "medium",
"key_risks": [
{
"clause": "Indemnification",
"risk": "Unlimited liability exposure",
"recommendation": "Add a cap on indemnification at 2x contract value"
}
],
"missing_clauses": ["Force Majeure", "Data Protection"],
"compliance_flags": ["GDPR Article 28 - Missing DPA reference"]
}
}Update Contract
PUT /api/v1/contracts/:id{
"title": "Updated Title",
"status": "active",
"content": "Updated contract content..."
}Delete Contract
DELETE /api/v1/contracts/:idReturns 204 No Content on success.