חשבוניות SLK
All API pages

API reference

POST /api/billing/v1/create-document

נסו ב-Playground
On this page

Issues a numbered, immutable document and returns it. Idempotent by apiIdentifier.

Two request shapes are accepted, detected by whether the JSON body has a top-level doc:

Native (preferred)Invoice4U-compatible
Body{"apiIdentifier": "…", "document": {…}}{"doc": {…}, "token": "<key>"}
AuthX-Api-Key / Authorization: Bearertoken in the body
Moneyinteger agorotshekel floats
QuantityquantityMilli (×1000)Quantity (float)
VATbasis points (vatBp)percent (TaxPercentage)
Responseflat JSON{"d": {…}} envelope
References to other documentsreferenceDocIdsnot expressible

Use the compatible shape only to migrate a site that already calls Invoice4U's CreateDocument (change the URL and the token, nothing else). New code should use the native shape.

Native shape#

http
POST /api/billing/v1/create-document
X-Api-Key: bk_…
Content-Type: application/json
json
{
  "apiIdentifier": "order-12345",
  "document": {
    "docType": 3,
    "customerName": "אורן כהן — סטודיו לעיצוב",
    "customerUniqueId": "515131274",
    "customerEmail": "[email protected]",
    "subject": "תשלום על בניית אתר תדמית",
    "taxIncluded": true,
    "vatBp": 1800,
    "issueDate": "2026-09-29",
    "lines": [{ "name": "בניית אתר תדמית", "quantityMilli": 1000, "unitPriceAgorot": 450000 }],
    "payments": [{ "paymentType": 3, "amountAgorot": 450000, "date": "2026-09-29" }]
  }
}

Response 200:

json
{
  "id": "3f2b7c1e-9d4a-4c55-8a51-6d1e0f6b7a10",
  "docNumber": 1042,
  "status": 1,
  "totalAgorot": 450000,
  "alreadyExisted": false,
  "viewUrl": "https://invoice.slk.co.il/billing/documents/3f2b7c1e-9d4a-4c55-8a51-6d1e0f6b7a10/view"
}

alreadyExisted: true means this apiIdentifier was used before and you are seeing the stored document. In sandbox mode: docNumber is "SBX-000003", status is 0, sandbox: true is present and there is no viewUrl.

Document fields (document)#

Required: docType, customerName, subject, taxIncluded, vatBp, issueDate, lines.

FieldTypeNotes
docTypeintegerSee the table below.
customerNamestringBuyer name as printed. Required and non-empty.
customerIdstring | nullExisting customer card id; optional. The name/ID fields are what is printed.
customerUniqueIdstring | nullBuyer ח.פ./ת.ז. Needed for allocation numbers; required for type 14 (the supplier's ID).
customerEmailstring | nullBuyer email, stored on the document.
customerAddressstring | null
subjectstringSubject line. Required, non-empty.
language1 | 21 Hebrew (default), 2 English.
currencyILS | USD | EUR | GBPDefault ILS.
fxRateMillionthsinteger | nullILS per 1 unit × 1,000,000. Required when currency ≠ ILS (3.71 → 3710000).
taxIncludedbooleantrue: line prices already include VAT.
vatBpintegerDocument default VAT: 0 or 1800.
vatModeregular | none | mixednone = Eilat/abroad, every line forced to 0. Not allowed on types 14/15.
issueDateYYYY-MM-DDBetween 30 days ago and tomorrow (UTC).
dueDatedate | null
discountValue, discountTypeinteger, 1 | 2Document discount, applied after line discounts, before VAT. 1 = agorot, 2 = percent × 100.
roundTotalbooleanRound the grand total to whole shekels.
withholdingAgorotinteger ≥ 0ניכוי במקור withheld by the payer. Payment documents only.
externalCommentsstring | nullPrinted.
internalCommentsstring | nullNever printed.
fixedTextstring | nullFree text above the footer.
titlestring | nullProject/scope title under the heading (quotes, proformas).
branchstring | nullBranch name stamped on the document.
unsignedbooleanIssue without the digital signature (and without the dashboard's automatic customer email). The fiscal hash chain still applies.
referenceDocIdsstring[]Ids of issued documents this one references. See below.
linesarray (1–500)See below.
paymentsarraySee below.

Lines#

FieldTypeNotes
namestring
quantityMilliinteger×1000.
unitPriceAgorotintegerIncluding VAT when taxIncluded is true.
descriptionstring | null
itemIdstring | nullCatalog item reference.
vatBp0 | 1800Per-line VAT; omitted = the document vatBp. 0 marks an exempt line.
discountValue, discountTypeinteger, 1 | 2Per-line discount.
isHeadingbooleanA titled separator row, no price, skipped by validation and totals.

Mixed baskets work: give each line its own vatBp; VAT is computed and summed per line.

Payments#

FieldTypeNotes
paymentTypeinteger1 card · 2 check · 3 transfer · 4 cash · 5 credit · 7 other · 8 Bit · 9 PayBox · 10 PayPal · 11 in-kind · 12 Payoneer · 13 Google Pay · 14 Apple Pay · 15 bitcoin · 16 ethereum · 17 BUYME voucher · 18 gift voucher · 19 V-CHECK · 20 Colu. (6, 21, 22 are deductions — see below.)
amountAgorotinteger > 0
dateYYYY-MM-DDReceived date / check due date.
bankName, branch, account, checkNumber, cardLast4, notestring | nullOptional detail.
isDepositbooleanReceipts only.

Payment documents (types 2, 3, 9, 11) must satisfy sum(payments.amountAgorot) + withholdingAgorot == total, or the call fails with 422. Deductions at source (payment types 6, 21, 22) are never sent as payment rows — use withholdingAgorot.

Document types#

docTypeDocumentNotes
1חשבונית מסNeeds customerName. Payments are not used.
2קבלהPayments must equal the total. VAT is forced to 0. Set referenceDocIds to the invoice(s) it settles.
3חשבונית מס קבלהPayments must equal the total.
4חשבונית זיכויreferenceDocIds with exactly one issued invoice/receipt (not another credit note).
5חשבון עסקה
6הזמנת עבודה
7הצעת מחירMay not reference other documents.
8תעודת משלוח
9הפקדהPayment document.
11קבלה על תרומהPayment document, no VAT. See the caveat below.
12תעודת החזרהreferenceDocIds with exactly one issued delivery note (8).
13הזמנת רכשTo a supplier; may not reference documents.
14חשבונית עצמיתNeeds customerUniqueId (the supplier's ID); no references; vatMode may not be none.
15חשבונית זיכוי עצמיתreferenceDocIds with exactly one issued self-invoice (14).

(There is no type 10.)

Examples per document type#

All examples use the native shape; add "apiIdentifier" at the top level as shown in the first example.

Receipt against an invoice#

Issued invoice 3f2b7c1e-… (₪1,180) is paid by Bit. The receipt's single line is the amount received; VAT is 0 on receipts.

json
{
  "apiIdentifier": "receipt-for-inv-1042",
  "document": {
    "docType": 2,
    "customerName": "נועה לוי",
    "subject": "קבלה על חשבונית מס 1042",
    "taxIncluded": true,
    "vatBp": 0,
    "issueDate": "2026-09-29",
    "referenceDocIds": ["3f2b7c1e-9d4a-4c55-8a51-6d1e0f6b7a10"],
    "lines": [{ "name": "תשלום עבור חשבונית מס 1042", "quantityMilli": 1000, "unitPriceAgorot": 118000 }],
    "payments": [{ "paymentType": 8, "amountAgorot": 118000, "date": "2026-09-29" }]
  }
}

When the receipt brings the invoice's open balance to zero, a document.paid webhook fires for the invoice.

Credit note#

json
{
  "apiIdentifier": "credit-inv-1042",
  "document": {
    "docType": 4,
    "customerName": "נועה לוי",
    "customerUniqueId": "301234567",
    "subject": "זיכוי על חשבונית מס 1042",
    "taxIncluded": true,
    "vatBp": 1800,
    "issueDate": "2026-09-29",
    "referenceDocIds": ["3f2b7c1e-9d4a-4c55-8a51-6d1e0f6b7a10"],
    "lines": [{ "name": "ייעוץ שעתי — זיכוי", "quantityMilli": 1000, "unitPriceAgorot": 35000 }]
  }
}

The credited total may not exceed the referenced document's total; a fully credited or cancelled document cannot be credited again.

חשבונית מס (no payment)#

json
{
  "apiIdentifier": "inv-2026-0917",
  "document": {
    "docType": 1,
    "customerName": "חנות הפרחים של דנה בע\"מ",
    "customerUniqueId": "514987654",
    "subject": "שירותי תחזוקה — ספטמבר",
    "taxIncluded": false,
    "vatBp": 1800,
    "issueDate": "2026-09-29",
    "dueDate": "2026-10-29",
    "lines": [{ "name": "מנוי תחזוקה חודשי", "quantityMilli": 1000, "unitPriceAgorot": 29000 }]
  }
}

Here taxIncluded: false, so ₪290 is the price before VAT and the total is ₪342.20.

Donation receipt#

json
{
  "apiIdentifier": "donation-2026-00871",
  "document": {
    "docType": 11,
    "customerName": "משפחת אברהם",
    "customerUniqueId": "300123456",
    "subject": "תרומה לקרן מלגות",
    "taxIncluded": false,
    "vatBp": 0,
    "issueDate": "2026-09-29",
    "lines": [{ "name": "תרומה", "quantityMilli": 1000, "unitPriceAgorot": 36000, "vatBp": 0 }],
    "payments": [{ "paymentType": 1, "amountAgorot": 36000, "date": "2026-09-29", "cardLast4": "4242" }]
  }
}

Caveat: a donation is never subject to VAT, so use vatBp: 0. A document issued through this endpoint goes through the generic engine only. The dashboard's donation flow additionally checks the organisation's §46 details, prints the §46 legal text and reports the donation to the Tax Authority; the API does not. Use the dashboard flow for donations that must be reported.

Foreign currency#

json
{ "currency": "USD", "fxRateMillionths": 3710000 }

Add these two fields to any document; without an exchange rate a non-ILS document is refused, because the books need the shekel value.

Invoice4U-compatible shape#

json
{
  "doc": {
    "DocumentType": 3,
    "Subject": "תשלום חודשי",
    "ClientName": "לקוח בע\"מ",
    "ClientEmail": "[email protected]",
    "UniqueID": "515131274",
    "TaxIncluded": true,
    "TaxPercentage": 18,
    "ApiIdentifier": "order-12345",
    "Items": [{ "Name": "מנוי חודשי", "Quantity": 1, "Price": 1180, "TaxPercentage": 18 }],
    "Payments": [{ "PaymentType": 3, "Amount": 1180, "Date": "/Date(1723372800000)/" }]
  },
  "token": "bk_…"
}

Response:

json
{ "d": { "DocumentNumber": 5001, "ID": "…", "UniqueID": "…", "IsSuccess": true, "ErrorMessage": null,
         "PrintOriginalPDFLink": "https://…/view", "PrintCertifiedCopyPDFLink": "https://…/view" } }

Field mapping and rules:

  • Items[].Price is shekels (float) and becomes agorot; Quantity becomes quantityMilli; TaxPercentage (document or line) must be 0 or 18.
  • Payments[].Date accepts /Date(1723372800000)/ or an ISO date/datetime.
  • ApiIdentifier is required and non-blank (it is the idempotency key). Items is required and non-empty.
  • ClientName is required for DocumentType 1 and 4; for 2 and 3 a blank name falls back to "לקוח/ה".
  • Currency ≠ ILS needs ExchangeRate (ILS per unit, float).
  • RoundAmount non-zero rounds the total to whole shekels.
  • UniqueID maps to the buyer's ID. Total and Items[].Total are accepted and ignored.
  • The issue date is always today (UTC). There is no way to back-date in this shape, and no referenceDocIds, so credit notes (4), return notes (12), self-credits (15) and receipts that must reference an invoice cannot be issued this way — use the native shape.
  • DocumentNumber is an integer; in sandbox it is the string "SBX-000123".
  • Errors come as {"d":{"IsSuccess":false,"ErrorMessage":"…"}} with the HTTP status of the failure.

Validation (native shape)#

Checked in this order, first failure wins, each answers 422 with a specific message:

RuleMessage shape
document missingdocument is required
lines empty / missinglines is required (non-empty array); more than 500 → too many lines (max 500)
Money not a whole number, or beyond ±10¹² agorotlines[0].unitPriceAgorot must be an integer between -1000000000000 and 1000000000000
vatBp (document or line) not 0 or 1800vatBp: unsupported VAT rate 17% — only 0% (exempt) or 18% (statutory) are accepted
issueDate malformed or outside the windowissueDate must be an ISO date YYYY-MM-DD / issueDate must be between 2026-08-30 and 2026-09-30
Business rules (engine)a credit note must reference exactly one document, payments (…) + withholding (…) must equal total (…), document total must be positive, withholding applies to payment documents only, payment amounts must be positive, currency/exchange-rate and reference rules, Hebrew messages for the newer document types

Plan refusals are also 422: the free plan cannot issue through the API, and past the monthly allowance issuing is refused, both with a Hebrew message.

Send subject and customerName on every document; the engine requires them.

Webhooks and side effects#

A newly issued document fires document.issued; a settled reference additionally fires document.paid. A repeat call for an existing apiIdentifier fires nothing. Fiscal documents are hash-chained and digitally signed at issue (unless unsigned is set). Do not rely on the API to email the customer: store customerEmail on the document and deliver the document yourself.

Status codes#

200 issued or existing · 400 body is not JSON · 401 bad key · 403 dormant · 422 refused · 429 rate limited. See errors.

POST /api/billing/v1/create-document — SLK Invoices API