curl --request POST \
--url https://api.quiva.ai/file-generator/templates/trigger \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"client_name": "Acme Corp",
"client_email": "billing@acme.com",
"invoice_number": "INV-2026-014",
"currency": "EUR",
"line_items": [
{
"description": "Consulting",
"qty": 10,
"unit_price": 120
},
{
"description": "Support retainer",
"qty": 1,
"unit_price": 800
}
],
"subtotal": 2000,
"tax": 400
},
"list": [
{
"template": "invoice-template",
"output": {
"folder": "invoices.2026"
}
}
]
}
'import requests
url = "https://api.quiva.ai/file-generator/templates/trigger"
payload = {
"payload": {
"client_name": "Acme Corp",
"client_email": "billing@acme.com",
"invoice_number": "INV-2026-014",
"currency": "EUR",
"line_items": [
{
"description": "Consulting",
"qty": 10,
"unit_price": 120
},
{
"description": "Support retainer",
"qty": 1,
"unit_price": 800
}
],
"subtotal": 2000,
"tax": 400
},
"list": [
{
"template": "invoice-template",
"output": { "folder": "invoices.2026" }
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {
client_name: 'Acme Corp',
client_email: 'billing@acme.com',
invoice_number: 'INV-2026-014',
currency: 'EUR',
line_items: [
{description: 'Consulting', qty: 10, unit_price: 120},
{description: 'Support retainer', qty: 1, unit_price: 800}
],
subtotal: 2000,
tax: 400
},
list: [{template: 'invoice-template', output: {folder: 'invoices.2026'}}]
})
};
fetch('https://api.quiva.ai/file-generator/templates/trigger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.quiva.ai/file-generator/templates/trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
'client_name' => 'Acme Corp',
'client_email' => 'billing@acme.com',
'invoice_number' => 'INV-2026-014',
'currency' => 'EUR',
'line_items' => [
[
'description' => 'Consulting',
'qty' => 10,
'unit_price' => 120
],
[
'description' => 'Support retainer',
'qty' => 1,
'unit_price' => 800
]
],
'subtotal' => 2000,
'tax' => 400
],
'list' => [
[
'template' => 'invoice-template',
'output' => [
'folder' => 'invoices.2026'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.quiva.ai/file-generator/templates/trigger"
payload := strings.NewReader("{\n \"payload\": {\n \"client_name\": \"Acme Corp\",\n \"client_email\": \"billing@acme.com\",\n \"invoice_number\": \"INV-2026-014\",\n \"currency\": \"EUR\",\n \"line_items\": [\n {\n \"description\": \"Consulting\",\n \"qty\": 10,\n \"unit_price\": 120\n },\n {\n \"description\": \"Support retainer\",\n \"qty\": 1,\n \"unit_price\": 800\n }\n ],\n \"subtotal\": 2000,\n \"tax\": 400\n },\n \"list\": [\n {\n \"template\": \"invoice-template\",\n \"output\": {\n \"folder\": \"invoices.2026\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.quiva.ai/file-generator/templates/trigger")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"client_name\": \"Acme Corp\",\n \"client_email\": \"billing@acme.com\",\n \"invoice_number\": \"INV-2026-014\",\n \"currency\": \"EUR\",\n \"line_items\": [\n {\n \"description\": \"Consulting\",\n \"qty\": 10,\n \"unit_price\": 120\n },\n {\n \"description\": \"Support retainer\",\n \"qty\": 1,\n \"unit_price\": 800\n }\n ],\n \"subtotal\": 2000,\n \"tax\": 400\n },\n \"list\": [\n {\n \"template\": \"invoice-template\",\n \"output\": {\n \"folder\": \"invoices.2026\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/file-generator/templates/trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {\n \"client_name\": \"Acme Corp\",\n \"client_email\": \"billing@acme.com\",\n \"invoice_number\": \"INV-2026-014\",\n \"currency\": \"EUR\",\n \"line_items\": [\n {\n \"description\": \"Consulting\",\n \"qty\": 10,\n \"unit_price\": 120\n },\n {\n \"description\": \"Support retainer\",\n \"qty\": 1,\n \"unit_price\": 800\n }\n ],\n \"subtotal\": 2000,\n \"tax\": 400\n },\n \"list\": [\n {\n \"template\": \"invoice-template\",\n \"output\": {\n \"folder\": \"invoices.2026\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"template": "invoice-template",
"subject": "ms.document.document.invoices.2026.invoice-INV-2026-014.pdf"
}
]{
"error": "\"key\" is required"
}{
"error": "Authorization header with a bearer token is required"
}{
"error": "server error"
}Trigger template
Generate one or more documents from published templates.
Each entry in list names a template key and may override its stored output configuration. The shared payload object is the data context for angular expression evaluation: every key in the payload becomes an identifier available to tags inside the template’s source DOCX, to the output.name filename template, to signatories[].name/email, and (as <key>.value facts) to sub_templates[].conditions. Expressions support nested property access ({client.address.city}), operators ({subtotal + tax}, {is_overdue ? "OVERDUE" : ""}), condition blocks ({#discount > 0}…{/}), loops ({#line_items}{description} — {qty * unit_price}{/line_items}), and the built-in filters.
This is an asynchronous operation. The 200 response confirms each job was queued (or reports per-template validation errors) and returns the document subject. A document record is created immediately with output: null; the trigger consumer then fetches the published template and its matching sub-templates, renders them against the payload, merges the results, and updates the record with output.key (the storage URI of the generated file) — or with errors if rendering failed. Poll GET /documents/{key} to observe completion. If the template defines signatories, the signature request is dispatched automatically after rendering succeeds (each signatory starts as DRAFT, moving to SENT once the request is created).
The generated file is written to {store}://{bucket}/{filepath} where trigger-level output overrides take precedence over the template’s stored output. Buckets may target the object store (obj://, default) or the key-value store (kv://).
Built-in HTML report. A template key starting with builtin. (for example builtin.report) is resolved from templates shipped with the platform, with no per-account setup. Built-in templates render text/html to text/html: you supply the report content, the template owns the layout, and the account’s document theme supplies the brand (accent colour, fonts, footer, and the account logo, or the platform logo when the account has none). The content is sanitised: scripts, event handlers, styles, remote resources and unsafe links are removed.
curl --request POST \
--url https://api.quiva.ai/file-generator/templates/trigger \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"client_name": "Acme Corp",
"client_email": "billing@acme.com",
"invoice_number": "INV-2026-014",
"currency": "EUR",
"line_items": [
{
"description": "Consulting",
"qty": 10,
"unit_price": 120
},
{
"description": "Support retainer",
"qty": 1,
"unit_price": 800
}
],
"subtotal": 2000,
"tax": 400
},
"list": [
{
"template": "invoice-template",
"output": {
"folder": "invoices.2026"
}
}
]
}
'import requests
url = "https://api.quiva.ai/file-generator/templates/trigger"
payload = {
"payload": {
"client_name": "Acme Corp",
"client_email": "billing@acme.com",
"invoice_number": "INV-2026-014",
"currency": "EUR",
"line_items": [
{
"description": "Consulting",
"qty": 10,
"unit_price": 120
},
{
"description": "Support retainer",
"qty": 1,
"unit_price": 800
}
],
"subtotal": 2000,
"tax": 400
},
"list": [
{
"template": "invoice-template",
"output": { "folder": "invoices.2026" }
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {
client_name: 'Acme Corp',
client_email: 'billing@acme.com',
invoice_number: 'INV-2026-014',
currency: 'EUR',
line_items: [
{description: 'Consulting', qty: 10, unit_price: 120},
{description: 'Support retainer', qty: 1, unit_price: 800}
],
subtotal: 2000,
tax: 400
},
list: [{template: 'invoice-template', output: {folder: 'invoices.2026'}}]
})
};
fetch('https://api.quiva.ai/file-generator/templates/trigger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.quiva.ai/file-generator/templates/trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
'client_name' => 'Acme Corp',
'client_email' => 'billing@acme.com',
'invoice_number' => 'INV-2026-014',
'currency' => 'EUR',
'line_items' => [
[
'description' => 'Consulting',
'qty' => 10,
'unit_price' => 120
],
[
'description' => 'Support retainer',
'qty' => 1,
'unit_price' => 800
]
],
'subtotal' => 2000,
'tax' => 400
],
'list' => [
[
'template' => 'invoice-template',
'output' => [
'folder' => 'invoices.2026'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.quiva.ai/file-generator/templates/trigger"
payload := strings.NewReader("{\n \"payload\": {\n \"client_name\": \"Acme Corp\",\n \"client_email\": \"billing@acme.com\",\n \"invoice_number\": \"INV-2026-014\",\n \"currency\": \"EUR\",\n \"line_items\": [\n {\n \"description\": \"Consulting\",\n \"qty\": 10,\n \"unit_price\": 120\n },\n {\n \"description\": \"Support retainer\",\n \"qty\": 1,\n \"unit_price\": 800\n }\n ],\n \"subtotal\": 2000,\n \"tax\": 400\n },\n \"list\": [\n {\n \"template\": \"invoice-template\",\n \"output\": {\n \"folder\": \"invoices.2026\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.quiva.ai/file-generator/templates/trigger")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"client_name\": \"Acme Corp\",\n \"client_email\": \"billing@acme.com\",\n \"invoice_number\": \"INV-2026-014\",\n \"currency\": \"EUR\",\n \"line_items\": [\n {\n \"description\": \"Consulting\",\n \"qty\": 10,\n \"unit_price\": 120\n },\n {\n \"description\": \"Support retainer\",\n \"qty\": 1,\n \"unit_price\": 800\n }\n ],\n \"subtotal\": 2000,\n \"tax\": 400\n },\n \"list\": [\n {\n \"template\": \"invoice-template\",\n \"output\": {\n \"folder\": \"invoices.2026\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/file-generator/templates/trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payload\": {\n \"client_name\": \"Acme Corp\",\n \"client_email\": \"billing@acme.com\",\n \"invoice_number\": \"INV-2026-014\",\n \"currency\": \"EUR\",\n \"line_items\": [\n {\n \"description\": \"Consulting\",\n \"qty\": 10,\n \"unit_price\": 120\n },\n {\n \"description\": \"Support retainer\",\n \"qty\": 1,\n \"unit_price\": 800\n }\n ],\n \"subtotal\": 2000,\n \"tax\": 400\n },\n \"list\": [\n {\n \"template\": \"invoice-template\",\n \"output\": {\n \"folder\": \"invoices.2026\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"template": "invoice-template",
"subject": "ms.document.document.invoices.2026.invoice-INV-2026-014.pdf"
}
]{
"error": "\"key\" is required"
}{
"error": "Authorization header with a bearer token is required"
}{
"error": "server error"
}Authorizations
Body
Data context (source) for all template expressions. No schema required — completely flexible and user-defined. Every key in the payload becomes an identifier available in template tags. Example: payload {"client_name": "Acme", "invoice_number": "INV-001"} makes {client_name} and {invoice_number} available in the template. Nested objects and arrays are fully traversable: {client.address.city}, {items.0.price}, {#items}...{/items}. Missing fields render as empty (not errors) — use conditionals like {#field}...{/} to handle optional data. Structure your payload to match the identifiers referenced in your template; the API does not validate field matching.
{
"client_name": "Acme Corp",
"client_email": "billing@acme.com",
"invoice_number": "INV-2024-001",
"amount": "5000.00"
}
Response
Trigger jobs queued. The response is per-template: entries with a subject were queued successfully (the subject identifies the document record to poll); entries with errors failed validation and no job was queued for them. A 200 therefore does not guarantee every template was triggered — check each result.