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.

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 -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

ParameterTypeRequiredDescription
documentobjectYesDocument source (see below)
fieldsarrayYesFields to populate (see below)
output_formatstringNoOutput format: docx or pdf. Default: docx

Document object

Provide either a URL or base64-encoded content:
PropertyTypeDescription
urlstringURL to the DOCX template
base64stringBase64-encoded DOCX template

Field object

PropertyTypeRequiredDescription
idstringOne ofTarget field ID (for single field)
groupstringOne ofTarget field group (for multiple fields)
typestringYesField type: text, image, date, number
valuestring/numberYesValue to populate
optionsobjectNoAdditional options (e.g., image dimensions)

Field types

TypeValue FormatUse Case
textStringNames, descriptions, addresses
numberNumberAmounts, quantities, prices
dateISO date stringContract dates, deadlines
imageImage URLSignatures, logos, stamps

Response

Returns the annotated document as binary data with appropriate content type based on output_format.

Examples

Fill a contract template

# 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

# 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:
# 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:
  1. Create a DOCX document in Microsoft Word or Google Docs
  2. Add SuperDoc annotation fields where you want dynamic content
  3. Upload the template to a publicly accessible URL or your storage
  4. Call the Annotate API with field values
See SuperDoc’s documentation for details on adding annotation fields to your templates.