Find invoices, credit notes, sell-side debit notes, quotes, delivery orders, bills, buy-side debit notes and purchase orders by any combination of: doc number (partial), party (customer/vendor) name (partial), date range, amount range, due-date window (invoices and bills), and doc type. Returns compact rows (docId, type, number, date, party, total, status), newest first, capped — with a `more` flag when there are further matches to narrow down. INVOICE rows carry two more fields: `refNo`, the CUSTOMER's own reference for that job — their delivery-order or purchase-order number, the one they quote back at you on the phone — and `dueDate`, the date that invoice falls due. `refNo` is NOT the invoice number; the invoice's own number is `number`. `refNo` is null when the invoice was raised without one. `dueDate` is null on a CASH sale — paid at the counter, so it is not money anyone is waiting on and it deliberately sits outside every due-date window and aging bucket; a null there means CASH, not a missing date. Only CREDIT invoices report one. BILL rows carry `dueDate` too — the date a supplier bill falls due, from the payment term printed on it, and null on a CASH bill for the same reason. Only invoices carry `refNo` (a bill's own `number` IS the supplier's number, so it needs no second field — except a bill converted from a purchase order with no supplier number typed, which carries that purchase order's number), and only invoices and bills carry `dueDate` — every other type omits them rather than reporting null about a column its document has no such thing as. `number` searches BOTH, so "find INV-0031" and "find the invoice for their DO 1074" are the same call. An invoice reversed from a marketplace Returns page (Shopee, TikTok or Shopify) reports status 'Reversed (Returns page)' — a reversing journal entry took it out of the books, so it is neither paid nor owed. Invoices, credit notes, bills and quotes also report whether their ORIGINAL document (a scan or upload) is on file: `hasAttachment` plus an `attachments` list you can fetch with get_attachment. Delivery orders and purchase orders omit that field because they cannot carry an original. INVOICES, CREDIT NOTES and SELL-SIDE DEBIT NOTES (`sales_debit_note` — additional charges this business added to an invoice it issued; not to be confused with `debit_note`, the buy-side one raised against a supplier bill) also carry an `einvoice` field — this business's MyInvois posture for that document AS RECORDED IN TAOKEH: `validated` (a MyInvois validation is recorded here, with uuid + validatedAt), `consolidated` (covered by a consolidated e-invoice, which holds the uuid — the individual document has none by design), `platform` (a marketplace sale: Shopee/TikTok Shop/Lazada issues the e-invoice, nothing for this business to submit), `exported` (put into a MyInvois batch export from Taokeh, nothing recorded back yet) or `none`. Taokeh CANNOT see the MyInvois portal, so say "no validation recorded in Taokeh" — never "never submitted to LHDN". Bills and buy-side debit notes omit the field. Use the `docId` with get_attachment (the SOURCE document someone filed) or get_document_pdf (the PDF Taokeh generates). PAYMENTS — docType:'payment' — are an OPT-IN type you must ask for BY NAME: they are never included when you omit docType, because a payment is not a document. It is a BANK LINE that invoices or bills point at, so the grain is the movement of money: one receipt that settles three invoices is ONE row carrying three `allocations` ({docId, docType, docNumber, party, amount, amountForeign, notes}). An allocation's `docType` is the real kind of the document settled — 'invoice', 'credit_note' (a refund walks a credit note back), 'sales_debit_note', 'bill' or 'debit_note' — not an assumption from which side of the books it sits on, and `notes` is that allocation's own note rather than one note borrowed for the whole transfer. That makes "which payment covered INV-0031" a single call — `number` and `party` here match the ALLOCATED documents, not the bank line, and on the invoice side `number` also matches the customer's own Ref No (their DO/PO number, or a marketplace order key), exactly as it does for invoices in the ordinary search. Each row: `docId` (⚠ a BANK TRANSACTION id, NOT a document id — do not hand it to get_document_pdf or get_attachment), `date`, `direction` ('in'/'out'), `total` (the bank line's own magnitude), `status` (the bank row's status), `bankAccount`, `party` (the single customer or supplier when every allocation is to the same one, else null — read the per-allocation `party` then), `source` and `description` (the bank line as stored). `source` is DERIVED from where the line came from, not stored: 'statement' (it arrived on an imported bank statement and a human matched it in Banking), 'receipt_draft' or 'payment_draft' (an AI-filed draft the owner approved), or 'manual' — recorded by hand in the app, which is EVERYTHING ELSE rather than one door: the receipt door, the /go command bar, the supplier-payment door, a refund against a hand-recorded line. Taokeh does not distinguish them, so do not tell the owner which screen was used. A NEGATIVE allocation amount is a REFUND walking that document back down, not a settlement. CONTRAS ARE NOT PAYMENTS and never appear here: a set-off moves no bank money, and Taokeh books it as two internal clearing lines which are excluded from this read on purpose. To see one, use search_journal or the contra note on the documents themselves.
ConnectorOAuth