Free plan

Mail Merge

Fill one Word letter with many names to make many copies
POST
/v1/documents/mail-merge

About this tool

Mail merge fills a template, which is a document with gaps like {{name}}, with real values. You add a Word or OpenDocument template and your list of people as a table file, or type one set of values. You get one finished document for each row. Each gap in the template needs a matching column name.
For example, you have a letter that says Dear {{name}} and a list of 50 customers, and you get 50 personal letters.

How to use it

  1. Choose this tool.
  2. Add your template file with the gaps written like {{name}}.
  3. Add your list as a data file such as CSV or Excel, or type the values for one letter.
  4. Choose the type of result, such as Word or PDF.
  5. Press Generate.

What you get back

You get the finished letters to download, one per row of your list. You can choose to stop if a gap has no value.
GOOD TO KNOW
Each generated document counts as one file.
TEST IT LIVE

Try Mail Merge in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/mail-merge
Tool ID
documents.mail-merge
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/mail-merge" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'to=docx' \
  -F 'response=url' \
  -F 'output_bundle=zip'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.mailMerge({
    "to": "docx",
    "response": "url",
    "output_bundle": "zip"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->mailMerge([
    'to' => 'docx',
    'response' => 'url',
    'output_bundle' => 'zip',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Replace {{field}} placeholders in a DOCX or ODT template with the values of one record, or one document per record. Values are escaped, nothing in the template is executed (no macros, fields or expressions).

Mail Merge works from text and settings, so no file is needed. Every input is optional.

Mail Merge is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/mail-merge with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.