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
TypeScript
Python
C#
Java
PHP
cURL
Go
CLI
cURL
CLI
import Casedev from 'casedev' ;
const client = new Casedev ({ apiKey : 'sk_case_YOUR_API_KEY' });
const response = await client . format . v1 . document ({
content : '# Motion for Summary Judgment \n\n Plaintiff 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:
Feature Description Typography Control fonts, sizes, weights, and spacing per element type Layout Set margins, page numbers, headers, and footers Templates Built-in presets like pleading paper with line numbers Variable Interpolation Use {{variable}} placeholders for dynamic content Preview Mode Generate HTML previews before committing to PDF
Format Use 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
Template Description 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
TypeScript
Python
C#
Java
PHP
Go
cURL
CLI
// Show users a preview before generating the final PDF
const preview = await client . format . v1 . document ({
content : markdownContent ,
input_format : 'md' ,
output_format : 'html_preview'
});
// Render in your UI
document . getElementById ( 'preview' ). innerHTML = preview ;
With template variables
TypeScript
Python
C#
Java
PHP
Go
cURL
CLI
const contract = await client . format . v1 . document ({
content : `
# Service Agreement
This agreement is entered into by **{{client_name}}** ("Client")
and **{{firm_name}}** ("Firm") on {{effective_date}}.
## Scope of Services
{{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
TypeScript
Python
C#
Java
PHP
Go
cURL
CLI
const motion = await client . format . v1 . document ({
content : motionMarkdown ,
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