How do I make my first call?
From a new account to a PDF on disk in one request. Every account starts with a
template called Hello World and a starter API key named
hello-world, so there is nothing to build first.
- Get your API key. The starter key arrives by email when your account
is created; it is never shown on screen. Lost it, or need more than composing? In the
console open API keys and issue a new one, giving it a name: it is shown
once, so copy it before you leave the page. Keep it in
an environment variable rather than in your code:
export DOCONURE_API_KEY="paste-your-key-here" - Get the template id. In the console open Templates → Hello World; the id is on the template's page.
- Write the request to a file called
request.json. It has two parts:data, the values the template reads, andsettings, which template to use:{ "data": { "title": "Order confirmation", "reference": "ORD-1042", "date": "2026-11-02", "customer": {"name": "Rossi Costruzioni Srl", "email": "ufficio@example.com"}, "lines": [ {"description": "Site survey", "quantity": 1, "price": "450.00", "amount": "450.00"}, {"description": "Structural report", "quantity": 2, "price": "300.00", "amount": "600.00"} ], "total": "1050.00", "note": "Payment within 30 days." }, "settings": {"templateId": "YOUR_TEMPLATE_ID"} } - Call the API:
curl -X POST https://app.doconure.com/api/v1/compose/documents/generate \ -H "Authorization: Bearer $DOCONURE_API_KEY" \ -H "Content-Type: application/json" \ -d @request.json \ --dump-header headers.txt \ --output document.pdf
What comes back
On success the answer is 200 and the body is the PDF itself, written to
document.pdf. A PDF has no room for anything else, so the rest is in the headers
(headers.txt above):
X-Credits-UsedandX-Credits-Left: what this document cost and what your organisation has left;X-Document-Id: the stored document, to download again or to send for signature;X-Template-Version: which version of the template produced it.
Prefer JSON? Add "responseFormat": "json" to settings: the answer
then carries an output object with the same facts.
If it does not work
An error is always JSON with a stable code, never a bare status. The usual
first-call ones:
- 401
INVALID_API_KEY: the key is missing, mistyped, expired or revoked. Check that$DOCONURE_API_KEYis set in the shell you run cURL from. - 404
TEMPLATE_NOT_FOUND: the id belongs to another organisation or does not exist. Copy it again from the template's page. - 429
QUOTA_EXCEEDED: not enough credit left for this document. The console shows your balance; nothing was charged.
Every code, with what to do about it: Errors.
No code needed to try a template. Open the template in the console and use Test with JSON. The field is pre-filled from the template's own placeholders, so the shape is already correct — press the button and download the PDF.
Full field list for this call: Generating a document. Ready to send it for signature too? See Your first signature or, to do both in one request, Compose and send for signature in one call. Another language? cURL, JavaScript, React, PHP, WordPress, Java, C#, Go and Ruby, or Make, Zapier and n8n without code.