{"ok":true,"commandType":"create-ap-credit-note","module":"AP","mode":"write","summary":"Create an AP credit note. Supports one or many real supplier invoice knock-offs.","payloadSchema":{"creditorCode":"required AutoCount creditor/supplier code","supplierCreditNoteNo":"supplier credit note number","docDate":"required or optional YYYY-MM-DD document date","amount":"optional single-line amount; lines is preferred for multiple lines","knockOffs":"optional array for credit/debit note knock-off where AutoCount supports it","_arApRule":"AP = supplier/creditor. Use creditorCode only for AP commands; do not send debtorCode for AP.","docNo":"optional AutoCount document number; omit to let AutoCount numbering generate it","dueDate":"optional YYYY-MM-DD due date","description":"optional document description/narration","ref":"optional reference","branchCode":"optional creditor/supplier branch code/name where the customer uses branches","attention":"optional attention/contact person","contact":"optional contact person alias for attention","currencyCode":"optional currency code such as MYR","currencyRate":"optional exchange rate","inclusiveTax":"optional boolean","taxDate":"optional YYYY-MM-DD tax date","accountNo":"required for simple one-line AP payload unless every line has accountNo; use a valid purchase/expense GL account","taxType":"optional tax type/code","lines":"recommended array of AP GL/account rows; each AP line must choose a valid posting account with accountNo / accNo / glAccount / postingAccountNo","userDefinedFields":"optional object of AutoCount user-defined fields"},"examplePayload":{"creditorCode":"400-S001","supplierCreditNoteNo":"SCN-001","docDate":"2026-06-24","amount":100,"knockOffs":[{"docType":"PB","docKey":"424508","docNo":"PI-000001","amount":100,"discountAmount":0,"taxAdjustment":0}],"dueDate":"2026-07-24","description":"AP document created through API","ref":"API-REF-1001","branchCode":"MAIN","attention":"Accounts Department","contact":"Accounts Department","currencyCode":"MYR","inclusiveTax":false,"lines":[{"accountNo":"610-0000","description":"Service line 1","amount":100,"taxType":"S-0","taxCode":"S-0","taxAmount":0,"project":"PRJAPI","projNo":"PRJAPI","department":"HQ","deptNo":"HQ","classification":"022","userDefinedFields":{"APITEST":"API-LINE"}},{"accountNo":"620-0000","description":"Different posting account line","amount":50,"taxType":"S-0","taxCode":"S-0","project":"PRJAPI","projNo":"PRJAPI","department":"HQ","deptNo":"HQ","classification":"022"}],"userDefinedFields":{"APITEST":"API"}},"notes":"Requires write access permission. Real knock-off validation is proven; saving should still be tested per account book. AP = supplier/creditor. Use creditorCode only for AP commands; do not send debtorCode for AP. Use read-ap-outstanding-documents first when a knock-off needs docKey. For simple invoices, amount/accountNo still works. For multiple posting accounts, send lines and put accountNo on each line. AR/AP invoice/note posting account order is: lines[].accountNo/top-level accountNo, AutoCount default account only when needed, then safe recent same-party history where the connector has a proven read path.","nativePayload":{"supported":false,"sections":[{"name":"Master","fields":[]},{"name":"Details","fields":[]},{"name":"KnockOffDetails","fields":[]},{"name":"TransferDetails","fields":[]},{"name":"PaymentDetails","fields":[]},{"name":"Options","fields":[]}]}}