Create a cash transaction
const url = 'https://api.sancho-wms.pl/v1/cashTransactions.create';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"integrationId":1,"importSource":{"appId":"example","rowId":"example"},"values":{"integrationType":"comarch-optima","cashAccountId":1,"cashStatementId":1,"date":"2026-04-15","direction":"incoming","amount":1,"documentSymbol":"example","party":{"kind":"counterParty","id":1},"externalNumber":"example","description":"example","bankAccountNumber":"example","categoryId":1,"settlements":[{"cashFlowItemId":1,"amount":1}]}}'};
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/cashTransactions.create \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "integrationId": 1, "importSource": { "appId": "example", "rowId": "example" }, "values": { "integrationType": "comarch-optima", "cashAccountId": 1, "cashStatementId": 1, "date": "2026-04-15", "direction": "incoming", "amount": 1, "documentSymbol": "example", "party": { "kind": "counterParty", "id": 1 }, "externalNumber": "example", "description": "example", "bankAccountNumber": "example", "categoryId": 1, "settlements": [ { "cashFlowItemId": 1, "amount": 1 } ] } }'Writes one bank-statement line or cash slip into a cash account, with the cash-flow items it settles, in one save: everything lands or nothing does. importSource names the application the record comes from (appId) and its key there (rowId), which the ERP keeps as the record’s import mark. The ERP refuses a rowId it already holds, whatever the appId or letter case (422 duplicateDocument). A create is never replayed: after a lost answer, find the record by importAppId and importRowId before sending again. The cash account must exist and be active (invalidReference at cashAccountId) and be in the company’s base currency, baseCurrency on accounting.profile (notSupported at cashAccountId). With cashStatementId null the transaction goes into the statement covering date; a closed one is 422 statementClosed, a day after every statement opens a new one, and a day in a gap between statements is 422 noOpenStatement. party null takes the first settled cash-flow item’s. The amount may be part of either document, never more than what is left on it (settlementExceedsRemaining); both must be in the same currency (settlementCurrencyMismatch) and subject to settlement (settlementNotApplicable). The ERP keeps these amounts to two decimals, from 0.01 to 9999999999999.99. An amount within 0.00000001 of two decimals (a little more for very large amounts, where a number cannot be told apart more finely) is written rounded to two decimals: 0.30000000000000004 as 0.3, 0.010000001 as 0.01. An amount further from two decimals is 422 notSupported at its path, and so is one that rounds to zero or to more than 9999999999999.99. An ERP that keeps the ledger’s settlement items apart from its cash-flow items mirrors a settlement into the ledger itself in a company with double-entry books; when that fails the write still stands and warnings carries stage ledgerSyncFailed with the ERP’s own text.
Authorizations
Abschnitt betitelt „Authorizations“Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“object
object
object
object
Responses
Abschnitt betitelt „Responses“Successful response
object
object
object
object
object
object
Example
{ "result": { "direction": "incoming", "method": "cash", "settlementStatus": "notApplicable", "party": { "kind": "counterParty" }, "status": "draft", "integrationType": "comarch-optima", "settlements": [ { "integrationType": "comarch-optima" } ] }, "warnings": [ { "stage": "ledgerSyncFailed" } ]}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": []}