Home

For The Clause API

REST API for programmatic contract analysis. Get a key from your API keys page.

Authentication

All requests need a Bearer token in the Authorization header.

Authorization: Bearer cc_live_xxxxxxxxxxxxxxxxxxxx

Rate limit

60 requests per minute per API key. Exceeding returns HTTP 429.

Errors

{ "error": { "code": "insufficient_credits", "message": "..." } }
POST/api/public/v1/analyze

Analyze a contract. Costs 8 credits. Set save: true to persist to your reports history.

curl -X POST https://fortheclause.com/api/public/v1/analyze \
  -H "Authorization: Bearer cc_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "text": "...full contract text (min 50 chars, max 80000)...",
    "fileName": "lease.pdf",
    "save": true
  }'

Response:

{
  "credits_spent": 8,
  "balance": 42,
  "report_id": "uuid-or-null",
  "breakdown": { "contractType": "...", "summary": "...", "riskFlags": [...], ... }
}
GET/api/public/v1/credits
curl https://fortheclause.com/api/public/v1/credits \
  -H "Authorization: Bearer cc_live_..."

# → { "balance": 42 }
GET/api/public/v1/credits/transactions

Query params: limit (1-200, default 50), offset (default 0).

curl "https://fortheclause.com/api/public/v1/credits/transactions?limit=20" \
  -H "Authorization: Bearer cc_live_..."
GET/api/public/v1/reports

List your saved reports. Query params: limit, offset.

curl https://fortheclause.com/api/public/v1/reports \
  -H "Authorization: Bearer cc_live_..."
GET/api/public/v1/reports/{id}

Fetch a single report. Locked reports return breakdown: null until unlocked.

curl https://fortheclause.com/api/public/v1/reports/REPORT_ID \
  -H "Authorization: Bearer cc_live_..."
POST/api/public/v1/reports/{id}/unlock

Unlock a saved report. Cost: 8 credits standard, 4 for user-private, 1 for sensitive (NDA/medical).

curl -X POST https://fortheclause.com/api/public/v1/reports/REPORT_ID/unlock \
  -H "Authorization: Bearer cc_live_..."

Buying credits

Out of credits? Create a Stripe Checkout session and redirect the user. Once payment completes, credits are added to the account that owns the API key (via webhook — usually within a second). Then keep calling the API as normal.

GET/api/public/v1/credits/packs

List available credit packs.

curl https://fortheclause.com/api/public/v1/credits/packs \
  -H "Authorization: Bearer cc_live_..."

# → { "packs": [
#     { "id": "credits_40_pack", "price_id": "credits_40",
#       "credits": 40, "amount_cents": 2000, "currency": "USD",
#       "label": "Standard", "tagline": "5 detailed breakdowns" },
#     ...
#   ] }
POST/api/public/v1/credits/checkout

Create a hosted Stripe Checkout session. Returns a checkout_url you redirect the user to. Credits land automatically when payment completes.

curl -X POST https://fortheclause.com/api/public/v1/credits/checkout \
  -H "Authorization: Bearer cc_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "price_id": "credits_40",
    "success_url": "https://yourapp.com/credits/done",
    "cancel_url": "https://yourapp.com/credits"
  }'

Response:

{
  "checkout_url": "https://checkout.stripe.com/c/pay/cs_...",
  "session_id": "cs_...",
  "pack": { "id": "credits_40_pack", "credits": 40, "amount_cents": 2000, "currency": "USD" }
}