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.
Populate fields inside a DOCX template using SuperDoc annotations. Create a template once with placeholder fields, then generate customized documents by providing field values.
Usage
cURL
CLI
Typescript
Python
C#
Java
PHP
Go
curl -X POST https://api.case.dev/superdoc/v1/annotate \
-H "Authorization: Bearer sk_case_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"document": {
"url": "https://your-bucket.s3.amazonaws.com/templates/contract.docx"
},
"fields": [
{ "id": "client_name", "type": "text", "value": "Acme Corporation" },
{ "id": "contract_date", "type": "date", "value": "2025-01-15" },
{ "id": "contract_amount", "type": "number", "value": 50000 }
],
"output_format": "pdf"
}' \
-o filled-contract.pdf
Parameters
Parameter Type Required Description documentobject Yes Document source (see below) fieldsarray Yes Fields to populate (see below) output_formatstring No Output format: docx or pdf. Default: docx
Document object
Provide either a URL or base64-encoded content:
Property Type Description urlstring URL to the DOCX template base64string Base64-encoded DOCX template
Field object
Property Type Required Description idstring One of Target field ID (for single field) groupstring One of Target field group (for multiple fields) typestring Yes Field type: text, image, date, number valuestring/number Yes Value to populate optionsobject No Additional options (e.g., image dimensions)
Field types
Type Value Format Use Case textString Names, descriptions, addresses numberNumber Amounts, quantities, prices dateISO date string Contract dates, deadlines imageImage URL Signatures, logos, stamps
Response
Returns the annotated document as binary data with appropriate content type based on output_format.
Examples
Fill a contract template
cURL
CLI
Typescript
Python
C#
Java
PHP
Go
# CLI (via cURL - no direct CLI command)
curl -X POST https://api.case.dev/superdoc/v1/annotate \
-H "Authorization: Bearer $CASEDEV_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"document": {
"url": "https://templates.example.com/service-agreement.docx"
},
"fields": [
{ "id": "client_name", "type": "text", "value": "Acme Corporation" },
{ "id": "client_address", "type": "text", "value": "123 Main St, Suite 100" },
{ "id": "effective_date", "type": "date", "value": "2025-01-15" },
{ "id": "monthly_fee", "type": "number", "value": 5000 },
{ "id": "term_months", "type": "number", "value": 12 }
],
"output_format": "pdf"
}' \
-o contract.pdf
Add signature to document
cURL
CLI
Typescript
Python
C#
Java
PHP
Go
# CLI (via cURL - no direct CLI command)
curl -X POST https://api.case.dev/superdoc/v1/annotate \
-H "Authorization: Bearer $CASEDEV_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"document": {
"url": "https://templates.example.com/agreement.docx"
},
"fields": [
{ "id": "signatory_name", "type": "text", "value": "John Smith" },
{ "id": "signature_date", "type": "date", "value": "2025-01-15" },
{
"id": "signature",
"type": "image",
"value": "https://signatures.example.com/john-smith.png",
"options": { "width": 200, "height": 50 }
}
],
"output_format": "pdf"
}' \
-o signed-agreement.pdf
Use field groups for repeated content
When your template has multiple fields with the same tag (e.g., a header and footer both showing client name), use group instead of id:
cURL
CLI
Typescript
Python
C#
Java
PHP
Go
# CLI (via cURL - no direct CLI command)
curl -X POST https://api.case.dev/superdoc/v1/annotate \
-H "Authorization: Bearer $CASEDEV_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"document": { "url": "https://example.com/template.docx" },
"fields": [
{ "group": "client_name", "type": "text", "value": "Acme Corporation" }
]
}'
Creating templates
To create a template for use with the Annotate API:
Create a DOCX document in Microsoft Word or Google Docs
Add SuperDoc annotation fields where you want dynamic content
Upload the template to a publicly accessible URL or your storage
Call the Annotate API with field values