# Sales Invoice v1
The /salesInvoice
endpoints are used to send sales invoices. A full tutorial on how to send sales invoices can be found here.
# Query recipient party
When a receiver has multiple ids registered in Peppol or other networks, and you're unsure which id to use, or if you want to make sure the id you're sending to is registered in the Peppol network, you can use the POST /api/v1/{partyId}/salesInvoice/queryRecipientParty
endpoint. The {partyId}
specified in the route should be the sender's partyId. The request body accepts an array of partyIds, in JSON. The response will contain the recipient party that should be used as endpointId in the sales invoice, as well as the delivery channel.
The query parameter ?preferredDocumentTypeId
can be used if a specific documentTypeId is preferred. Specifying a preferred documentTypeId will make sure the documentTypeId is prioritized in the lookup.
# Send
To send invoices, use POST /api/v1/{partyId}/salesInvoice/send
. The {partyId} specified in the route should be the sender's partyId, the receiver will be read from the invoice. The invoice should be added to the request body as a binary file with content type multipart/form-data. The query parameter ?channel
can be used to enforce the use of a delivery channel.
The response will contain a documentId, which can be used to check to status of the document.
It's also possible to set your own documentId using the request headers: X-EConnect-DocumentId
{customdocumentid}
.
# Status
Once a document is sent, GET /api/v1/{partyId}/salesInvoice/{documentId}/status
can be called to check the status of the document. The {partyId} specified in the route should be the sender's partyId and the {documentId} should be the documentId returned by POST /api/v1/{partyId}/salesInvoice/send
earlier.
Please note that we strongly encourage the usages of hooks instead. Only use this api for debugging purposes.
# Recognize
The POST /api/v1/{partyId}/salesInvoice/recognize
endpoint can be used to recognize non-standard documents like a PDF invoice and convert them to a UBL invoice. The {partyId}
specified in the route should be the sender's partyId.
The document to recognize should be added to the request body as a binary file with content type multipart/form-data. The current maximum size that can be uploaded is 15MB, if a file is larger then 15MB, we will throw Error code 413.
The response will contain a documentId, which can be used to check the status of the document. When the process is complete and the document is converted, a "SalesInvoiceRecognized" hook will trigger. If manual verification is needed a "SalesInvoiceRecognizedPending" hook is sent and when the document is rejected after verification a "SalesInvoiceRecognizedRejected" hook will trigger. When things go wrong the hook will have the "SalesInvoiceRecognizedError" topic instead.
For a more detailed description, refer to the recognize tutorial.