← Back to Blog
February 27, 2026·6 min read

Custom Output Templates: Why One-Size-Fits-All Extraction Fails

Here's the problem with preset-only extraction: your invoice doesn't look like every other invoice. Your vendor puts the PO number in a different field. Your tax form has state-specific boxes. Your medical record uses a custom vitals format.

Presets get you 80% of the way. Custom output templates get you 100%.

How It Works

Pass an output_template field with any JSON structure. PeterParser's AI engine extracts data matching your exact schema — not a generic one.

curl -X POST https://api.peterparser.com/v2/documents \
  -H "X-API-Key: pp_live_..." \
  -d '{
    "base64": "<document_base64>",
    "document_type": "custom",
    "output_template": {
      "property_address": "",
      "landlord": { "name": "", "phone": "", "email": "" },
      "tenant": { "name": "", "phone": "", "email": "" },
      "lease_start": "",
      "lease_end": "",
      "monthly_rent": 0,
      "security_deposit": 0,
      "pet_deposit": 0,
      "utilities_included": [],
      "parking_spaces": 0,
      "early_termination_fee": 0,
      "renewal_terms": "",
      "special_conditions": []
    }
  }'

The response data field matches your template structure exactly. Fields not found in the document return null or empty arrays.

When Presets Work

PeterParser ships 16 presets covering the most common document types. Use them when:

  • → Your documents follow standard formats (W2, 1099, standard invoices)
  • → You want to start extracting immediately without defining a schema
  • → You need the same fields every competitor's parsing API would extract
# Using a preset — no template needed
curl -X POST https://api.peterparser.com/v2/documents \
  -H "X-API-Key: pp_live_..." \
  -d '{
    "base64": "<w2_base64>",
    "document_type": "w2",
    "extraction_preset": "w2_tax"
  }'

# Check available presets
curl https://api.peterparser.com/v2/documents/presets \
  -H "X-API-Key: pp_live_..."

When You Need Custom Templates

  • Industry-specific documents — real estate leases, construction bids, insurance policies with custom riders
  • Internal forms — your company's expense report, time sheet, or inspection checklist
  • Regional variations — tax forms that vary by state or country
  • Nested data — when you need specific sub-structures (e.g., a list of line items where each has 8 fields)

Combining Presets and Templates

Use a preset as your starting point, then override with a custom template for the fields that differ. The preset handles the common fields; your template adds the custom ones.

Why This Matters

Other APIs give you text and let you figure out the structure. Or they offer rigid presets that don't match your documents. PeterParser lets you define the exact JSON structure you need, and the AI fills it in. Your application code never has to parse, map, or transform — the API response IS your data model.