Docgic Logo Light
REST API

Contract Intelligence API

Analyze, score, and generate contracts programmatically. Simple authentication, credit-based billing.

Quick Start

Terminal
# Analyze a contract
curl -X POST https://docgic.com/api/v1/contracts/analyze \
  -H "X-Api-Key: dg_live_abc123" \
  -H "Content-Type: application/json" \
  -d '{"contract_text": "This Non-Disclosure Agreement..."}'
Response — 200 OK
{
  "risk_score": 67,
  "confidence": 0.89,
  "confidence_interval": [58, 76],
  "risk_flags": [
    {
      "clause": "non_compete",
      "severity": "high",
      "message": "Unusually broad non-compete scope"
    }
  ],
  "missing_clauses": ["governing_law"],
  "recommendations": [
    "Add governing law clause — 94% include this"
  ]
}

Authentication

1. Sign up

Create a free account at docgic.com/register

2. Generate API key

Go to Dashboard → Developer → Generate Key

3. Start calling

Pass your key in the X-Api-Key header

Header format
X-Api-Key: dg_live_xxxxx

Credit-based billing

Each API call deducts credits from your plan. The free tier includes 50 credits/month. If you run out, requests return 402 Payment Required. Upgrade your plan or purchase additional credits from the dashboard.

Core Endpoints

Three endpoints cover the full analysis pipeline.

POST/api/v1/contracts/analyze5 credits

Full analysis: extracts clauses, computes features, returns risk score, flags, comparables, and actionable recommendations.

Request Body

{
  "contract_text": "This Non-Disclosure Agreement...",
  "type": "nda",
  "jurisdiction": "US-CA",
  "industry": "tech",
  "include_comparables": true
}
FieldTypeDescription
contract_textstring (required)Full contract text. Minimum 100 characters.
typestring (optional)Contract type hint: nda, service_agreement, employment, lease, etc. Auto-detected if omitted.
jurisdictionstring (optional)Jurisdiction code (e.g. US-CA, US-NY, GB). Improves benchmark accuracy.
industrystring (optional)Industry hint: tech, healthcare, finance, real_estate, etc.
include_comparablesboolean (optional)Include similar contracts in response. Default: true.

Response

{
  "risk_score": 67,
  "confidence": 0.89,
  "confidence_interval": [58, 76],
  "risk_flags": [
    { "clause": "non_compete", "severity": "high",
      "message": "Unusually broad non-compete scope" }
  ],
  "missing_clauses": ["governing_law", "force_majeure"],
  "recommendations": [
    "Add governing law clause — 94% include this"
  ],
  "benchmark": { ... },
  "clauses": {
    "has_non_compete": true,
    "has_liability_cap": false,
    "has_governing_law": false,
    "has_indemnity": true
  },
  "detected": {
    "contract_type": "nda",
    "jurisdiction": "US-CA",
    "word_count": 2847,
    "parties": ["Acme Corp", "Jane Doe"]
  },
  "comparables": {
    "results": [...],
    "dataset_size": 10056,
    "dispute_rate_percent": 12.3,
    "insight": "This NDA has higher risk than 72% ..."
  }
}
FieldTypeDescription
risk_scorenumberOverall risk score from 0 (safe) to 100 (high risk).
confidencenumberModel confidence from 0 to 1. Higher means more training data for this contract type.
confidence_interval[number, number]95% confidence interval for the risk score, e.g. [58, 76].
risk_flagsarrayList of flagged issues. Each has clause (string), severity (high/medium/low), and message (string).
missing_clausesstring[]Standard clauses not found in this contract (e.g. governing_law, force_majeure).
recommendationsstring[]Plain-English suggestions to reduce risk.
clausesobjectBoolean map of detected clause types (has_non_compete, has_liability_cap, etc.).
detectedobjectAuto-detected metadata: contract_type, jurisdiction, industry, parties, word_count.
comparablesobject | nullSimilar contracts from the dataset with dispute rates and insights. Null if include_comparables is false.
POST/api/v1/contracts/score2 credits

Core scoring: returns risk score, confidence interval, risk flags, missing clauses, recommendations, and benchmark data.

Request Body

{
  "contract_text": "This Service Agreement...",
  "type": "service_agreement",
  "jurisdiction": "US-NY",
  "industry": "tech"
}
FieldTypeDescription
contract_textstring (required)Full contract text. Minimum 100 characters.
typestring (optional)Contract type hint. Auto-detected if omitted.
jurisdictionstring (optional)Jurisdiction code (e.g. US-NY). Improves benchmark accuracy.
industrystring (optional)Industry hint for better benchmarking.

Response

{
  "risk_score": 42,
  "confidence": 0.91,
  "confidence_interval": [34, 50],
  "risk_flags": [
    { "clause": "liability_cap", "severity": "high",
      "message": "Caps monetary exposure" }
  ],
  "missing_clauses": ["liability_cap", "force_majeure"],
  "recommendations": [
    "Add liability cap — 87% of similar contracts include one"
  ],
  "benchmark": { ... },
  "detected": {
    "contract_type": "service_agreement",
    "jurisdiction": "US-NY",
    "word_count": 4521,
    "parties": ["Acme Corp", "John Smith"]
  }
}
FieldTypeDescription
risk_scorenumberOverall risk score from 0 (safe) to 100 (high risk).
confidencenumberModel confidence from 0 to 1.
confidence_interval[number, number]95% confidence interval for the risk score.
risk_flagsarrayFlagged issues with clause, severity (high/medium/low), and message.
missing_clausesstring[]Standard clauses not found in the contract.
recommendationsstring[]Actionable suggestions to reduce risk.
detectedobjectAuto-detected contract_type, jurisdiction, word_count, and parties.
POST/api/v1/contracts/comparables3 credits

Find similar contracts from the dataset. Returns matching contracts with similarity scores, outcomes, and dispute rates.

Request Body

{
  "contract_text": "This Employment Agreement...",
  "type": "employment",
  "top_k": 5
}
FieldTypeDescription
contract_textstring (required)Full contract text. Minimum 100 characters.
typestring (optional)Contract type hint for better matching.
top_knumber (optional)Number of similar contracts to return. Range: 1-10. Default: 5.

Response

{
  "comparables": [
    {
      "similarity": 0.87,
      "type": "employment",
      "outcome": "disputed",
      "dispute_type": "wrongful_termination"
    }
  ],
  "dataset_size": 10056,
  "dispute_rate_percent": 12.3,
  "verified_dispute_rate_percent": 8.1,
  "insight": "Employment contracts with no non-compete have 15% lower dispute rate"
}
FieldTypeDescription
comparablesarrayList of similar contracts with similarity score (0-1), type, outcome (disputed/successful), and dispute_type.
dataset_sizenumberTotal number of contracts in the benchmark dataset.
dispute_rate_percentnumberPercentage of similar contracts that were disputed.
verified_dispute_rate_percentnumberPercentage with court-verified dispute outcomes.
insightstringPlain-English summary comparing your contract to the dataset.

Additional Endpoints

These endpoints support the full contract workflow.

POST/contracts/chat

Ask questions about a contract in plain English. Returns answers with section references.

POST/contracts/compare

Compare two versions of a contract. Returns a risk-annotated diff with change analysis.

GET/contracts/templates

List available contract templates. Returns template metadata, types, and supported jurisdictions.

Rate Limits & Pricing

Starter

Free

50 credits/month

10 requests/minute

Professional

$29.99/mo

500 credits/month

60 requests/minute

Business

$99.99/mo

2,000 credits/month

120 requests/minute

Enterprise

Custom

Custom volume

Dedicated throughput

SLA guarantee

Built for Enterprise Scale

CLM Integration

Seamlessly integrate with your existing contract lifecycle management tools and workflows.

Volume Processing

Process thousands of contracts simultaneously with dedicated throughput and priority queues.

Custom Risk Models

Train custom risk models tailored to your industry, jurisdiction, and internal policies.

Enterprise-Grade Security

Security Features

  • End-to-end encryption for all documents in transit and at rest
  • Zero data retention — documents are purged after processing
  • Your data is never used for AI training
  • Comprehensive audit logging for all API activity
  • SOC 2 Type II certification on our roadmap

Compliance

  • GDPR-compliant data processing and storage
  • Data residency options for EU and US regions
  • Configurable data retention policies
  • Business Associate Agreement (BAA) available

Need more than 2,000 credits?

Get custom pricing, dedicated SLA, and priority support tailored to your organization's needs.