Update an accounting document
const url = 'https://api.sancho-wms.pl/v1/accountingDocuments.update';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"integrationId":1,"id":1,"expectedModifiedAt":"example","values":{"documentType":"invoice","documentNumber":"example","issueDate":"2026-04-15","operationDate":"2026-04-15","taxPointDate":"2026-04-15","dueDate":"2026-04-15","currency":{"symbol":"example","rate":1,"units":1,"date":"2026-04-15"},"eInvoice":{"system":"ksef","number":"example"},"notes":"example","taxReporting":{"country":"PL","ksefMarker":"OFF","vatDeclarationMonth":"example","gtu":["GTU_01"],"procedures":["WSTO_EE"],"documentMarker":"FP","splitPayment":true,"cashAccounting":true},"counterPartyId":1,"paymentMethodId":1,"precedingInvoice":{"id":1,"number":"example","issueDate":"2026-04-15","eInvoiceNumber":"example"},"kind":"purchase","receiptDate":"2026-04-15","lines":[{"description":"example","net":1,"tax":1,"taxRate":{"percent":1,"category":"standardRated"},"account":{"kind":"number","number":"example"},"dimensions":[{"dimensionId":1,"valueId":1}],"deductible":"full","lineKind":"goods","categoryId":1}],"integrationType":"comarch-optima","vatRegisterId":1,"transactionKind":"domestic","categoryId":1,"categoryDescription":"example","proposedJournalEntry":{"journalId":1,"bookingDate":"2026-04-15","description":"example","lines":[{"debitAccount":{"kind":"number","number":"example"},"creditAccount":{"kind":"number","number":"example"},"amount":1,"description":"example","categoryId":1}]},"deductionDate":"2026-04-15"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sancho-wms.pl/v1/accountingDocuments.update \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "integrationId": 1, "id": 1, "expectedModifiedAt": "example", "values": { "documentType": "invoice", "documentNumber": "example", "issueDate": "2026-04-15", "operationDate": "2026-04-15", "taxPointDate": "2026-04-15", "dueDate": "2026-04-15", "currency": { "symbol": "example", "rate": 1, "units": 1, "date": "2026-04-15" }, "eInvoice": { "system": "ksef", "number": "example" }, "notes": "example", "taxReporting": { "country": "PL", "ksefMarker": "OFF", "vatDeclarationMonth": "example", "gtu": [ "GTU_01" ], "procedures": [ "WSTO_EE" ], "documentMarker": "FP", "splitPayment": true, "cashAccounting": true }, "counterPartyId": 1, "paymentMethodId": 1, "precedingInvoice": { "id": 1, "number": "example", "issueDate": "2026-04-15", "eInvoiceNumber": "example" }, "kind": "purchase", "receiptDate": "2026-04-15", "lines": [ { "description": "example", "net": 1, "tax": 1, "taxRate": { "percent": 1, "category": "standardRated" }, "account": { "kind": "number", "number": "example" }, "dimensions": [ { "dimensionId": 1, "valueId": 1 } ], "deductible": "full", "lineKind": "goods", "categoryId": 1 } ], "integrationType": "comarch-optima", "vatRegisterId": 1, "transactionKind": "domestic", "categoryId": 1, "categoryDescription": "example", "proposedJournalEntry": { "journalId": 1, "bookingDate": "2026-04-15", "description": "example", "lines": [ { "debitAccount": { "kind": "number", "number": "example" }, "creditAccount": { "kind": "number", "number": "example" }, "amount": 1, "description": "example", "categoryId": 1 } ] }, "deductionDate": "2026-04-15" } }'Replaces a document with the full image in values: header, lines, JPK_V7 codes and proposed journal entry, and answers result, the document as accountingDocuments.get reads it after the write, with warnings (empty for now). The ERP recalculates its cash-flow items from the new amounts, so read them again after an update. expectedModifiedAt is the modifiedAt you read; a document changed since (by the accountant, or by an edit of its proposed journal entry) is 409 documentConflict. A document keeps its kind (vatRegisterKindMismatch). Any document can be changed, the accountant’s own included. A document with a booking entry, a draft entry included, is 422 documentPosted, one exported to an accounting office 422 documentExported unless the connector’s ERP operator may change exported documents, and one whose VAT return month is in an approved, final return 422 taxPeriodClosed. A settled payment does not stop a change, as in the ERP: an update keeps the settlement against the new amount, and a delete removes the payment with its settlements, leaving the cash transaction unsettled. A value the ERP cannot store is 422 notSupported with its path: documentType creditNote, debitNote or other, a precedingInvoice, a line’s account or dimensions, an eInvoice whose system is not ksef, taxReporting: null, a line taxRate.category that would read back as another under the transactionKind (an exempt or outOfScope line states 0 for both taxRate.percent and tax), a documentType or taxReporting.documentMarker the document’s VAT register would read back otherwise, and taxReporting.gtu or taxReporting.procedures codes on a purchase, which mark only sales. proposedJournalEntry is the journal entry you approved, kept on the document until it is posted; it needs double-entry books and the ERP’s general-ledger module (notDoubleEntry, ledgerNotLicensed otherwise), a fiscal year containing bookingDate (noFiscalYear), a journal of that year (invalidReference at proposedJournalEntry.journalId) and accounts a line may book onto (invalidReference at the line’s account, ledgerAccountNotPostable). Name an account as { kind: "number", number } or { kind: "subledger", parentNumber, entry }: a counterparty’s subledger account is opened when missing. Send proposedJournalEntry: null for a company without double-entry books (bookkeeping kpir or ryczalt).
Authorizations
Dział zatytułowany „Authorizations”Request Bodyrequired
Dział zatytułowany „Request Bodyrequired”object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Responses
Dział zatytułowany „Responses”Successful response
object
object
object
object
object
object
object
object
object
object
object
object
Example
{ "result": { "kind": "purchase", "documentType": "invoice", "origin": "invoice", "status": "draft", "eInvoice": { "system": "ksef" }, "journalEntry": { "status": "draft" }, "taxReporting": { "country": "PL", "ksefMarker": "OFF", "gtu": [ "GTU_01" ], "procedures": [ "WSTO_EE" ], "documentMarker": "FP" }, "integrationType": "comarch-optima", "transactionKind": "domestic", "lines": [ { "taxRate": { "category": "standardRated" }, "deductible": "full", "lineKind": "goods", "rateStatus": "exempt" } ], "cashFlowItems": [ { "direction": "incoming", "settlementStatus": "notApplicable" } ] }, "warnings": [ { "stage": "placements" } ]}Bad request
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "BAD_REQUEST", "message": "Bad request", "issues": []}Unauthorized
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "UNAUTHORIZED", "message": "Unauthorized", "issues": []}Payment required
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "PAYMENT_REQUIRED", "message": "Payment required", "issues": []}Forbidden
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "FORBIDDEN", "message": "Forbidden", "issues": []}Not found
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "NOT_FOUND", "message": "Not found", "issues": []}Conflict
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "CONFLICT", "message": "Conflict", "issues": []}Unprocessable content
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "UNPROCESSABLE_CONTENT", "message": "Unprocessable content", "issues": []}Too many requests
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "TOO_MANY_REQUESTS", "message": "Too many requests", "issues": []}Internal server error
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "INTERNAL_SERVER_ERROR", "message": "Internal server error", "issues": []}Service unavailable
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "SERVICE_UNAVAILABLE", "message": "Service unavailable", "issues": []}