Qvalia Developer Tools
Access APIs and technical requirements and get connected in no time!
Our APIs and onboarding team ensures a swift integration into your systems and processes. Qvalia integrates with major ERPs and accounting software.
All Qvalia API’s are REST based and we use both JSON and XML request and response payloads. All message formats are based upon UBL and our JSON format is a representation of the XML called UBL JSON by OASIS Open group. We strive to use the REST standards for response codes and “verbs” (e.g. GET and POST).
The Qvalia API has two separate endpoints for our Production and a Test (Quality Assurance) environment.
You must obtain a Qvalia account prior to using (or testing) the API!
Authentication
We use API keys for the Authentication of requests. You can get your API key from our Support team and you’ll get a separate key and URL for Production and Test environments. All requests are using HTTPS with a minimum of TLS 1.2
Parameters Some of our API's has the possibility to provide parameters for e.g. filtering. These parameters are sent as a query string and the options are listed per endpoint under the technical API documentation.
Error handling
We offer various error codes based upon the type of error, along with a descriptive error message (in JSON or XML). Like any other API codes in the range of 2xx is a successful request while a status of 4xx indicates an error that occurred because of the data sent or a parameter missing/in error. In the 5xx range indicate an error with our server/service and you should contact the Qvalia Support if you ever would end up getting any 5xx code as response.
Support
You can always contact Qvalia Support through your Qvalia Sales representative or by using our Support e-mail (see your Qvalia Account for details).
Coding
We use Node.js inhouse, and JSON is our format of choice, however, as many ERP and Financial systems are using XML we have opted to add support for both formats in our API. You can freely swap between XML and JSON, just by using different headers:
Omitting accept
or content-type
headers, we'll default to JSON!
XML | JSON (Default) |
GET requests: accept: application/xml POST requests: content-type: application/xml | GET requests: accept: application/json POST requests: content-type: application/json |
Node.js sample code for calling the API for sending a JSON request could look like:
async function httpsPost(registrationNumber, data) { return new Promise(async (resolve, reject) => { const options = { hostname: 'api.qvalia.com', path: `/transaction/${registrationNumber}/invoices/outgoing`, port: 443, method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: '412ee738......d3e469a7' } }; const body = []; const req = https.request(options, res => { res.on('data', d=> { body.push(d); }); res.on('end', () => { resolve(body); }); }); req.on('error', e => { reject(e); }); req.write(JSON.stringify(data)); req.end(); });}
API
We follow a standard API REST-ish interface on our endpoints and try to adhere to the standard/common return codes and behaviors of any standard API.
We are using the UBL standard messaging formats for our integrations through the API, but you should note that we only use a subset of UBL as specified by Peppol (peppol.eu)
As many of Qvalia's services are compatible with Peppol the data validation is also done using the Peppol standards. For example the Invoice endpoint strictly follows BIS Billing 3.0, https://docs.peppol.eu/poacc/billing/3.0/
This means that, although the JSON format is based upon UBL JSON we only allow the subset stated from https://docs.peppol.eu/poacc/billing/3.0/ for the Invoice and CreditNote message types, see the “Syntax” section!
For Order and OrderResponse you'll find the documentation at: https://docs.peppol.eu/poacc/upgrade-3/
Authentication
We use API keys for the Authentication of requests. You can get your API key from our Support team and you’ll get a separate key and URL for Production and Test environments. All requests are using HTTPS with a minimum of TLS 1.2
Each request made to the API will contain your registration number
which is your account identifier for your Qvalia account. Your account identifier will be provided to you from the Support team during the onboarding process.
Your requests must use the registration number as e.g. POST /{registration_number}/invoices/outgoing
UBL JSON Representation standard
For the JSON representation of the format please refer to http://docs.oasis-open.org/ubl/UBL-2.1-JSON/v2.0/UBL-2.1-JSON-v2.0.html
UBL JSON samples and schemas can be found here: http://docs.oasis-open.org/ubl/UBL-2.1-JSON/v2.0/cnd01/
UBL XML Representation standard
For the XML representation, https://docs.oasis-open.org/ubl/UBL-2.1.html
The UBL version 2.1 has been selected due to the many compliant standars with UBL 2.1, mainly the Peppol standard (peppol.eu).
XML samples and XML schemas can be found here: http://docs.oasis-open.org/ubl/os-UBL-2.1/
Required
As the UBL JSON schema is fairly big, we only list the required
attributes in the sample request and response data. You can browse the complete JSON schema
viewing the UBL-Invoice-2.1
.
Note the difference in objects below, only IssueDate is required, and thus IssueTime won't be listed in the sample request/responses:
Attachments
Often our customers wants to add, or request, attached documents to their messages, e.g. their invoices.
We support all the same attachments as Peppol does: Peppol media types
See more under Attachments to messages
SFTP Integration
Qvalia is also offering integration through SFTP. If you have opted for the SFTP integration please read more here: SFTP Integration
JSON Sample 1
Show child attributes
XML Sample
Show child attributes
Show child attributes
Base URL
Production server.:
https://api.qvalia.com
Sandbox server for testing.:
https://api-test.qvalia.com
Error Codes
200 - OK
Everything worked as expected
204 - No content
Everything worked as expected, but we didn't find any data to return
400 - Invalid request
Invalid parameters from client
401 - Unauthorized
Unauthorized. Check your API key
403 - Forbidden
The API key doesn't have permissions to perform the request.
404 - Not Found
The requested resource does not exist. This can be either the URI, or query parameters.
409 - Conflict
The request cause some conflict, normally a duplicate
422 - Unprocessable Entity
The posted data is invalid, in the wrong format or missing
500 - Internal error
Internal Server Error (It's not you, it's us)
JSON/XML or JSON to XML
As we support both the Peppol UBL and XML standards you can freely choose between then, and even mix them, with creating a message as XML but fetching it using JSON, or the other way round.
The response, in JSON, will always include the three latest messages, per default. Using XML you always only get one (as there's no "array" function for XML).
With JSON data we add the integrationId
attribute (the unique identifier in our DB) into the JSON object, as, with JSON, you can get an array of objects and then each object has it's own unique integrationId
.
With XML we only return one message at a time in the original XML format and because of this the integrationId
will be returned as a HTTP response header (and please note that HTTP headers are case-insensitive, meaning the returned ID will be integrationid
in all lowercase letters!)
Transformation between JSON and XML
Our API is developed closely to the UBL and Peppol specifications why we've opted to include both the XML
and JSON
representations of the formats.
The two representations are "interchangeble" through a transform but if you are a "Node.js" shop you should opt for the JSON
format. Other programming languages might have an easier time to work with XML instead.
There is a limitation in XML as there is no batch
function for XML, meaning the XML
format only supports one invoice per request!
Using the npm
module xml2js you can transform between JSON
and XML
as the format is bi-directional.
JAVASCRIPT
Select...
const xml2js = require('xml2js');// Convert from JSON ->> XMLconst convertUblJsonToUblXml = async (json) => {const builder = new xml2js.Builder();return builder.buildObject(json);};// Convert from XML (string) ->> JSONconst convertUblXmlToUblJson = async (xmlString) => {const parser = new xml2js.Parser({ explicitArray: true, explicitCharkey: true });return parser.parseStringPromise(xmlString);};
Limit
The XML has no “envelope” so we only ever return one message, meaning the limit
parameter is set to 1
. Using JSON you can set any limit you like, but the response size is limited to 6 MB.
For JSON, we return the integrationId
as part of the message, while with XML you'll find it as a returned HTTP header named integrationId
. When you do a POST
(creating something) we return the message about the message created along with the integrationId
.
The integrationId
is the unique identifier for the message in our database and you can store that as an external permanent link to the message with us.
Attachments to messages
Often our customers wants to add, or request, attached documents to their messages, e.g. their invoices.
We support all the same attachments as Peppol does: Peppol media types
SUPPORTED FILE TYPES | |
---|---|
Documents | application/pdf |
Images | image/png image/jpeg |
Text | text/csv |
Spreadsheet | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet application/vnd.oasis.opendocument.spreadsheet |
Technical details
Any attachment has to be base64
encoded and added under the AdditionalDocumentReference
element; https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-AdditionalDocumentReference/cac-Attachment/
JSON | XML |
json
| xml
|
Invoice APIs
APIs related to invoice handling
Endpoints
GET
POST
GET
GET
POST
Credit Note APIs
APIs related to credit note handing
Endpoints
GET
POST
GET
GET
POST
Order APIs
APIs related to order handing
Endpoints
GET
POST
GET
GET
POST
Order Response APIs
APIs related to order response handing
Endpoints
GET
POST
GET
GET
POST
Order Change APIs
APIs related to order change handing
Order Change is part of Advanced Ordering 3.0: https://docs.peppol.eu/poacc/upgrade-3/profiles/65-advanced-ordering/
Message Syntax: https://docs.peppol.eu/poacc/upgrade-3/syntax/OrderChange/tree/
Endpoints
GET
POST
GET
GET
POST
Order Cancellation APIs
APIs related to order cancellation handing
Order Change is part of Advanced Ordering 3.0: https://docs.peppol.eu/poacc/upgrade-3/profiles/65-advanced-ordering/
Message Syntax: https://docs.peppol.eu/poacc/upgrade-3/syntax/adv-order-cancellation-3.0/tree/
Endpoints
GET
POST
GET
GET
POST
Catalogue APIs
APIs related to catalogue handing
Endpoints
GET
POST
GET
GET
POST
Despatch Advice
APIs related to catalogue handing
Endpoints
GET
POST
GET
GET
POST
GET
Account Functions
A collection of endpoints where Qvalia account information is gathered, such as Invoice status, and automation tasks, e.g. creating an outgoing Invoice from an incoming Order.
Endpoints
POST
POST
Enrichment API
This documentation covers only Enrichment endpoint. Please use this alongside Qvalia API documentation at https://api.qvalia.com. API for uploading and enriching invoices (PDF, XML - later). PDFs are converted to digital format and presented as a Peppol XML document. Supports single and batch file processing with asynchronous polling.
Base URL
Production server.:
https://api.qvalia.com
Sandbox server for testing.:
https://api-test.qvalia.com
Sample Data
As the request and response sample data are quite big, and scrolling through each sample on every endpoint would get quite tedious, we've opted to add sample data for the various messages here instead of in the actual Endpoint data.
Regardless if you are POST'in or GET'ing data the message structure of the messages will be the same.
As stated in the API
section of the documentation, and under JSON/XML or JSON to XML
all our transaction messages are bidirectional and can be transformed to/from JSON/XML.f
JSON | XML |
json
| xml
|
SFTP-Integration
The Qvalia SFTP integration handles all Peppol XML Document types by default but we also support "custom" formats.
The SFTP setup is done by our helpdesk, and you will require a Qvalia account prior to being able to test the SFTP integration.
Qvalia hosts an SFTP Server, and both sending and receiving is done through an SFTP client from your environment.
Operator
For Swedish operators Qvalia can offer support for the legacy formats Svefaktura 1.0 (Basic Invoice) as well as Svefaktura 2 (Peppol BIS2/4A).
Qvalia is primarily using the protocol SFTI Transportprofil Bas 2.0
over HTTP POST
for the Swedish legacy formats. SFTP transportation can also be accepted, and configured, for any Operator who wants to send legacy formats.
We strongly encourage the usage of Peppol instead of legacy formats, but we do understand that some older systems still needs to fall back on older versions of specifications, and we try our best to meet the needs of our customers.
Please reach out to peppol@qvalia.com if you are an Operator who wants to use any of the legacy formats!
SFTI Transportprofil Bas 2.0 is an old and not supported standard, but as some companies and Operators in Sweden still cling to it Qvalia has the option of POST'ing Transportprofil Bas 2.0 over HTTP.
As we would like to follow the recommendation of the Swedish Government and the IT authorities of Sweden we have deprecated the usage of Svefaktura, and try to move all our customers over to Peppol.
After the 1st of March 2021, no new established Svefaktura connections should be added according to DIGG's recommendations and mandate MDFFS 2021:1
. See article from SFTI/DIGG here (in Swedish) for more information: https://sfti.se/sfti/standarder/rekommenderadestandarder/avfordameddelanden.52834.html
|
|
|
|
xml
|
Partner
The Partner API contains endpoints for usage of accounts and setup of accounts
Under the Partner API section you'll find information about the endpoints used by Partners to Qvalia and how to handle the various functions offered.
The Partner API is JSON only, so only content-type: application/json
is used!