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 — always confirm against /newsearch/... doctype admin or your Linet admin 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 /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. status: 2 issues the document; leaving it out saves a draft.

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_digtis
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_digtis: { value: 7098 }
  }
]
The extra fields are wrapped in { value: … }. That's not decorative — it's how Linet distinguishes a plain value from an EAV‑style typed field on the payment line. Copy the shape from these examples rather than flattening it.

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.

Find it again

POST /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.