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
CLI
Typescript
Python
Go
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 }
}
}
}'
casedev format:v1 document \
--content "# Report" \
--input-format md --output-format pdf
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 }
}
}
});
import casedev
client = casedev. Casedev ( api_key = 'sk_case_YOUR_API_KEY' )
response = client.format.v1. create_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 }
}
}
)
result , _ := client . Format . V1 . NewDocument ( ctx , casedev . FormatV1NewDocumentParams {
Content : casedev . F ( "# Report \n\n Content here..." ),
InputFormat : casedev . F ( "md" ),
OutputFormat : casedev . F ( "pdf" ),
})
// result is *http.Response with PDF body
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
cURL
CLI
Typescript
Python
Go
# 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"
}'
casedev format:v1 document
// 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 ;
# Show users a preview before generating the final PDF
preview = client.format.v1. create_document (
content = markdown_content,
input_format = 'md' ,
output_format = 'html_preview'
)
resp , _ := client . Format . V1 . NewDocument ( ctx , casedev . FormatV1NewDocumentParams {
Content : casedev . F ( markdownContent ),
InputFormat : casedev . F ( casedev . FormatV1NewDocumentParamsInputFormatMd ),
OutputFormat : casedev . F ( casedev . FormatV1NewDocumentParamsOutputFormatHtmlPreview ),
})
// resp body contains HTML string
With template variables
cURL
CLI
Typescript
Python
Go
# 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..."
}
}]
}
}'
casedev format:v1 document \
--content "# Your content" \
--input-format md --output-format pdf
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...'
}
}]
}
});
contract = client.format.v1. create_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...'
}
}]
}
)
resp , _ := client . Format . V1 . NewDocument ( ctx , casedev . FormatV1NewDocumentParams {
Content : casedev . F ( "# Service Agreement \n\n This agreement is entered into by **{{client_name}}** ( \" Client \" ) \n and **{{firm_name}}** ( \" Firm \" ) on {{effective_date}}. \n\n ## Scope of Services \n {{services_description}}" ),
InputFormat : casedev . F ( casedev . FormatV1NewDocumentParamsInputFormatMd ),
OutputFormat : casedev . F ( casedev . FormatV1NewDocumentParamsOutputFormatPdf ),
Options : casedev . F ( casedev . FormatV1NewDocumentParamsOptions {
Components : casedev . F ([] casedev . FormatV1NewDocumentParamsOptionsComponent {{
Variables : casedev . F ( map [ string ] string {
"client_name" : "Acme Corporation" ,
"firm_name" : "Smith & Associates LLP" ,
"effective_date" : "January 15, 2024" ,
"services_description" : "Legal representation in matters of..." ,
}),
}}),
}),
})
Court-ready pleading
cURL
CLI
Typescript
Python
Go
# 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 }
}
}'
casedev format:v1 document \
--content "# Your content" \
--input-format md --output-format pdf
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 }
}
});
motion = client.format.v1. create_document (
content = motion_markdown,
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 }
}
)
resp , _ := client . Format . V1 . NewDocument ( ctx , casedev . FormatV1NewDocumentParams {
Content : casedev . F ( motionMarkdown ),
InputFormat : casedev . F ( casedev . FormatV1NewDocumentParamsInputFormatMd ),
OutputFormat : casedev . F ( casedev . FormatV1NewDocumentParamsOutputFormatPdf ),
Options : casedev . F ( casedev . FormatV1NewDocumentParamsOptions {
Template : casedev . F ( "pleading" ),
Header : casedev . F ( "SUPERIOR COURT OF CALIFORNIA" ),
Footer : casedev . F ( "Motion for Summary Judgment - Page {{page}}" ),
Margins : casedev . F ( casedev . FormatV1NewDocumentParamsOptionsMargins {
Top : casedev . F ( int64 ( 72 )), Right : casedev . F ( int64 ( 72 )),
Bottom : casedev . F ( int64 ( 72 )), Left : casedev . F ( int64 ( 108 )),
}),
}),
})
LLMs Generate content with AI, then format into polished documents