How do I compose and send for signature in one call?
Use /api/v1/flow instead of /api/v1/compose/documents/generate
whenever the document is going out for signature the moment it exists — one
request, one round trip, and no window where you are holding a document that
has not been sent yet:
curl -X POST https://your-host/api/v1/flow \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-4471" \
-d '{
"data": { "customer": { "name": "Acme Srl" } },
"settings": { "templateId": "contract-standard-8bc99b" },
"signature": {
"subject": "Service agreement",
"signers": {
"A": { "email": "anna@acme.example", "fullName": "Anna Rossi",
"fields": [{ "kind": "signature", "page": 1,
"x": 0.1, "y": 0.78, "width": 0.32, "height": 0.09 }] }
}
}
}'
Where the signature goes. The usual way is a tag in the
template, {{ signature.A }}, written like any other field:
signer A then needs no fields and signs where the tag
is. The alternative is fields, as here: x and
y are fractions of the page from the top-left corner (0.1 = a tenth
of the way across). How to read them off a PDF, and everything else about
placing a signature: Where the signature goes on
the page.
Always send the Idempotency-Key — this call charges twice and
emails a real person, and a retried request without one does both again.
Full field list and what comes back:
Compose and sign, in one call.