API Documentation

Classify legal documents with AI. Extract dates, case numbers, parties, and more.

Quick Start

Get started in three simple steps. Use the same API key from your Mailroom Agent app.

1

Get Your API Key

Use the API key from your Mailroom Agent app settings.

2

Choose Your Method

REST API for direct integration, or MCP for Claude Code.

3

Send Documents

Base64 encode your PDF and send it. Get structured JSON back.

Integration Methods

POST https://api.mailroomagent.com/v1/classify

Headers

Authorization: Bearer your_api_key
Content-Type: application/json

Request Body

{
  "document": "base64_encoded_pdf_content",
  "document_type": "pdf",
  "options": {
    "extract_dates": true,
    "extract_adj": true
  }
}

Response

{
  "success": true,
  "data": {
    "document_type": "wcab_form",
    "confidence": 0.95,
    "summary": "Notice of Hearing from WCAB...",
    "page_count": 6,
    "parties": ["ANA GUEVARA", "ASCENA RETAIL GROUP"],
    "case_numbers": ["ADJ13226857"],
    "dates": [...],
    "adj_numbers": [...]
  }
}

Connect Mailroom Agent directly to Claude Code as an MCP server. Claude can then classify documents automatically.

1. Add to Claude Code Settings

Edit ~/.claude/settings.json:

{
  "mcpServers": {
    "mailroom": {
      "type": "url",
      "url": "https://api.mailroomagent.com/mcp",
      "headers": {
        "Authorization": "Bearer your_api_key"
      }
    }
  }
}

2. Use in Claude Code

Just ask Claude to classify documents:

# Claude Code will automatically call the classify_document tool

> Classify this PDF: /path/to/document.pdf

> What type of document is this and extract the hearing dates

> Extract all ADJ numbers from this legal document

Available Tools

classify_document Classify document from base64 content
classify_file Classify document from file path

Full cURL Example

# Encode your PDF to base64
PDF_BASE64=$(base64 -i document.pdf)

# Send to API
curl -X POST https://api.mailroomagent.com/v1/classify \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "document": "'$PDF_BASE64'",
    "document_type": "pdf",
    "options": {
      "extract_dates": true,
      "extract_adj": true
    }
  }'

Health Check

curl https://api.mailroomagent.com/health

# Returns: {"status": "ok", "timestamp": "..."}

Response Fields

document_type medical_report, wcab_form, correspondence, deposition, subpoena, court_order, billing, unknown
confidence 0-1 confidence score
summary Brief 1-2 sentence summary
page_count Number of pages in document
parties Array of party names mentioned
case_numbers Array of case/ADJ numbers found
dates Array of dates with type, description, location
adj_numbers Array of ADJ numbers with claimant and employer

Date Object

{
  "date": "2026-01-22",
  "type": "hearing",  // hearing, deadline, appointment, trial, injury, other
  "description": "Date of Hearing",
  "location": "3737 MAIN ST STE 300, RIVERSIDE CA 92501"
}

ADJ Number Object

{
  "number": "ADJ13226857",
  "claimant_name": "ANA GUEVARA",
  "employer": "ASCENA RETAIL GROUP INC"
}

Same API Key: Use the same API key from your Mailroom Agent desktop app. One key works for both the app and API/MCP integrations.

Ask Paige
P
Paige
AI Assistant
Hi! I'm Paige, your AI assistant. I can help answer questions about Mailroom Agent and how it can automate your document processing. What would you like to know?