POST
/businesses/{bid}/documentsCreate a draft
POST /businesses/{bid}/documents
Requires the documents scope.
A draft is a קובץ זמני, not a tax document: no number is consumed and any rendering of it is watermarked "טיוטה". Patch and delete it freely until you issue.
Always send an idempotency key. A double-click or a network retry then returns the same draft with deduped: true instead of opening a second one.
Path parameters
| Name | Type | Description | |
|---|---|---|---|
bid | string | required | Business id, from POST /businesses. |
Headers
| Name | Type | Description | |
|---|---|---|---|
Idempotency-Key | string | Your own stable id for this call. A retry returns the same row with deduped: true instead of creating a duplicate. Interchangeable with externalRef in the body. |
Body
| Field | Type | Description | |
|---|---|---|---|
docType | integer | required | 305 / 320 / 400. A 330 is created only through the credit-note endpoint. One of: 305, 320, 400. |
party | object | {partyId} to reference a saved party, or an inline {name, taxId?, phone?, email?, address?}. Omit entirely for an anonymous cash receipt. | |
party.partyId | string | ||
party.name | string | ||
party.taxId | string | ||
party.phone | string | ||
party.email | string | ||
party.address | string | ||
priceMode | string | net (the default: line prices are ex-VAT) or gross (line prices include VAT; the total anchors to the gross sum and VAT is derived). Gross is what a consumer-facing price list wants. One of: net, gross. Default net. | |
lines | array of DocumentLine | Required for 305/320. | |
payments | array of Payment | Required for 320/400. | |
note | string | ≤500 chars. | |
documentDate | string | Defaults to today, Asia/Jerusalem. | |
valueDate | string | Defaults to today. | |
discountAmount | integer | Document-level discount. Integer agorot (₪1 = 100). | |
withholdingAmount | integer | ניכוי במקור. Integer agorot (₪1 = 100). | |
allocationNumber | string | מספר הקצאה, when you already hold one. | |
externalRef | string | Idempotency key, interchangeable with the Idempotency-Key header. |
Response
201: { "ok": true, … }
| Field | Type | Description | |
|---|---|---|---|
ok | boolean | required | |
document | Document | required | A draft is freely mutable. An issued document is immutable forever, blocked at the database engine, not merely in application code. |
deduped | boolean | Present and true when this call matched an earlier one. |
Errors: 400, 401, 403, 404, 429. Every failure answers { "error": …, "reason": … }. Branch on reason.