Skip to content

Get an invoice

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

Returns one invoice with its lines (items), in the shape of a list item plus what Sancho keeps beside it: customFields, customFieldsMeta and snapshotSavedAt, when a Sancho save last wrote it. Identify it by integrationId, id and kind (purchase or sales) as the list gives them; a kind the document does not have answers not found.

Media typeapplication/json
object
id
required
number | string
integrationId
required
number
kind
required
string
Allowed values: purchase sales

Successful response

Media typeapplication/json
InvoiceDetails
One of: discriminator: integrationType
ComarchOptimaInvoiceDetails
object
id
required
number | string
type
required
string
Allowed value: invoice
kind
required
string
Allowed values: purchase sales
documentNumber
required
string | null
externalNumber
required
string | null
issueDate
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])))$/
saleDate
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])))$/
paymentDueDate
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])))$/
currency
required
string | null
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
warehouse
required
Any of:
object
id
required
number | string
code
required
string | null
name
required
string | null
totalNet
required
number | null
totalGross
required
number | null
totalVat
required
number | null
status
required
string
Allowed values: draft committed cancelled
documentSymbol
required
string | null
accountingDocumentId
required
number | null
relatedDocuments
required
Array<object>
default:
RelatedDocumentOutput
One of: discriminator: integrationType
IntegrationRelatedDocumentOutput
One of: discriminator: integrationType
object
label
required
string | null
linkId
required
number | null
integrationType
required
string
Allowed values: comarch-optima erp-next fakturownia comarch-bmp custom
integrationId
required
number
id
required
number | string
type
required
string
Allowed value: goodsReceivedNote
kind
required
string
Allowed values: external internal
modifiedAt
required
Any of:
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
integrationId
required
number
integrationType
required
string
Allowed value: comarch-optima
subject
required
Any of:
DocumentSubject
object
id
required
number | string
code
required
string | null
name
required
string
taxId
required
string | null
address
required
string | null
city
required
string | null
postalCode
required
string | null
country
required
string | null
countryCode
required
string | null
status
required
string
Allowed values: draft committed
active
required
boolean | null
vatTransactionKind
required
Any of:
string
Allowed values: domestic nonEu nonEuVatRefund intraCommunity intraCommunityTriangular domesticBuyerLiable outsideCountry outsideCountryNp intraCommunityBuyerLiable nonEuBuyerLiable ossProcedure smeProcedure
taxIdCountry
required
string | null
currency
required
string | null
kind
required
string
Allowed values: counterparty employee
recipient
required
Any of:
DocumentSubject
object
id
required
number | string
code
required
string | null
name
required
string
taxId
required
string | null
address
required
string | null
city
required
string | null
postalCode
required
string | null
country
required
string | null
countryCode
required
string | null
status
required
string
Allowed values: draft committed
active
required
boolean | null
vatTransactionKind
required
Any of:
string
Allowed values: domestic nonEu nonEuVatRefund intraCommunity intraCommunityTriangular domesticBuyerLiable outsideCountry outsideCountryNp intraCommunityBuyerLiable nonEuBuyerLiable ossProcedure smeProcedure
taxIdCountry
required
string | null
currency
required
string | null
kind
required
string
Allowed values: counterparty employee
items
required
Array<object>
object
productId
required
number | string | null
productCode
required
string | null
productName
required
string | null
quantity
required
number | null
unit
required
string | null
priceNet
required
number | null
priceNetBeforeDiscount
required
number | null
discountPercent
required
number | null
pricePrecision
required
integer
default: 2 >= 2 <= 4
quantityPrecision
required
integer
default: 4 <= 4
valueNet
required
number | null
valueGross
required
number | null
vatRate
required
number | null
customFields
required
object
key
additional properties
CustomFieldValue
One of:
object
type
required
string
Allowed value: text
value
required
string
customFieldsMeta
required
CustomFieldsMeta
object
key
additional properties
object
savedAt
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))$/
user
required
object
id
required
number
name
required
string
avatar
required
string | null
snapshotSavedAt
required
Any of:
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))$/

Example

{
"type": "invoice",
"kind": "purchase",
"exchangeRate": null,
"warehouse": null,
"status": "draft",
"documentSymbol": null,
"relatedDocuments": [],
"modifiedAt": null,
"modifiedBy": null,
"integrationType": "comarch-optima",
"subject": {
"countryCode": null,
"status": "draft",
"vatTransactionKind": null,
"taxIdCountry": null,
"currency": null,
"kind": "counterparty"
},
"recipient": {
"countryCode": null,
"status": "draft",
"vatTransactionKind": null,
"taxIdCountry": null,
"currency": null,
"kind": "counterparty"
},
"items": [
{
"priceNetBeforeDiscount": null,
"discountPercent": null,
"pricePrecision": 2,
"quantityPrecision": 4
}
],
"customFields": {},
"customFieldsMeta": {},
"snapshotSavedAt": null
}

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": []
}

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": []
}