FlexyAPI documentation

API documentation

Step 4 – Electronic invoice (PEPPOL)

Download the electronic invoice (A.1017, PEPPOL BIS Billing 3.0 UBL) of a document issued through Flexy.

For a document issued with provider: "flexy", Flexy also prepares its electronic invoice: the XML file of Decision A.1017/2020 in the PEPPOL BIS Billing 3.0 format (UBL 2.1), with the Greek rules. You download it and deliver it to your customer; Flexy does not send it over the PEPPOL network.

Which documents have one

A document has an electronic invoice when all of the following hold:

ConditionWhy
It was issued with provider: "flexy".Only Flexy prepares it, as the provider.
Its myDATA type is 1.1, 1.6, 2.1, 2.4, 5.1 or 5.2.The Greek PEPPOL rules accept only these types.
It has a customer (counterpart).The electronic invoice is addressed to the buyer's VAT number.
It is not self-billing (self_pricing).Self-billing belongs to a different PEPPOL profile.
AADE has assigned its MARK.The file carries the MARK.

The file is prepared a few seconds after AADE registers the document. Until then the document's peppol_xml_available field (see step 2) is false; once the file can be downloaded it becomes true.

Download it

Use the document's id from the step 2 response:

curl https://provider-staging.flexy.gr/api/v1/documents/<id>/peppol-xml/ \
  -H "Authorization: Bearer <token>" \
  -o invoice.xml

The API answers with HTTP 200 and the file itself:

HeaderValue
Content-Typeapplication/xml; charset=utf-8
Content-Dispositionattachment; filename="<VAT NUMBER>_<series>-<aa>_peppol.xml", e.g. 123456783_A-101_peppol.xml.

What the file contains

ElementContent
RootInvoice for 1.1, 1.6, 2.1, 2.4; CreditNote for 5.1, 5.2.
cbc:IDThe invoice number as A.1017 defines it: VAT number|date|branch|type|series|aa, e.g. 123456783|13/10/2026|0|1.1|A|101.
cac:AdditionalDocumentReferenceThe MARK (##M.AR.K##), the authentication string (##AUTHCODE##) and the document's page at Flexy (##INVOICE|URL##, the verification_url).
cac:BillingReferenceFor 1.6, 2.4 and 5.1: the invoice it relates to, when that invoice was also sent through this API with your token (provider flexy or mydata).
cac:AllowanceChargeWithholdings and deductions reduce the total; fees, other taxes and the digital transaction fee increase it, exactly as in myDATA. Each withholding category is also listed as ##PARAKRAT|FOR|EISOD|<category>## and the deductions as ##PARAKRAT|YPER3##.
AmountsThe net value, VAT and total are the ones AADE registered, or the same amounts in the document currency (see Currency).

Before it is served, every file is checked offline against PEPPOL BIS Billing 3.0.20: the UBL 2.1 schema, the EN 16931 rules, the PEPPOL rules and the Greek rules (GR-R-…). A file that fails a rule is never served.

Currency

myDATA amounts are always in euro. For a document in another currency (exchange_rates) the electronic invoice is issued:

What you sentCurrency of the file
items[].document_currency on every item and document_currency_amount on every paymentIn the document currency (cbc:DocumentCurrencyCode, for example USD), with the amounts you sent. The VAT total is also written in euro, as AADE registered it (cbc:TaxCurrencyCode EUR and a second cac:TaxTotal), as article 9 §2 of Law 4308/2014 requires.
Only exchange_ratesEntirely in euro, with the amounts AADE registered.

Example: 114.11 USD + VAT 24% at 1 EUR = 1.1411 USD. myDATA gets 100.00 + 24.00 EUR; with "document_currency": {"net_value": "114.11", "vat_amount": "27.39"} and "document_currency_amount": "141.50" the electronic invoice says 141.50 USD payable and VAT of 27.39 USD and 24.00 EUR.

Each amount in the currency must be present exactly where it is present in myDATA, and the total at the exchange rate must be within 1% of the euro total (or 0.05 EUR, whichever is larger). Otherwise, or if the file in the currency fails the PEPPOL checks, the file in euro is served.

Something is wrong

HTTPcodeCauseWhat to do
404peppol_xml_pendingThe file is not ready yet, or a temporary failure is being retried.Try again shortly.
404peppol_xml_not_applicableThe document has no electronic invoice; detail says why (see the table above).Nothing: no file exists for this document.
404peppol_xml_invalidThe document cannot be expressed as an electronic invoice, or the file failed the PEPPOL checks, so it is not served.Contact Flexy with the document id.
404not_foundThere is no document with this id for your token.Check the id.

For 401 errors see step 1.