Перейти до вмісту

Book an accounting document

POST
/accountingDocuments.post
curl --request POST \
--url https://api.sancho-wms.pl/v1/accountingDocuments.post \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "integrationId": 1, "id": 1 }'

Books the document by its proposed journal entry into that entry’s journal and answers result, the document as accountingDocuments.get reads it after the booking, with warnings (empty for now). An ERP that books into a draft journal answers the document with status: draft and journalEntry.status: draft until the accountant approves the entry in the ERP; a document whose entry is approved reads status: posted with journalEntry.status: posted. A document already booked to a journal entry, by an earlier call, by the accountant or by the ERP’s automatic booking, answers the document and writes nothing, and nothing in the answer says which. A document without a proposed journal entry is 422 noProposedJournalEntry, a booking date outside every fiscal year 422 noFiscalYear, a closed fiscal year 422 periodLocked, and a booking the ERP declined 422 postingFailed. Needs double-entry books and the ERP’s general-ledger module: 422 notDoubleEntry or ledgerNotLicensed otherwise.

Media typeapplication/json
object
integrationId
required
number
id
required
Any of:
integer
> 0 <= 9007199254740991

Example generated

{
"integrationId": 1,
"id": 1
}

Successful response

Media typeapplication/json
AccountingDocumentWriteResult
object
result
required
AccountingDocument
One of: discriminator: integrationType
ComarchOptimaAccountingDocument
object
id
required
number
kind
required
string
Allowed values: purchase sales
documentType
required
string
Allowed values: invoice creditNote debitNote customsDeclaration internalDocument salesSummary other
origin
required
string
Allowed values: invoice other eInvoice imported manual
status
required
string
Allowed values: draft approved posted reversed voided
number
required
string | null
documentNumber
required
string
invoiceId
required
number | null
counterParty
required
Any of:
object
id
required
number | null
name
required
string
taxId
required
string | null
taxIdCountry
required
string | null
country
required
string | null
issueDate
required
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
operationDate
required
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
receiptDate
required
Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
taxPointDate
required
Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
recordedDate
required
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
dueDate
required
Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
paymentMethodId
required
number | null
currency
required
string
exchangeRate
required
Any of:
DocumentExchangeRateOutput
object
rate
required
number
units
required
number
date
required
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
sourceId
required
number
totals
required
object
net
required
number
tax
required
number
gross
required
number
totalsBase
required
object
net
required
number
tax
required
number
gross
required
number
eInvoice
required
Any of:
EInvoice
object
system
required
string
Allowed values: ksef sdi peppol other
number
required
string
>= 1 characters <= 256 characters
precedingInvoice
required
null
notes
required
string | null
journalEntry
required
Any of:
object
id
required
number
number
required
string
journalId
required
number
status
required
string
Allowed values: draft approved posted reversed voided
taxReporting
required
Any of:
TaxReporting
One of: discriminator: country
PlTaxReporting
object
country
required
string
Allowed value: PL
ksefMarker
required
Any of:
string
Allowed values: OFF BFK DI
vatDeclarationMonth
required
Any of:
string
/^\d{4}-(0[1-9]|1[0-2])$/
gtu
required
Array<string>
Allowed values: GTU_01 GTU_02 GTU_03 GTU_04 GTU_05 GTU_06 GTU_07 GTU_08 GTU_09 GTU_10 GTU_11 GTU_12 GTU_13
procedures
required
Array<string>
Allowed values: WSTO_EE IED TP TT_WNT TT_D MR_T MR_UZ I_42 I_63 B_SPV B_SPV_DOSTAWA B_MPV_PROWIZJA
documentMarker
required
Any of:
string
Allowed values: FP MK VAT_RR
splitPayment
required
boolean
cashAccounting
required
boolean
modifiedAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
modifiedBy
required
string | null
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
createdBy
required
string | null
importSource
required
Any of:
ImportSourceOutput
object
appId
required
string
rowId
required
string
integrationId
required
number
integrationType
required
string
Allowed value: comarch-optima
vatRegisterId
required
number | null
vatRegisterCode
required
string
position
required
number
transactionKind
required
string
Allowed values: domestic nonEu nonEuVatRefund intraCommunity intraCommunityTriangular domesticBuyerLiable outsideCountry outsideCountryNp intraCommunityBuyerLiable nonEuBuyerLiable ossProcedure smeProcedure
categoryId
required
number | null
categoryDescription
required
string | null
deductionDate
required
Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
otherJpkCodes
required
Array<string>
lines
required
Array<object>
ComarchOptimaAccountingDocumentLine
object
id
required
number
description
required
string | null
net
required
number
tax
required
number
taxRate
required
object
percent
required
number | null
category
required
string
Allowed values: standardRated zeroRated exempt reverseCharge intraCommunity export outOfScope other
deductible
required
Any of:
string
Allowed values: full none partial
account
required
null
dimensions
required
null
lineKind
required
string
Allowed values: goods other fixedAssets services vehicles realEstate fuel
rateSymbol
required
string
rateStatus
required
string
Allowed values: exempt taxable reduced notSubject
includeInProRata
required
boolean | null
categoryId
required
number | null
cashFlowItems
required
Array<object>
object
id
required
number
dueDate
required
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
amount
required
number
currency
required
string
paymentMethodId
required
number | null
cashAccountId
required
number | null
direction
required
string
Allowed values: incoming outgoing
settlementStatus
required
string
Allowed values: notApplicable unsettled partiallySettled settled
proposedJournalEntry
required
Any of:
ComarchOptimaProposedJournalEntry
object
id
required
number
journalId
required
number
journalCode
required
string
bookingDate
required
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
description
required
string | null
lines
required
Array<object>
object
id
required
number
debitAccount
required
Any of:
object
id
required
number
number
required
string
name
required
string
creditAccount
required
Any of:
object
id
required
number
number
required
string
name
required
string
amount
required
number
description
required
string | null
categoryId
required
number | null
warnings
required
Array<object>
WriteWarning
object
stage
required
string
Allowed values: placements documents tags participants images assetExtras
detail
required
string

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

Media typeapplication/json
error.BAD_REQUEST

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "BAD_REQUEST",
"message": "Bad request",
"issues": []
}

Unauthorized

Media typeapplication/json
error.UNAUTHORIZED

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "UNAUTHORIZED",
"message": "Unauthorized",
"issues": []
}

Payment required

Media typeapplication/json
error.PAYMENT_REQUIRED

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "PAYMENT_REQUIRED",
"message": "Payment required",
"issues": []
}

Forbidden

Media typeapplication/json
error.FORBIDDEN

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "FORBIDDEN",
"message": "Forbidden",
"issues": []
}

Not found

Media typeapplication/json
error.NOT_FOUND

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}

Conflict

Media typeapplication/json
error.CONFLICT

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "CONFLICT",
"message": "Conflict",
"issues": []
}

Unprocessable content

Media typeapplication/json
error.UNPROCESSABLE_CONTENT

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "UNPROCESSABLE_CONTENT",
"message": "Unprocessable content",
"issues": []
}

Too many requests

Media typeapplication/json
error.TOO_MANY_REQUESTS

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "TOO_MANY_REQUESTS",
"message": "Too many requests",
"issues": []
}

Internal server error

Media typeapplication/json
error.INTERNAL_SERVER_ERROR

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}

Service unavailable

Media typeapplication/json
error.SERVICE_UNAVAILABLE

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "SERVICE_UNAVAILABLE",
"message": "Service unavailable",
"issues": []
}