Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.case.dev/llms.txt

Use this file to discover all available pages before exploring further.

A style-based layout engine for generating professional legal documents. Transform Markdown, JSON, or plain text into polished PDFs, Word documents, or HTML previews with precise typography and layout control.

Quick example

curl -X POST https://api.case.dev/format/v1/document \
  -H "Authorization: Bearer sk_case_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "# Motion for Summary Judgment\n\nPlaintiff respectfully moves...",
    "input_format": "md",
    "output_format": "pdf",
    "options": {
      "template": "pleading",
      "styles": {
        "h1": { "font": "Times New Roman", "size": 14, "bold": true, "alignment": "center" },
        "p": { "font": "Times New Roman", "size": 12, "spacingAfter": 12 }
      }
    }
  }'

Capabilities

Unlike simple converters, the Format API gives you full control over document presentation:
FeatureDescription
TypographyControl fonts, sizes, weights, and spacing per element type
LayoutSet margins, page numbers, headers, and footers
TemplatesBuilt-in presets like pleading paper with line numbers
Variable InterpolationUse {{variable}} placeholders for dynamic content
Preview ModeGenerate HTML previews before committing to PDF

Output formats

FormatUse Case
pdfFinal documents for filing, printing, or archiving
docxEditable Word documents for collaboration
html_previewFast previews for UI rendering before final generation

Built-in templates

TemplateDescription
standardClean professional formatting (default)
pleadingLegal pleading paper with line numbers and court margins
Custom templates can be saved and reused across your organization using the Templates API.

Endpoints

Generate Document

POST /format/v1/document — Convert content to PDF, DOCX, or HTML

Templates

GET/POST /format/v1/templates — Manage reusable format templates

Common patterns

Live preview in your app

# CLI (via cURL - no direct CLI command)
curl -X POST https://api.case.dev/format/v1/document \
  -H "Authorization: Bearer $CASEDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "# Your markdown content...",
    "input_format": "md",
    "output_format": "html_preview"
  }'

With template variables

# CLI (via cURL - no direct CLI command)
curl -X POST https://api.case.dev/format/v1/document \
  -H "Authorization: Bearer $CASEDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "# Service Agreement\n\nThis agreement is entered into by **{{client_name}}** (\"Client\")\nand **{{firm_name}}** (\"Firm\") on {{effective_date}}.\n\n## Scope of Services\n{{services_description}}",
    "input_format": "md",
    "output_format": "pdf",
    "options": {
      "components": [{
        "variables": {
          "client_name": "Acme Corporation",
          "firm_name": "Smith & Associates LLP",
          "effective_date": "January 15, 2024",
          "services_description": "Legal representation in matters of..."
        }
      }]
    }
  }'

Court-ready pleading

# CLI (via cURL - no direct CLI command)
curl -X POST https://api.case.dev/format/v1/document \
  -H "Authorization: Bearer $CASEDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "...",
    "input_format": "md",
    "output_format": "pdf",
    "options": {
      "template": "pleading",
      "header": "SUPERIOR COURT OF CALIFORNIA",
      "footer": "Motion for Summary Judgment - Page {{page}}",
      "margins": { "top": 72, "right": 72, "bottom": 72, "left": 108 }
    }
  }'

LLMs

Generate content with AI, then format into polished documents