Create and issue a document in one call
Creates a draft and finalizes it in a single request — the one-call issuance surface for API customers (the dashboard/bot two-step draft→finalize flow is unchanged). The body is everything POST /documents accepts, plus:
- reference — optional caller idempotency key, scoped to YOUR business (stored namespaced internally). Callers may reuse the same reference across different businesses without colliding. A repeat request with the same reference for this business returns the already-issued document with
created:falseand HTTP 200 (a first issuance returns HTTP 201). While a same-reference request is still being issued concurrently, a competing request gets HTTP 409reference_in_progress(retry shortly) or, in a narrow race,reference_conflict(retry to receive the issued document) — never a duplicate document. - waitForPdf (default true) — hold the response for a bounded ~8s window until the PDF has rendered (
pdfStatus:"completed"); on timeout the document is still issued andpdfUrlis still the stable address (pdfStatus:"processing"). ApdfStatus:"failed"render can be re-requested later at the samepdfUrl.
On finalize failure the just-created draft is removed (no orphan draft) and the original error is returned unchanged — e.g. an unconnected business issuing a B2B document above the SHAAM allocation threshold gets ALLOCATION_CONNECTION_REQUIRED exactly as in the two-call flow.
Business API key, e.g. vuz_ab12cdef... Created via Settings → Integrations → API Keys. Unlike partner keys, a public API key's STRING does not encode its environment — isolation instead comes from a completely separate sandbox database: a key minted on the Sandbox server (above) only ever reads/writes sandbox data and can never see or affect production, regardless of what the key looks like.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/documents/issue" \ -H "Content-Type: application/json" \ -d '{ "businessId": "660e8400-e29b-41d4-a716-446655440000", "docType": "tax_invoice_receipt", "issueDate": "2025-01-15", "subTotal": 2700, "vatTotal": 486, "grandTotal": 3086 }'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "documentNumber": "50001", "documentType": "order", "status": "draft", "subtotal": 200, "vatTotal": 36, "total": 236, "currency": "ILS", "issuedAt": "2026-07-22T00:00:00.000Z", "pdfUrl": "/api/v1/documents/880e8400-e29b-41d4-a716-446655440000/pdf", "pdfStatus": "completed", "allocationStatus": "not_required", "allocationNumber": {}, "created": true, "reference": "order-2026-000123"}
