# APIs

{% stepper %}
{% step %}

#### Production base URL:

<https://api.qvalia.com>
{% endstep %}

{% step %}

#### Staging / Sandbox server base URL:

<https://api-qa.qvalia.com>
{% endstep %}
{% endstepper %}

***

{% hint style="success" %}
All Qvalia endpoints follows the same HTTP code pattern, full set as follows:
{% endhint %}

* **Error Codes**
  * <mark style="color:green;">`200`</mark> - <mark style="color:green;">OK</mark>

    Everything worked as expected
  * <mark style="color:green;">`204`</mark> - <mark style="color:green;">No content</mark>

    Everything worked as expected, but we didn't find any data to return
  * <mark style="color:orange;">`400`</mark> - <mark style="color:orange;">Invalid request</mark>

    Invalid parameters from client
  * <mark style="color:orange;">`401`</mark> - <mark style="color:orange;">Unauthorized</mark>

    Unauthorized. Check your API key
  * <mark style="color:orange;">`403`</mark> - <mark style="color:orange;">Forbidden</mark>

    The API key doesn't have permissions to perform the request.
  * <mark style="color:orange;">`404`</mark> - <mark style="color:orange;">Not Found</mark>

    The requested resource does not exist. This can be either the URI, or query parameters.
  * <mark style="color:orange;">`409`</mark> - <mark style="color:orange;">Conflict</mark>

    The request cause some conflict, normally a duplicate
  * <mark style="color:orange;">`422`</mark> - <mark style="color:orange;">Unprocessable Entity</mark>

    The posted data is invalid, in the wrong format or missing
  * <mark style="color:orange;">`429`</mark> - <mark style="color:orange;">Too many requests</mark>\
    You're too fast, we will block you for a while and you'll need to cool down
  * <mark style="color:red;">`500`</mark> - <mark style="color:red;">Internal error</mark>

    Internal Server Error (It's not you, it's us)

***

{% hint style="info" %}
The `/transaction` (Peppol messages) all support both `XML` and `JSON`, both as request and response data!
{% endhint %}

To `POST` (create) any message in `XML` format you'll provide a header as:

<pre><code><strong>POST
</strong><strong>content-type: application/xml
</strong></code></pre>

Or for `POST`'ing JSON, you'd either omit the header, as JSON is the default, or provide:

```
POST
content-type: application/json
```

{% hint style="danger" %}
All Query String Parameters are case-sensitive and shall be added as stated in each individual API reference, e.g. `documentId` must be sent with a capital `I` in `Id`
{% endhint %}

For `GET`'ing data you'll use the `accept` header instead:

```
GET (XML)
accept: application/xml

GET (JSON)
accept: application/json
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.qvalia.io/api-documentation/apis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
