L Linet Developers
Home / Journeys / Create a document
Journey 02 · Documents

Create a document: doctype, line items, payments

Every Linet document — quote, delivery, invoice, receipt — is one docType, a set of docDet line items, and (for anything that collects money) a set of docCheq payment lines. One endpoint creates all three together.

Pick a doctype

doctype is an integer pointing at a row in Linet's document‑type table — it decides the document's numbering series, layout, and whether it's a sellable document, a stock movement, or a receipt. Every company starts with the same default set; companies can add custom ones on top (that's why this isn't a fixed global enum — list the company's document types with POST /newsearch/doctype (same body as any other search) if you're unsure). The ones you'll reach for most:

idNameCollects payment?
3Invoice (חשבונית מס)No
8Receipt (קבלה)Yes
9Invoice Receipt (חשבונית מס קבלה)Yes
2Delivery DocumentNo
6QuoteNo
4Credit InvoiceNo

If it collects payment, it needs at least one docCheq line (step 3). If it doesn't, leave docCheq out entirely.

Create it, with its line items

POST https://app.linet.org.il/api/create/docs Full reference →

A plain invoice: an account_id (who it's billed to), the doctype, and one docDet line per item sold. iItem is the line's unit price; iItemWithVat says whether that price already includes VAT.

account_id: 113,
doctype: 3,
company: "Testing",
currency_id: "ILS",
status: 2,
docDet: [
  {
    item_id: 1,
    name: "Phone",
    qty: 1,
    iItem: 50,
    iItemWithVat: 1
  }
]

account_id refers to an existing account (customer) — see the accounts endpoints in the reference if you need to create one first. company is the customer name as it will be printed on the document — not the Linet company, which comes from the login-company header. status: 2 issues the document; leaving it out saves a draft.

The response's body is the saved document, including its id and docnum. If errorCode is 1001 the document was not created — even though the response says status: 200 — and body lists the fields that failed.

Add payment lines, if the doctype collects money

A docCheq array turns the same call into a receipt. Each line has a type that decides which extra fields it needs:

typeMethodExtra fields
1Cash—
2Chequecheque_date, cheque_acct, bank, branch
3Credit cardauth_number, last_4_digits
4Bank transferaccount_id, due_date, bank_acc, bank, branch

An invoice‑receipt (doctype: 9) paid half by cheque, half by credit card:

doctype: 9,
account_id: 113,
company: "Testing",
currency_id: "ILS",
status: 2,
docDet: [
  { item_id: 1, name: "Phone", qty: 1, iItem: 50, iItemWithVat: 1 },
  { item_id: 2, name: "Tablet", qty: 1, iItem: 50, iItemWithVat: 1 }
],
docCheq: [
  {
    type: 2, sum: 20,
    cheque_date: { value: "2024-08-07" },
    cheque_acct: { value: 612123 },
    bank: { value: 12 },
    branch: { value: 696 }
  },
  {
    type: 3, sum: 60,
    auth_number: { value: 123456 },
    last_4_digits: { value: 7098 }
  }
]
Plain or wrapped — both work. The method-specific fields can be sent plain ("bank": 12) or wrapped as "bank": { "value": 12 }; Linet unwraps the second form. The examples here use the wrapped form.

Payment lines don't have to sum to the document total in one call — a docCheq total under the document's total just leaves it partially paid, same as recording a partial payment by hand.

Get paid by card: a pay link

POST https://app.linet.org.il/api/print/docs/{id} Full reference →

Instead of recording a payment you already took, you can let the customer pay an existing document online. Ask for its pay link with the document's id (from the create response):

pay-href: 1

The answer's body is the public payment page URL (for example https://pay.linet.app/aB3dE5fG7hJ). Send it however you like (email, SMS, a button in your app). It works the moment you get it, and a document has exactly one: asking again, from any user or API key, returns the same URL.

A pay link needs:

  • a proforma, invoice, quote or sales order (doctype 1, 3, 6 or 7);
  • that is still open (not yet paid or closed);
  • in a company with a credit card gateway set up.

Otherwise the answer is status: 422 (HTTP is still 200, as everywhere in this API) with a reason of doctype, closed or no_gateway.

When the customer pays, Linet issues the payment document itself: a receipt (doctype: 8) against an invoice, or an invoice‑receipt (doctype: 9) for the other three. The original document closes, and the next pay-href call on it answers closed. Don't also post a docCheq for that payment, or it is counted twice. The page charges what the document said when the link was made.

Find it again

POST https://app.linet.org.il/api/newsearch/docs Full reference →

Same read‑before‑write shape as the item journey. Query by docnum and/or doctype:

limit: 100,
offset: 0,
query: {
  docnum: 1,
  doctype: 3
}

Documents don't have partial updates the way items do — once issued (status: 2), correct mistakes with a credit document (doctype: 4) rather than editing in place. That's also the point where you'd hand the document's id to the Tax Authority Allocation Number tax‑cert journey if it needs an allocation number.