Send e-invoices to any customers on behalf your customers via various networks
This guide describes how you can send on behalf of your customers.
You can send documents on behalf of your customers with them created as children (The parent company can have multiple child companies)
This makes it transparent how much a specific child company sends and it will also support the flow for receiving documents.
If you want to manage document sending and reception for more than one company, you should create child companies attached to your Sproom account.
If you are a software provider, this is how you manage Sproom accounts for your customers.
A company can be the child of multiple parent companies, so this also enables multiple software vendors to receive and process documents for the same company. For security reasons, the API does however not allow you to add an existing company as a child company. For now you'll need to contact support, if you need to act on behalf of a company that is already created in Sproom.
Create child company using POST /api/child-companies
The input of the body needs to be in Raw Json text
(Remember inserting only valid CVR numbers for danish customers - as this will be checked towards virk.dk)
curl -X 'POST' \
'https://sproom.net/api/child-companies' \
-H 'accept: */*' \
-H 'Authorization: Bearer (INSERT YOUR TOKEN HERE)
-H 'Content-Type: application/json' \
-d '{
"companyName": "The Smallish Company A/S",
"organizationIdentifier": {
"schemeId": "DK:CVR",
"value": "29403473"
},
"glnNumber": "5798009811578"
}'
This returns a code 200, meaning you created the child. The API call returns the CompanyID in “X-CorrelationId”. You need to use this company ID if you want to delete the customer later or register them for receiving documents in either NemHandel or PEPPOL.
This section describes how to send e-invoices via the API, either as your own company, or for your own customers with the use of child companies.
First create a webhook for status updates on sent documents using POST /api/webhooks
The type should be: documentStatusChanged (more information here: https://sproom.net/api/documentation/Webhooks.html)
This will allow Sproom to give you updates on your sent document, so you know whether or not the document has been accepted by the recipient.
curl -X 'POST' \
'https://sproom.net/api/webhooks' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"type": "documentReceived",
"url": "https://my.company.com/sproom-webhook"
}'
When you want to send a document, say an invoice, to a given recipient, we recommend you check whether or not the specific recipient number is registered to receiving e-invoices.
That way, you know that the invoice has somewhere to go, and won't be rejected by us due to us not being able to deliver it anywhere.
Check if a company can receive documents using POST /api/recipients/{orgId}
Note: You can check for various countries if you have the country code and the organisation number
E.g. for Denmark we recommend you at least check in the following order 1) GLN -> 2) DK:CVR
curl -X 'GET' \
'https://sproom.net/api/recipients/GLN%3A5790002041488' \
-H 'accept: */*'
That will return a code 200 if the given endpoint is registered in either NemHandel or PEPPOL, meaning that we can deliver the invoice.
Now you have to generate the actual document (OIOUBL or PEPPOL Bis 3) which you want to send (the e-invoice itself)
This will be in XML format.
Ask Sproom Support if you need example files to generate the document.
Upload the XML document by using POST /api/documents
The XML has to be the body of the request in binary form.
curl -X 'POST' \
'https://sproom.net/api/documents' \
-H 'accept: */*' \
-H 'Content-Type: application/octet-stream' \
-d '{}'
This will return a code 201 which includes the header 'X-Sproom-DocumentId'.
This DocumentId will be what we reference when pushing updates via Webhooks.
Error handling: When uploading documents, use the response message, it will contain usable information - especially for validation errors. If you don’t understand why upload fails, please include the error message when contacting Sproom support.
Do you have questions on how to do you integration, contact us now and we will help you as quick as possible
Tlf: +45 88 20 20 40 E-mail: support@sproom.net