# SalesInvoice

The /salesInvoice endpoints are used to send documents. A full tutorial on how to send documents can be found here.

# Query recipient

When a receiver has multiple id's registered in Peppol 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 /{partyId}/salesInvoice/queryRecipientParty endpoint. The {partyId} specified in the route should be the sender's partyId. The request body accepts an array of partyId's, in JSON. The response will contain the recipient party that should be used as endpointId in the sales invoice.

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 /{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 response will contain a documentId, which can be used to check to status of the document.

# Get 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 /{partyId}/salesInvoice/send earlier.

# 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 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. When things go wrong the hook will have the "SalesInvoiceRecognizedError" topic instead.

For a more detailed description, refer to the recognize tutorial.

© 2021 eConnect International B.V.