Version 2 does not change endpoint addresses, parameters or return codes. It only changes how the data and the API key are sent to the server:
The reason is security: the content of a URL is routinely written to server, proxy and hosting logs, while the request body and headers are not. The original way of calling the API (GET method with the data parameter) remains functional for existing integrations and is described in the version 1 manual. For new integrations we recommend version 2 only. Both versions can be combined, the server tells them apart automatically on every call.
Every API call is a POST request to the endpoint address. The request must contain:
Content-Type: application/json,Authorization: Bearer YOUR_API_KEY,The response is always JSON and contains the status field (1 = OK, otherwise an error number from the table of the given endpoint). Calls after session initialization must send the session cookie returned by the server from the /api/init call.
curl -X POST https://www.faktury-online.com/api/init \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-c cookies.txt \
-d '{"email":"name@example.com"}'
POST https://www.faktury-online.com/api/init(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. |
Array
(
[email] => name@example.com
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine, the session was initialized |
| 102 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 103 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 104 | Error | The API key is not entered correctly. |
| 105 | Error | The email parameter is missing. |
| 106 | Error | The username or the API key is not correct. |
| 107 | Error | The user does not exist. |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
$result = json_decode($output, true);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
echo "Sedenie bolo vytvorené";
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
)
POST https://www.faktury-online.com/api/nf(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| apitest | optional parameter | The apitest parameter specifies whether the created invoice is for testing purposes only. This parameter should be used only by developers implementing the Faktury Online API. The system will treat the created invoice as a test one and will delete it within 5 to 10 minutes. We recommend keeping this value enabled while testing your API implementation. Disable this value in production, otherwise the invoices will be deleted automatically. Possible values: 1 or 0 Default value: 0 |
| Parameter | Attribute | Description |
|---|---|---|
| d_id | option 1 / required parameter | Supplier ID (you will find the ID in the My companies list). |
| d_name | option 2 / required parameter | Supplier's business name. |
| d_street | option 2 / optional parameter | Supplier's street. |
| d_city | option 2 / optional parameter | Supplier's city. |
| d_state | option 2 / optional parameter | Supplier's country. |
| d_zip | option 2 / optional parameter | Supplier's postal code. |
| d_ico | option 2 / optional parameter | Supplier's Company ID (IČO). |
| d_dic | option 2 / optional parameter | Supplier's Tax ID (DIČ). |
| d_icdph | option 2 / optional parameter | Supplier's VAT ID (IČ DPH). |
| d_vatpayer | option 2 / optional parameter | VAT payer. Possible values: VAT payer: 1 Non-VAT payer: 0 Default value: 0 |
| d_viewpayer | option 2 / optional parameter | Show on the invoice whether the supplier is a VAT payer. Possible values: Yes: 1 No: 0 Default value: 1 |
| d_info | option 2 / optional parameter | Supplier information. |
| d_bankaccount | option 2 / optional parameter | Supplier's bank account number. |
| d_bank | option 2 / optional parameter | Supplier's bank name. |
| d_iban | option 2 / optional parameter | Supplier's IBAN. |
| d_swift | option 2 / optional parameter | Supplier's SWIFT. |
| d_email | option 2 / optional parameter | Supplier's e-mail. |
| d_web | option 2 / optional parameter | Supplier's website. |
| d_phone | option 2 / optional parameter | Supplier's phone. |
| d_custom_key_1 | option 2 / optional parameter | Custom field no. 1 - key |
| d_custom_value_1 | option 2 / optional parameter | Custom field no. 1 - value |
| d_custom_key_2 | option 2 / optional parameter | Custom field no. 2 - key |
| d_custom_value_2 | option 2 / optional parameter | Custom field no. 2 - value |
| Parameter | Attribute | Description |
|---|---|---|
| o_name | required parameter | Customer's business name. |
| o_street | optional parameter | Customer's street. |
| o_city | optional parameter | Customer's city. |
| o_state | optional parameter | Customer's country. |
| o_zip | optional parameter | Customer's postal code. |
| o_ico | optional parameter | Customer's Company ID (IČO). |
| o_dic | optional parameter | Customer's Tax ID (DIČ). |
| o_icdph | optional parameter | Customer's VAT ID (IČ DPH). |
| o_email | optional parameter | Customer's e-mail. |
| o_name_d | optional parameter | Delivery address - business name. |
| o_street_d | optional parameter | Delivery address - street. |
| o_city_d | optional parameter | Delivery address - city. |
| o_state_d | optional parameter | Delivery address - country. |
| o_zip_d | optional parameter | Delivery address - postal code. |
| o_custom_key_1 | option 2 / optional parameter | Custom field no. 1 - key |
| o_custom_value_1 | option 2 / optional parameter | Custom field no. 1 - value |
| o_custom_key_2 | option 2 / optional parameter | Custom field no. 2 - key |
| o_custom_value_2 | option 2 / optional parameter | Custom field no. 2 - value |
| Parameter | Attribute | Description |
|---|---|---|
| f_number | optional parameter | Invoice number. If not provided, the number is automatically incremented by 1 from the most recently created invoice (the issue date is decisive; the invoice number must be numeric). |
| f_vs | optional parameter | Variable symbol. |
| f_ks | optional parameter | Constant symbol. |
| f_date_issue | optional parameter | Issue date. In the YYYY-MM-DD format. Default value: current date |
| f_date_delivery | optional parameter | Delivery date. In the YYYY-MM-DD format. Default value: current date |
| f_date_due | optional parameter | Due date. In the YYYY-MM-DD format. Default value: 14 days from the current date |
| f_date_payment | optional parameter | Date of the received payment for invoice type 5, in the YYYY-MM-DD format. Default value: current date |
| f_issued_by | optional parameter | Invoice issued by. |
| f_order | optional parameter | Order number. |
| f_payment | optional parameter | Payment method. Possible values: Bank transfer: prevod Postal order: poukazka Cash: hotovost Cash on delivery: dobierka Cash register: pokladna Online payment provider: eprovider Payment card: karta Offset (set-off): zapocet Other: ina Default value: prevod |
| f_note_above | optional parameter | Invoice note. Displayed above the invoice items. |
| f_note | optional parameter | Invoice note. Displayed below the invoice items. If the supplier is selected by the d_id parameter and f_note is empty, the note stored for that supplier is displayed. |
| f_internal_note | optional parameter | Internal note. For internal use only. It is not shown on the issued invoice; it is visible only in the document detail in the system. |
| f_logo | optional parameter | Logo display. Possible values: Not shown: 0 Shown: 1 (only if the supplier was loaded by d_id and has a logo stored) |
| f_stamp | optional parameter | Stamp display. Possible values: Not shown: 0 Shown: 1 (only if the supplier was loaded by d_id and has a stamp stored) |
| f_currency | optional parameter | Invoice currency. Currency code. The default value is EUR. Default value: EUR |
| f_type | optional parameter | Invoice type. Possible values: 1: invoice 2: proforma invoice 3: credit note 4: debit note 5: receipt for a received payment Default value: 1 |
| f_original_num | required for invoice types 3 and 4 / optional parameter | A credit note or a debit note must include a reference to the original document. Default value: 0 |
| f_paid | optional parameter | Amount already paid by non-tax advance payments. The value is not used in a receipt for a received payment. Default value: 0 |
| f_fullpaid | optional parameter | Forces the “ALREADY PAID” note in the document footer instead of the amount due. Use it when the document is already paid at the time of issue (e.g. prepayment, e-shop). It is independent of the f_paid parameter (amount paid by advance payments) and of the invoice payment status in the system. Possible values: 0: not shown (default) 1: shows the “ALREADY PAID” note Default value: 0 |
| f_rounding | optional parameter | Rounding of the total amount due Possible values: 0: no rounding 1: round up to a whole number 2: round down to a whole number 3: round to 5 hundredths (5 cents) Default value: 0 |
| f_style | optional parameter | Visual style of the invoice. Possible values: styl_1 styl_2 styl_3 styl_4 styl_5 styl_6 styl_7 (default designer template) Default value: styl_1 |
| f_language | optional parameter | Invoice language. Possible values: SK, CS, EN, DE, FR, ES, IT, HU, PL, RU, NO, DK Default value: SK |
| f_qr | optional parameter | Show a payment QR code. Possible values: 0: do not show 1: pay-by-square 2: SPD format 3: EPC format Default value: 1 |
| f_omit_stats | optional parameter | Exclude the value from statistics. Possible values: 0: do not exclude 1: exclude Default value: 0 |
| f_custom | optional parameter | Any text information sent via the API. It is shown as a separate column in the Excel export. text, max. 50 characters |
| f_vat_regime | optional parameter | VAT regime for the whole invoice. Possible values: 0: Standard regime 1: Reverse charge 2: VAT exemption 3: Intra-EU supply of goods 4: Export of goods outside the EU 5: Outside the scope of VAT, pass-through items 6: Service outside the EU, place of supply abroad 7: Margin scheme: second-hand goods 8: Margin scheme: works of art 9: Margin scheme: collectibles, antiques 10: Margin scheme: travel agents Values 1 to 10 are available only to VAT payers. A document regime greater than 0 applies to all items. Default value: 0 |
| f_tags | optional parameter | A list (array) of tags from the My labels / tags list to be assigned to the document. Format: Array
(
[0] => Tag name 1
[1] => Tag name 2
)
|
| Parameter | Attribute | Description |
|---|---|---|
| p_text | required parameter | Invoice item text. |
| p_quantity | required parameter | Quantity. Number. |
| p_unit | required parameter | Unit of measure. For example kg, pcs, ... |
| p_price | option 1 / optional parameter | Price per unit of measure excluding tax. The price including VAT is calculated from this value. If this attribute is not provided, the p_pricevat attribute must be provided. For non-VAT payers this parameter is required. |
| p_vat | optional parameter | Tax in percent. Fill in only if the supplier is a VAT payer. |
| p_pricevat | option 2 / optional parameter | Price per unit of measure including tax. If this attribute is provided, the price excluding tax is calculated from it regardless of whether the p_price attribute was provided. |
| p_regime | optional parameter | VAT regime of the item. If the invoice is set to the standard VAT regime, the VAT regime can also be set separately for individual items. Possible values: 0: Standard regime 1: Reverse charge 2: VAT exemption 3: Intra-EU supply of goods 4: Export of goods outside the EU 5: Outside the scope of VAT, pass-through items 6: Service outside the EU, place of supply abroad 7: Margin scheme: second-hand goods 8: Margin scheme: works of art 9: Margin scheme: collectibles, antiques 10: Margin scheme: travel agents Values 1 to 10 are available only to VAT payers. Default value: 0 |
| p_custom | optional parameter | Any text information sent via the API for the invoice item. It is shown as a separate column in the Excel export. text, max. 50 characters |
Array
(
[email] => name@example.com
[apitest] => 1
[d] => Array
(
[d_name] => Moja spoločnosť s.r.o.
[d_street] => Mostová 56
[d_city] => Trenčín
[d_zip] => 843 21
[d_state] => Slovensko
[d_ico] => 43226520
[d_dic] => 2165052345
[d_icdph] => SK2165052345
[d_vatpayer] => 1
[d_viewpayer] => 1
[d_info] => Zapísaný v OR Trenčín, oddiel: Sro, vl.č.1234/X
[d_bankaccount] => 1234567890/0200
[d_bank] => VÚB banka
[d_iban] => SK6702000000001234567890
[d_swift] => SUBASKBX
[d_email] => info@example.com
[d_web] => www.example.com
[d_phone] => +421 903 111 111
)
[o] => Array
(
[o_name] => Andrej Klačanský
[o_street] => Štefánikova 455/2
[o_city] => Martin
[o_zip] => 876 54
[o_state] => Slovensko
[o_ico] =>
[o_dic] =>
[o_icdph] =>
[o_email] => client@example.com
)
[f] => Array
(
[f_number] => 2024099
[f_vs] => 2024099
[f_ks] => 308
[f_date_issue] => 2024-02-14
[f_date_delivery] => 2024-02-14
[f_date_due] => 2024-02-28
[f_issued_by] => Moja spoločnosť s.r.o.
[f_payment] => prevod
[f_logo] => 1
[f_stamp] => 0
[f_currency] => EUR
[f_type] => 1
[f_paid] =>
[f_rounding] => 0
[f_style] => standard
[f_language] => SK
[f_qr] => 1
[f_order] => OBJ-2017-514
[f_tags] => Array
(
[0] => VIP klient
[1] => Doprava zdarma
)
)
[p] => Array
(
[0] => Array
(
[p_text] => Maliarske práce
[p_quantity] => 3
[p_unit] => hod
[p_price] => 15
[p_vat] => 20
)
[1] => Array
(
[p_text] => Upratovacie práce
[p_quantity] => 2
[p_unit] => hod
[p_vat] => 20
[p_pricevat] => 14.4
)
)
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine, the invoice was created |
| 2 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 3 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 4 | Error | The API key is not entered correctly. |
| 5 | Error | The email parameter is missing. |
| 6 | Error | The username or the API key is not correct. |
| 7 | Error | The user does not exist. |
| 8 | Error | The supplier ID or the supplier name must be provided. |
| 9 | Error | Cancelled |
| 10 | Error | The provided supplier ID is not correct. |
| 11 | Error | The supplier name is missing. |
| 12 | Error | The customer name is missing. |
| 13 | Error | Invoice data is missing. |
| 14 | Error | Invoice items are missing or not entered correctly. |
| 15 | Error | Error in an invoice item, a required value is missing. |
| 16 | Error | The quantity in an invoice item is not a number. |
| 17 | Error | The price excluding tax in an invoice item is not a number. |
| 18 | Error | The tax in percent is not entered correctly. |
| 19 | Error | An invoice item has neither a price excluding tax nor a price including tax. |
| 20 | Error | Unsupported invoice language. |
| 21 | Error | An invoice item has no price excluding tax while the supplier is not a VAT payer. |
| 22 | Error | The price including tax in an invoice item is not a number. |
| 23 | Error | A credit note or a debit note must include a reference to the original document f_original_num. |
| 24 | Error | The total amount of a credit note must be negative. |
| 25 | Error | The received payment date f_date_payment in a receipt for a received payment is not entered correctly. |
| 26 | Error | A receipt for a received payment must not contain the received advance payments value f_paid. |
| 27 | Error | Invalid VAT regime, the value is out of the allowed range. |
| 28 | Error | The selected VAT regime requires the supplier to be a VAT payer. |
<?php
// Príprava základných dát
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// V prípade, že budeme testovať API, zvolíme hodnotu 1
// Znamená to, že všetky vytvorené faktúry sa automaticky odstránia o 5 - 10 minút od vytvorenia
$data['apitest'] = 1; //hodnota môže byť 1 alebo 0
// Príprava dát dodávateľa
$dodavatel = [];
// Údaje dodávateľa môžeme použiť buď z uložených záznamov v zozname Moje spoločnosti
// alebo údaje dodávateľa vložíme zadaním dát.
// Ak použijeme existujúceho dodávateľa, vložíme iba jeho ID.
// $dodavatel['d_id'] = 123; // ID dodávateľa nájdeme v zozname Moje spoločnosti
// alebo (nie obe):
$dodavatel['d_name'] = "Moja spoločnosť s.r.o."; // Obchodný názov dodávateľa
$dodavatel['d_street'] = "Mostová 56"; // Ulica
$dodavatel['d_city'] = "Trenčín"; // Mesto
$dodavatel['d_zip'] = "843 21"; // PSČ
$dodavatel['d_state'] = "Slovensko"; // Štát
$dodavatel['d_ico'] = "43226520"; // IČO
$dodavatel['d_dic'] = "2165052345"; // DIČ
$dodavatel['d_icdph'] = "SK2165052345"; // IČDPH
$dodavatel['d_vatpayer'] = "1"; // Platiteľ DPH. Pokiaľ je dodávateľ platiteľom DPH ponechajte
// hodnotu 1, ak nie je platiteľom DPH, napíšte 0.
$dodavatel['d_viewpayer'] = "1"; // Pokiaľ chcete zobraziť informáciu na faktúre,
// že dodávateľ je/nie je platiteľom DPH.
$dodavatel['d_info'] = "Zapísaný v OR Trenčín, oddiel: Sro, vl.č.1234/X"; //Info o dodávateľovi
$dodavatel['d_bankaccount'] = "1234567890/0200"; // Číslo účtu
$dodavatel['d_bank'] = "VÚB banka"; // Názov banky
$dodavatel['d_iban'] = "SK6702000000001234567890"; // IBAN
$dodavatel['d_swift'] = "SUBASKBX"; // SWIFT
$dodavatel['d_email'] = "info@example.com"; // E-mail
$dodavatel['d_web'] = "www.example.com"; // WEB
$dodavatel['d_phone'] = "+421 903 111 111"; // Telefón
// Pridanie dodávateľa k dátam:
$data['d'] = $dodavatel;
// Príprava dát odberateľa
$odberatel = [];
$odberatel['o_name'] = "Andrej Klačanský"; // Názov odberateľa
$odberatel['o_street'] = "Štefánikova 455/2"; // Ulica
$odberatel['o_city'] = "Martin"; // Mesto
$odberatel['o_zip'] = "876 54"; // PSČ
$odberatel['o_state'] = "Slovensko"; // Štát
$odberatel['o_ico'] = ""; // IČO
$odberatel['o_dic'] = ""; // DIČ
$odberatel['o_icdph'] = ""; // IČDPH
$odberatel['o_email'] = "client@example.com"; // Email odberateľa
// Pridanie odberateľa k dátam:
$data['o'] = $odberatel;
// Príprava fakturačných údajov
$faktura = [];
// Číslo faktúry môžeme zadať ručne:
$faktura['f_number'] = "2024099";
// Ak chceme vypočítať číslo faktúry automaticky, toto pole neuvedieme. Odporúča sa však
// mať zapnuté a nastavené automatické číslovanie faktúr pre vybraného dodávateľa.
$faktura['f_vs'] = "2024099"; // Variabilný symbol
$faktura['f_ks'] = "308"; // Konštantný symbol
$faktura['f_date_issue'] = '2024-02-14'; // Dátum vystavenia vo formáte RRRR-MM-DD
$faktura['f_date_delivery'] = '2024-02-14'; // Dátum dodania vo formáte RRRR-MM-DD
$faktura['f_date_due'] = '2024-02-28'; // Dátum splatnosti vo formáte RRRR-MM-DD
$faktura['f_issued_by'] = "Moja spoločnosť s.r.o."; //Faktúru vystavil
$faktura['f_payment'] = "prevod"; //Druh plaby. Na výber sú "prevod", "poukazka",
// "hotovost", "dobierka", "registracna_pokladna", "ina", "eprovider"
$faktura['f_logo'] = "1"; // Zobraziť logo dodávateľa. Iba v prípade, že bol
// dodávateľ vybraný pomocou ID a má uložené logo.
$faktura['f_stamp'] = "0"; // Nezobraziť pečiatku
$faktura['f_currency'] = "EUR"; //Mena faktúry
$faktura['f_type'] = "1"; // Faktúra
$faktura['f_paid'] = ""; // Už uhradená suma nedaňovými zálohami
$faktura['f_rounding'] = "0"; // Zaokrúhlenie - žiadne
$faktura['f_style'] = "standard"; // Štýl faktúry. Možnosti sú standard alebo classic
$faktura['f_language'] = "SK"; // Jazyk faktúry: SK, CZ, EN, DE, ES, IT, FR, HU, PL, NO, RU
$faktura['f_qr'] = "1"; // Zobraziť QR kód (PAY by square)
$faktura['f_order'] = "OBJ-2017-514"; //Číslo objednávky
$faktura['f_tags'] = ["VIP klient", "Doprava zdarma"]; //Priradiť označenia k faktúre
// Pridanie fakturačných údajov k dátam:
$data['f'] = $faktura;
// Príprava fakturačných položiek
$polozky = [];
// prvá položka:
$polozka = [];
$polozka['p_text'] = "Maliarske práce"; // Názov služby alebo tovaru
$polozka['p_quantity'] = "3"; // Množstvo
$polozka['p_unit'] = "hod"; // Merná jednotka
$polozka['p_price'] = "15"; // Cena za jednu jednotku bez DPH (Cena s DPH sa vypočíta)
$polozka['p_vat'] = "20"; // Daň v %
// priradenie k položkám:
$polozky[] = $polozka;
// druhá položka:
$polozka = [];
$polozka['p_text'] = "Upratovacie práce"; // Názov služby alebo tovaru
$polozka['p_quantity'] = "2"; // Množstvo
$polozka['p_unit'] = "hod"; // Merná jednotka
$polozka['p_vat'] = "20"; // Daň v %
$polozka['p_pricevat'] = "14.4"; // Cena za jednu jednotku vrátane DPH (Cena bez DPH sa vypočíta)
// priradenie k položkám:
$polozky[] = $polozka;
// priradenie fakturačných položiek k dátam:
$data['p'] = $polozky;
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/nf';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
echo "Uložené, nová faktúra má kód: " . $result['code'] . " <br />";
echo "Číslo faktúry: " . $result['number'] . " <br />";
echo "Faktúra vytvorená: " . $result['created'] . " <br />";
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
[code] => 1a35b89cd48eaf8940a6409ff45a0cc5
[number] => 2024099
[created] => 2024-02-15 17:45:12
)
POST https://www.faktury-online.com/api/zf(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| code | required parameter | Invoice code (obtained from the API response when the invoice was created) |
Array
(
[email] => name@example.com
[code] => 26915945a67c8b7ba74dac59c5badfbf
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine |
| 202 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 203 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 204 | Error | The API key is not entered correctly. |
| 205 | Error | The email parameter is missing. |
| 206 | Error | No session has been initialized |
| 207 | Error | The initialized session is not valid |
| 208 | Error | The username or the API key is not correct. |
| 209 | Error | The user does not exist. |
| 210 | Error | The invoice code is missing. |
| 211 | Error | The invoice code is not entered correctly. |
| 212 | Error | Error while selecting the invoice |
| 213 | Error | Error while rendering the invoice template |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
// vytvori subor cookie.txt, pozor na prava na zapis
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
$result = json_decode($output, true);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Kód faktúry:
$data['code'] = "14915945a66c8b7be74dac59c5badfbf";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/zf';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$output = curl_exec($ch);
$result = json_decode($output, true);
$url = $result['url'];
$cislo = $result['number'];
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// pre zobrazenie faktúry:
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $cislo . '.pdf"');
header('Cache-Control: private, max-age=0, must-revalidate');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
echo curl_exec($ch);
/*
// pre download faktúry:
header('Content-Type: application/download');
header('Content-Disposition: inline; filename="'.$cislo.'.pdf"');
header('Cache-Control: private, max-age=0, must-revalidate');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
echo curl_exec($ch);
*/
Array
(
[status] => 1
[url] => https://www.faktury-online.com/faktury/detail-subor?f=26915945a67c8b7ba74dac59c5badfbf
[number] => FA2019015
)
POST https://www.faktury-online.com/api/uf(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| code | required parameter | Invoice code (obtained from the API response when the invoice was created) |
| date | optional parameter | Invoice payment date Default value: 'current date' |
Array
(
[email] => name@example.com
[code] => 26915945a67c8b7ba74dac59c5badfbf
[date] => 2019-06-01
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine |
| 302 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 303 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 304 | Error | The API key is not entered correctly. |
| 305 | Error | The email parameter is missing. |
| 306 | Error | No session has been initialized |
| 307 | Error | The initialized session is not valid |
| 308 | Error | The username or the API key is not correct. |
| 309 | Error | The user does not exist. |
| 310 | Error | The invoice code is missing. |
| 311 | Error | The invoice code is not entered correctly. |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
$result = json_decode($output, true);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Kód faktúry:
$data['code'] = "14915945a66c8b7be74dac59c5badfbf";
// Dátum úhrady
$data['date'] = "2017-06-01"; // prípadne žiadny záznam pre nastavenie dnešného dňa úhrady
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/uf';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$output = curl_exec($ch);
$result = json_decode($output, true);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
echo "Faktúra bola uhradená";
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
)
POST https://www.faktury-online.com/api/status(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| code | required parameter | Invoice code (obtained from the API response when the invoice was created) |
Array
(
[email] => name@example.com
[code] => 26915945a67c8b7ba74dac59c5badfbf
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine |
| 402 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 403 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 404 | Error | The API key is not entered correctly. |
| 405 | Error | The email parameter is missing. |
| 406 | Error | No session has been initialized |
| 407 | Error | The initialized session is not valid |
| 408 | Error | The username or the API key is not correct. |
| 409 | Error | The user does not exist. |
| 410 | Error | The invoice code is missing. |
| 411 | Error | The invoice code is not entered correctly. |
| 412 | Error | Error while selecting the invoice |
| 413 | Error | Error while rendering the invoice template |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Kód faktúry:
$data['code'] = "14915945a66c8b7be74dac59c5badfbf";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/status';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
echo "Dodávateľ: {$result['supplier']} \n";
echo "Dodávateľ IČO: {$result['supplier_ico']} \n";
echo "Odberateľ / Zákazník: {$result['customer']} \n";
echo "Odberateľ / Zákazník IČO: {$result['customer_ico']} \n";
// Možnosti: faktura, zalohova_faktura, dobropis, danovy_doklad
echo "Typ faktúry: {$result['invoice_type']} \n";
echo "Číslo faktúry: {$result['invoice_number']} \n";
echo "Suma bez DPH: {$result['invoice_amount']} \n";
if (isset($result['invoice_amount_vat'])){
echo "Suma s DPH: {$result['invoice_amount_vat']} \n";
}
echo "Mena: {$result['invoice_currency']} \n";
echo "Dátum vystavenia: {$result['invoice_date_issue']} \n";
echo "Dátum dodania: {$result['invoice_date_delivery']} \n";
echo "Dátum splatnosti: {$result['invoice_date_due']} \n";
// Možnosti: ano, nie, ciastocne
echo "Faktúra uhradená: {$result['invoice_paid']} \n";
if ($result['invoice_paid'] != 'nie'){
echo "Uhradená suma: {$result['invoice_paid_amount']} \n";
echo "Dátum úhrady: {$result['invoice_date_payment']} \n";
}
echo "Vlastné dáta z API: {$result['invoice_api_custom']} \n";
if (isset($result['invoice_tags']) && is_array($result['invoice_tags'])){
echo "Tagy faktúry: ";
echo implode(", ",$result['invoice_tags']);
}
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
[supplier] => Moja firma s.r.o.
[supplier_street] => Mostová 56
[supplier_city] => Trenčín
[supplier_zip] => 843 21
[supplier_state] => Slovenská republika
[supplier_ico] => 43226520
[supplier_dic] => 2165052345
[supplier_icdph] => SK2165052345
[supplier_info] => Zapísaný v OR Trenčín, oddiel:Sro, vl.č.1234/X
[supplier_bankaccount] =>
[supplier_bank] => VÚB
[supplier_iban] => SK1200000000001234567891
[supplier_swift] =>
[supplier_email] => info@example.com
[supplier_phone] => +421 903 111 111
[supplier_web] => www.example.com
[supplier_custom_key_1] => Číslo licencie
[supplier_custom_value_1] => LIC-6554/2022
[supplier_custom_key_2] =>
[supplier_custom_value_2] =>
[customer] => Andrej Klačanský
[customer_street] => Štefánikova 455/2
[customer_city] => Martin
[customer_zip] => 876 54
[customer_state] =>
[customer_ico] =>
[customer_dic] =>
[customer_icdph] =>
[customer_email] => client@example.com
[customer_info] =>
[customer_delivery_name] =>
[customer_delivery_street] =>
[customer_delivery_city] =>
[customer_delivery_zip] =>
[customer_delivery_state] =>
[customer_custom_key_1] => Telefón
[customer_custom_value_1] => 5641655465
[customer_custom_key_2] =>
[customer_custom_value_2] =>
[invoice_type] => faktura
[invoice_number] => 2022-003
[invoice_vs] => 2022003
[invoice_ks] => 0308
[invoice_payment_type] => prevod
[invoice_currency] => EUR
[invoice_date_issue] => 2022-01-01
[invoice_date_delivery] => 2022-03-29
[invoice_date_due] => 2022-04-12
[invoice_order] =>
[invoice_issued_by] => Martin Hrubý
[invoice_note] => Poznámka pod položkami
[invoice_note_above] => Poznámka nad položkami
[invoice_amount] => 198
[invoice_amount_vat] => 198
[invoice_vat_reverse_c] => ano
[invoice_paid_advanced] => 50
[invoice_total_discount_perc] => 10
[invoice_to_pay] => 148
[invoice_paid] => ano
[invoice_paid_amount] => 148
[invoice_date_payment] => 2022-04-27
[invoice_api_custom] => Test custom
[invoice_language] => sk
[items] => Array
(
[0] => Array
(
[item_name] => Maliarske práce
[item_unit] => hod
[item_quantity] => 8
[item_unit_price] => 20
[item_unit_price_total] => 24
[item_vat_rate] => 20
[item_vat_total] => 32
[item_unit_price_vat] => 24
[item_unit_price_totla_vat] => 192
[item_api_custom] =>
)
[1] => Array
(
[item_name] => Upratovacie práce
[item_unit] => hod
[item_quantity] => 4
[item_unit_price] => 15
[item_unit_price_total] => 18
[item_vat_rate] => 20
[item_vat_total] => 12
[item_unit_price_vat] => 18
[item_unit_price_totla_vat] => 72
[item_api_custom] =>
)
)
[invoice_tags] => Array
(
[0] => Tag 1
[1] => Tag 2
)
)
POST https://www.faktury-online.com/api/list/created(request body: JSON with the parameters below)
POST https://www.faktury-online.com/api/list/issued(request body: JSON with the parameters below)
POST https://www.faktury-online.com/api/list/delivered(request body: JSON with the parameters below)
POST https://www.faktury-online.com/api/list/paid(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| from | optional parameter | Search date 'From' Format: YYYY-MM-DD |
| to | optional parameter | Search date 'To' Format: YYYY-MM-DD |
Array
(
[email] => name@example.com
[from] => 2021-01-01
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine |
| 502 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 503 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 504 | Error | The API key is not entered correctly. |
| 505 | Error | The email parameter is missing. |
| 506 | Error | No session has been initialized |
| 507 | Error | The initialized session is not valid |
| 508 | Error | The username or the API key is not correct. |
| 509 | Error | The user does not exist. |
| 510 | Error | Invalid URL. |
| 511 | Error | The 'From' date is not entered correctly. |
| 512 | Error | The 'To' date is not entered correctly. |
| 513 | Error | The requested list could not be identified, probably an error in the URL. |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Dáta v kalendárnom roku 2021
$data['from'] = '2021-01-01';
$data['to'] = '2021-12-31';
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/list/paid';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
$faktury = $result['invoices'];
foreach ($faktury as $faktura) {
echo "Kód: {$faktura['code']} \n";
echo "Dodávateľ: {$faktura['supplier']} \n";
echo "Dodávateľ IČO: {$faktura['supplier_ico']} \n";
echo "Odberateľ / Zákazník: {$faktura['customer']} \n";
echo "Odberateľ / Zákazník IČO: {$faktura['customer_ico']} \n";
// Možnosti: faktura, zalohova_faktura, dobropis, danovy_doklad
echo "Typ faktúry: {$faktura['invoice_type']} \n";
echo "Číslo faktúry: {$faktura['invoice_number']} \n";
echo "Suma bez DPH: {$faktura['invoice_amount']} \n";
if (isset($faktura['invoice_amount_vat'])) {
echo "Suma s DPH: {$faktura['invoice_amount_vat']} \n";
}
echo "Mena: {$faktura['invoice_currency']} \n";
echo "Dátum vystavenia: {$faktura['invoice_date_issue']} \n";
echo "Dátum dodania: {$faktura['invoice_date_delivery']} \n";
echo "Dátum splatnosti: {$faktura['invoice_date_due']} \n";
// Možnosti: ano, nie, ciastocne
echo "Faktúra uhradená: {$faktura['invoice_paid']} \n";
if ($faktura['invoice_paid'] != 'nie') {
echo "Uhradená suma: {$faktura['invoice_paid_amount']} \n";
echo "Dátum úhrady: {$faktura['invoice_date_payment']} \n";
}
echo "Vlastné dáta z API: {$faktura['invoice_api_custom']} \n";
echo "Tagy: {$faktura['tags']} \n";
}
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
[invoices] => Array
(
[0] => Array
(
[code] => 1a35b89cd48eaf8940a6409ff45a0cc5
[supplier] => Moja spoločnosť s.r.o.
[supplier_ico] => 43226520
[customer] => Andrej Klačanský
[customer_ico] => 40436097
[invoice_type] => faktura
[invoice_number] => 20210400
[invoice_amount] => 200
[invoice_amount_vat] => 240
[invoice_currency] => EUR
[invoice_date_issue] => 2021-01-10
[invoice_date_delivery] => 2021-01-10
[invoice_date_due] => 2021-01-25
[invoice_paid] => ano
[invoice_paid_amount] => 240
[invoice_date_payment] => 2021-01-19
[invoice_api_custom] => data z API
[tags] => Tag1 ,Tag2
)
)
)
POST https://www.faktury-online.com/api/ncp(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| apitest | optional parameter | The apitest parameter specifies whether the created quote is for testing purposes only. This parameter should be used only by developers implementing the Faktury Online API. The system will treat the created quote as a test one and will delete it within 5 to 10 minutes. We recommend keeping this value enabled while testing your API implementation. Disable this value in production, otherwise the quotes will be deleted automatically. Possible values: 1 or 0 Default value: 0 |
| Parameter | Attribute | Description |
|---|---|---|
| d_id | option 1 / required parameter | Supplier ID (you will find the ID in the My companies list). |
| d_name | option 2 / required parameter | Supplier's business name. |
| d_street | option 2 / optional parameter | Supplier's street. |
| d_city | option 2 / optional parameter | Supplier's city. |
| d_state | option 2 / optional parameter | Supplier's country. |
| d_zip | option 2 / optional parameter | Supplier's postal code. |
| d_ico | option 2 / optional parameter | Supplier's Company ID (IČO). |
| d_dic | option 2 / optional parameter | Supplier's Tax ID (DIČ). |
| d_icdph | option 2 / optional parameter | Supplier's VAT ID (IČ DPH). |
| d_vatpayer | option 2 / optional parameter | VAT payer. Possible values: VAT payer: 1 Non-VAT payer: 0 Default value: 0 |
| d_viewpayer | option 2 / optional parameter | Show on the quote whether the supplier is a VAT payer. Possible values: Yes: 1 No: 0 Default value: 1 |
| d_info | option 2 / optional parameter | Supplier information. |
| d_bankaccount | option 2 / optional parameter | Supplier's bank account number. |
| d_bank | option 2 / optional parameter | Supplier's bank name. |
| d_iban | option 2 / optional parameter | Supplier's IBAN. |
| d_swift | option 2 / optional parameter | Supplier's SWIFT. |
| d_email | option 2 / optional parameter | Supplier's e-mail. |
| d_web | option 2 / optional parameter | Supplier's website. |
| d_phone | option 2 / optional parameter | Supplier's phone. |
| d_custom_key_1 | option 2 / optional parameter | Custom field no. 1 - key |
| d_custom_value_1 | option 2 / optional parameter | Custom field no. 1 - value |
| d_custom_key_2 | option 2 / optional parameter | Custom field no. 2 - key |
| d_custom_value_2 | option 2 / optional parameter | Custom field no. 2 - value |
| Parameter | Attribute | Description |
|---|---|---|
| o_name | required parameter | Customer's business name. |
| o_street | optional parameter | Customer's street. |
| o_city | optional parameter | Customer's city. |
| o_state | optional parameter | Customer's country. |
| o_zip | optional parameter | Customer's postal code. |
| o_ico | optional parameter | Customer's Company ID (IČO). |
| o_dic | optional parameter | Customer's Tax ID (DIČ). |
| o_icdph | optional parameter | Customer's VAT ID (IČ DPH). |
| o_email | optional parameter | Customer's e-mail. |
| o_name_d | optional parameter | Delivery address - business name. |
| o_street_d | optional parameter | Delivery address - street. |
| o_city_d | optional parameter | Delivery address - city. |
| o_state_d | optional parameter | Delivery address - country. |
| o_zip_d | optional parameter | Delivery address - postal code. |
| o_custom_key_1 | optional parameter | Custom field no. 1 - key |
| o_custom_value_1 | optional parameter | Custom field no. 1 - value |
| o_custom_key_2 | optional parameter | Custom field no. 2 - key |
| o_custom_value_2 | optional parameter | Custom field no. 2 - value |
| Parameter | Attribute | Description |
|---|---|---|
| po_rounding | optional parameter | Rounding of the total amount due Possible values: 0: no rounding 1: round up to a whole number 2: round down to a whole number 3: round to 5 hundredths (5 cents) Default value: 0 |
| po_number | optional parameter | Quote number. If not provided, the number is automatically incremented by 1 from the most recently created quote (the issue date is decisive; the quote number must be numeric). |
| po_date_issue | optional parameter | Issue date. In the YYYY-MM-DD format. Default value: current date |
| po_date_expiration | optional parameter | Quote validity date. In the YYYY-MM-DD format. |
| po_issued_by | optional parameter | Quote issued by. |
| po_note_above | optional parameter | Quote note. Displayed above the items. |
| po_note | optional parameter | Quote note. Displayed below the items. If the supplier is selected by the d_id parameter and po_note is empty, the note stored for that supplier is displayed. |
| po_internal_note | optional parameter | Internal note. For internal use only. It is not shown on the quote; it is visible only in the document detail in the system. |
| po_logo | optional parameter | Logo display. Possible values: Not shown: 0 Shown: 1 (only if the supplier was loaded by d_id and has a logo stored) |
| po_stamp | optional parameter | Stamp display. Possible values: Not shown: 0 Shown: 1 (only if the supplier was loaded by d_id and has a stamp stored) |
| po_currency | optional parameter | Quote currency. Default value: EUR |
| po_language | optional parameter | Quote language. Possible values: SK, CS, EN, DE, FR, ES, IT, HU, PL, RU, NO, DK Default value: SK |
| po_custom | optional parameter | Any text information sent via the API. It is shown as a separate column in the Excel export. text, max. 50 characters |
| po_tags | optional parameter | A list (array) of tags from the My labels / tags list to be assigned to the document. Format: Array
(
[0] => Tag name 1
[1] => Tag name 2
)
|
| Parameter | Attribute | Description |
|---|---|---|
| p_text | required parameter | Quote item text. |
| p_quantity | required parameter | Quantity. Number. |
| p_unit | required parameter | Unit of measure. For example kg, pcs, ... |
| p_price | option 1 / optional parameter | Price per unit of measure excluding tax. The price including VAT is calculated from this value. If this attribute is not provided, the p_pricevat attribute must be provided. For non-VAT payers this parameter is required. |
| p_vat | optional parameter | Tax in percent. Fill in only if the supplier is a VAT payer. |
| p_pricevat | option 2 / optional parameter | Price per unit of measure including tax. If this attribute is provided, the price excluding tax is calculated from it regardless of whether the p_price attribute was provided. |
| p_custom | optional parameter | Any text information sent via the API for the quote item. It is shown as a separate column in the Excel export. text, max. 50 characters |
Array
(
[email] => name@example.com
[apitest] => 1
[d] => Array
(
[d_name] => Moja spoločnosť s.r.o.
[d_street] => Mostová 56
[d_city] => Trenčín
[d_zip] => 843 21
[d_state] => Slovenská republika
[d_ico] => 43226520
[d_dic] => 2165052345
[d_icdph] => SK2165052345
[d_vatpayer] => 1
[d_viewpayer] => 0
[d_info] => Zapísaný v OR Trenčín,oddiel:Sro, vl.č.1234/X
[d_bankaccount] => 1234567890/0200
[d_bank] => VÚB
[d_iban] =>
[d_swift] =>
[d_email] => info@example.com
[d_web] => www.example.com
[d_phone] => +421 903 111 111
)
[o] => Array
(
[o_name] => Andrej Klačanský
[o_street] => Štefánikova 455/2
[o_city] => Martin
[o_zip] => 876 54
[o_state] =>
[o_ico] =>
[o_dic] =>
[o_icdph] =>
[o_email] => client@example.com
)
[po] => Array
(
[po_number] => 2022099
[po_date_issue] => 2022-01-01
[po_date_expiration] => 2022-01-15
[po_issued_by] => Martin Hrubý
[po_note] => Nezáväzná cenová ponuka platná 15 dní.
[po_currency] => EUR
[po_language] => SK
[po_tags] => Array
(
[0] => VIP klient
[1] => Doprava zdarma
)
)
[p] => Array
(
[0] => Array
(
[p_text] => Diamantový kotúč na obklady
[p_quantity] => 8
[p_unit] => ks
[p_price] => 15
[p_vat] => 20
[p_pricevat] => 20
)
[1] => Array
(
[p_text] => Sada nylónových drôtených kief
[p_quantity] => 10
[p_unit] => ks
[p_price] => 12.50
[p_vat] => 20
[p_pricevat] => 15
)
)
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine, the quote was created |
| 602 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 603 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 604 | Error | The API key is not entered correctly. |
| 605 | Error | The email parameter is missing. |
| 606 | Error | The username or the API key is not correct. |
| 607 | Error | The user does not exist. |
| 608 | Error | The supplier ID or the supplier name must be provided. |
| 609 | Error | The provided supplier ID is not correct. |
| 610 | Error | The supplier name is missing. |
| 611 | Error | The customer name is missing. |
| 612 | Error | Quote data is missing. |
| 613 | Error | Quote items are missing or not entered correctly. |
| 614 | Error | Error in an item, a required value is missing. |
| 615 | Error | The quantity in a quote item is not a number. |
| 616 | Error | The price excluding tax in an item is not a number. |
| 617 | Error | The tax in percent is not entered correctly. |
| 618 | Error | An item has neither a price excluding tax nor a price including tax. |
| 619 | Error | Unsupported quote language. |
| 620 | Error | An item has no price excluding tax while the supplier is not a VAT payer. |
| 621 | Error | The price including tax in an item is not a number. |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// V prípade, že budeme testovať API, zvolíme hodnotu 1
// Znamená to, že všetky vytvorené cenové ponuky sa automaticky odstránia o 5 - 10 minút
$data['apitest'] = 1; //hodnota môže byť 1 alebo 0
// Príprava dát dodávateľa
$dodavatel = [];
// Dodávateľa môžeme použiť už existujúceho (uloženého v zozname Moje spoločnosti)
// alebo dodávateľa vytvoríme ručne vložením dát.
// Ak použijeme existujúceho dodávateľa, vložíme iba jeho ID:
// $dodavatel['d_id'] = 123; // ID dodávateľa nájdeme v zozname Moje spoločnosti
// alebo (nie obe):
$dodavatel['d_name'] = "Moja spoločnosť s.r.o."; // Obchodný názov dodávateľa
$dodavatel['d_street'] = "Mostová 56"; // Ulica
$dodavatel['d_city'] = "Trenčín"; // Mesto
$dodavatel['d_zip'] = "843 21"; // PSČ
$dodavatel['d_state'] = "Slovenská republika"; // Štát
$dodavatel['d_ico'] = "43226520"; // IČO
$dodavatel['d_dic'] = "2165052345"; // DIČ
$dodavatel['d_icdph'] = "SK2165052345"; // IČDPH
$dodavatel['d_vatpayer'] = "1"; // Platca DPH. Pokiaľ je dodávateľ platca DPH ponechajte hodnotu 1,
// ak nie je platca DPH, napíšte 0.
$dodavatel['d_viewpayer'] = "1"; // Pokiaľ chcete zobraziť informáciu v cenovej ponuke,
// že dodávateľ je platcom/neplatcom DPH.
$dodavatel['d_info'] = "Zapísaný v OR Trenčín, oddiel:Sro, vl.č.1234/X"; //Info o dodávateľovi
$dodavatel['d_bankaccount'] = ""; // Číslo účtu
$dodavatel['d_bank'] = "VÚB"; // Názov banky
$dodavatel['d_iban'] = "SK1200000000001234567891"; // IBAN
$dodavatel['d_swift'] = ""; // SWIFT
$dodavatel['d_email'] = "info@example.com"; // E-mail
$dodavatel['d_web'] = "www.example.com"; // WEB
$dodavatel['d_phone'] = "+421 903 111 111"; // Telefón
// Pridanie dodávateľa k dátam:
$data['d'] = $dodavatel;
// Príprava dát odberateľa
$odberatel = [];
$odberatel['o_name'] = "Andrej Klačanský"; // Názov odberateľa
$odberatel['o_street'] = "Štefánikova 455/2"; // Ulica
$odberatel['o_city'] = "Martin"; // Mesto
$odberatel['o_zip'] = "876 54"; // PSČ
$odberatel['o_state'] = ""; // Štát
$odberatel['o_ico'] = ""; // IČO
$odberatel['o_dic'] = ""; // DIČ
$odberatel['o_icdph'] = ""; // IČDPH
$odberatel['o_email'] = "client@example.com"; // Email odberateľa
// Pridanie odberateľa k dátam:
$data['o'] = $odberatel;
// Príprava údajov cenovej ponuky
$cenovaPonuka = [];
// Číslo cenovej ponuky môžeme zadať ručne:
$cenovaPonuka['po_number'] = "2022099";
// Ak chceme vypočítať číslo automaticky, toto pole neuvedieme
$cenovaPonuka['po_date_issue'] = '2022-01-01'; // Dátum vystavenia vo formáte RRRR-MM-DD
$cenovaPonuka['po_date_expiration'] = '2022-01-15'; // Dátum platnosti vo formáte RRRR-MM-DD
$cenovaPonuka['po_issued_by'] = "Martin Hrubý"; //Ponuku vystavil
$cenovaPonuka['po_logo'] = "1"; // Zobraziť logo dodávateľa. Iba v prípade, že bol dodávateľ
// vybraný pomocou ID a má priradené logo
$cenovaPonuka['po_stamp'] = "1"; // Zobraziť pečiatku dodávateľa. Iba v prípade, že bol
// dodávateľ vybraný pomocou ID a má priradenú pečiatku
$cenovaPonuka['po_currency'] = "EUR"; // Mena cenovej ponuky
$cenovaPonuka['po_language'] = "SK"; // Jazyk cenovej ponuky
$cenovaPonuka['po_tags'] = ["VIP klient", "Doprava zdarma"]; // Priradiť označenia k ponuke
// Pridanie údajov ponuky k dátam:
$data['po'] = $cenovaPonuka;
// Príprava položiek ponuky
$polozky = [];
// prvá položka:
$polozka = [];
$polozka['p_text'] = "Diamantový kotúč na obklady"; // Názov služby alebo tovaru
$polozka['p_quantity'] = "8"; // Množstvo
$polozka['p_unit'] = "ks"; // Merná jednotka
$polozka['p_price'] = "15"; // Cena za jednu jednotku bez DPH (Cena s DPH sa vypočíta)
$polozka['p_vat'] = "20"; // Daň v %
// priradenie k položkám:
$polozky[] = $polozka;
// druhá položka:
$polozka = [];
$polozka['p_text'] = "Sada nylónových drôtených kief"; // Názov služby alebo tovaru
$polozka['p_quantity'] = "10"; // Množstvo
$polozka['p_unit'] = "ks"; // Merná jednotka
$polozka['p_vat'] = "20"; // Daň v %
$polozka['p_pricevat'] = "15"; // Cena za jednu jednotku vrátane DPH (Cena bez DPH sa vypočíta)
// priradenie k položkám:
$polozky[] = $polozka;
// priradenie položiek k dátam:
$data['p'] = $polozky;
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/ncp';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
echo "Uložené, nová cenová má kód: " . $result['code'] . " <br />";
echo "Číslo cenovej ponuky: " . $result['number'] . " <br />";
echo "Cenová ponuka vytvorená: " . $result['created'] . " <br />";
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
[code] => ca9658a5448a945059f44658bac985e5
[number] => 2022099
[created] => 2022-01-01 09:49:05
)
POST https://www.faktury-online.com/api/zcp(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| code | required parameter | Quote code (obtained from the API response when the quote was created) |
Array
(
[email] => name@example.com
[code] => aa9025bc0094c88445daa22b90eff3b
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine |
| 702 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 703 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 704 | Error | The API key is not entered correctly. |
| 705 | Error | The email parameter is missing. |
| 706 | Error | No session has been initialized |
| 707 | Error | The initialized session is not valid |
| 708 | Error | The username or the API key is not correct. |
| 709 | Error | The user does not exist. |
| 710 | Error | The quote code is missing. |
| 711 | Error | The quote code is not entered correctly. |
| 712 | Error | Error while selecting the quote |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
// vytvori subor cookie.txt, pozor na prava na zapis
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
$result = json_decode($output, true);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Kód cenovej ponuky:
$data['code'] = "14915945a66c8b7be74dac59c5badfbf";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/zcp';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$output = curl_exec($ch);
$result = json_decode($output, true);
$url = $result['url'];
$cislo = $result['number'];
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// pre zobrazenie cenovej ponuky:
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $cislo . '.pdf"');
header('Cache-Control: private, max-age=0, must-revalidate');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
echo curl_exec($ch);
/*
// pre download cenovej ponuky:
header('Content-Type: application/download');
header('Content-Disposition: inline; filename="'.$cislo.'.pdf"');
header('Cache-Control: private, max-age=0, must-revalidate');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
echo curl_exec($ch);
*/
Array
(
[status] => 1
[url] => https://www.faktury-online.com/cenove-ponuky/detail-subor?cp=26915945a67c8b7ba74dac59c5badfbf
[number] => 2022099
)
POST https://www.faktury-online.com/api/cp-status(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| code | required parameter | Quote code (obtained from the API response when the quote was created) |
Array
(
[email] => name@example.com
[code] => ae47ece062b0021144d768446b071fee
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine |
| 802 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 803 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 804 | Error | The API key is not entered correctly. |
| 805 | Error | The email parameter is missing. |
| 806 | Error | No session has been initialized |
| 807 | Error | The initialized session is not valid |
| 808 | Error | The username or the API key is not correct. |
| 809 | Error | The user does not exist. |
| 810 | Error | The quote code is missing. |
| 811 | Error | The quote code is not entered correctly. |
| 812 | Error | Error while selecting the quote |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "vJyMc*4@2754*wGhofIWi!QDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Kód cenovej ponuky:
$data['code'] = "ae47ece062b0021144d768446b071fee";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/cp-status';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
echo "Dodávateľ: {$result['supplier']} \n";
echo "Dodávateľ IČO: {$result['supplier_ico']} \n";
echo "Odberateľ / Zákazník: {$result['customer']} \n";
echo "Odberateľ / Zákazník IČO: {$result['customer_ico']} \n";
echo "Číslo cenovej ponuky: {$result['offer_number']} \n";
echo "Suma bez DPH: {$result['offer_amount']} \n";
if (isset($result['offer_amount_vat'])){
echo "Suma s DPH: {$result['offer_amount_vat']} \n";
}
echo "Mena: {$result['offer_currency']} \n";
echo "Dátum vystavenia: {$result['offer_date_issue']} \n";
echo "Dátum platnosti: {$result['offer_date_expiration']} \n";
echo "Vlastné dáta z API: {$result['offer_api_custom']} \n";
if (isset($result['offer_tags']) && is_array($result['offer_tags'])){
echo "Tagy cenovej ponuky: ";
echo implode(", ",$result['offer_tags']);
}
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
[supplier] => Moja firma s.r.o.
[supplier_street] => Uličná 123
[supplier_city] => Bratislava
[supplier_zip] => 811 05
[supplier_state] => Slovensko
[supplier_ico] => 12345678
[supplier_dic] => 2131154505
[supplier_icdph] =>
[supplier_info] => Spol. zapísaná v OR Okresného súdu Bratislava I, Oddiel: Sro, Vložka č. 11111/B
[supplier_bankaccount] => 2100501234/8330
[supplier_bank] => Fio banka, a.s.
[supplier_iban] => SK6583300000002100501234
[supplier_swift] => FIOZSKBAXXX
[supplier_email] => email@moja-spolocnost.sk
[supplier_phone] => 0911 111 222
[supplier_web] => www.moja-spolocnost.sk
[supplier_custom_key_1] =>
[supplier_custom_value_1] =>
[supplier_custom_key_2] =>
[supplier_custom_value_2] =>
[customer] => Môj klient, s.r.o.
[customer_street] => Krátka 123
[customer_city] => Trenčín
[customer_zip] => 911 01
[customer_state] =>
[customer_ico] => 12345678
[customer_dic] => 2020301111
[customer_icdph] => SK2020301111
[customer_email] => info@isset.sk
[customer_info] =>
[customer_custom_key_1] => ID klienta
[customer_custom_value_1] => 156516
[customer_custom_key_2] =>
[customer_custom_value_2] =>
[offer_number] => 2022002
[offer_amount] => 183.69
[offer_amount_vat] => 215.75
[offer_total_discount_perc] => 10
[offer_currency] => EUR
[offer_date_issue] => 2021-10-01
[offer_date_expiration] => 2021-10-25
[offer_note] => Poznámka pod položkami
[offer_note_above] => Poznámka nad položkami
[offer_api_custom] =>
[offer_language] => sk
[items] => Array
(
[0] => Array
(
[item_name] => Položka 1
[item_unit] => ks
[item_quantity] => 1
[item_unit_price] => 100.3
[item_unit_price_total] => 120.36
[item_vat_rate] => 20
[item_vat_total] => 20.06
[item_unit_price_vat] => 120.36
[item_unit_price_totla_vat] => 120.36
[item_api_custom] =>
)
[1] => Array
(
[item_name] => Popis druhej položky
[item_unit] => ks
[item_quantity] => 5
[item_unit_price] => 15.5645
[item_unit_price_total] => 18.67
[item_vat_rate] => 20
[item_vat_total] => 15.56
[item_unit_price_vat] => 18.67
[item_unit_price_totla_vat] => 93.38
[item_api_custom] =>
)
[2] => Array
(
[item_name] => Popis tretej položky
[item_unit] => ks
[item_quantity] => 2
[item_unit_price] => 12.99
[item_unit_price_total] => 12.99
[item_vat_rate] => 0
[item_vat_total] => 0
[item_unit_price_vat] => 12.99
[item_unit_price_totla_vat] => 25.98
[item_api_custom] =>
)
)
[offer_tags] => Array
(
[0] => Tag 1
[1] => Tag 2
)
)
POST https://www.faktury-online.com/api/cp-list/created(request body: JSON with the parameters below)
POST https://www.faktury-online.com/api/cp-list/issued(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required parameter | E-mail (or username) you use to log in to Faktury Online. | |
| from | optional parameter | Search date 'From' Format: YYYY-MM-DD |
| to | optional parameter | Search date 'To' Format: YYYY-MM-DD |
Array
(
[email] => name@example.com
[from] => 2022-01-01
[to] => 2022-01-31
)
| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine |
| 902 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 903 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 904 | Error | The API key is not entered correctly. |
| 905 | Error | The email parameter is missing. |
| 906 | Error | No session has been initialized |
| 907 | Error | The initialized session is not valid |
| 908 | Error | The username or the API key is not correct. |
| 909 | Error | The user does not exist. |
| 910 | Error | Invalid URL. |
| 911 | Error | The 'From' date is not entered correctly. |
| 912 | Error | The 'To' date is not entered correctly. |
| 913 | Error | The requested list could not be identified, probably an error in the URL. |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Inicializácia sedenia
$url = 'https://www.faktury-online.com/api/init';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Dáta v kalendárnom roku 2022
$data['from'] = '2022-01-01';
$data['to'] = '2022-12-31';
// Dáta sa uložia do formátu JSON:
$data_json = json_encode($data);
// Dáta sa odošlú (POST, telo požiadavky = JSON):
$url = 'https://www.faktury-online.com/api/cp-list/issued';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$output = curl_exec($ch);
// Výsledok:
$result = json_decode($output, true);
if ($result['status'] == 1) {
$cenovePonuky = $result['offers'];
foreach ($cenovePonuky as $cenovaPonuka) {
echo "Kód: {$cenovaPonuka['code']} \n";
echo "Dodávateľ: {$cenovaPonuka['supplier']} \n";
echo "Dodávateľ IČO: {$cenovaPonuka['supplier_ico']} \n";
echo "Odberateľ / Zákazník: {$cenovaPonuka['customer']} \n";
echo "Odberateľ / Zákazník IČO: {$cenovaPonuka['customer_ico']} \n";
echo "Číslo cenovej ponuky: {$cenovaPonuka['offer_number']} \n";
echo "Suma bez DPH: {$cenovaPonuka['offer_amount']} \n";
if (isset($cenovaPonuka['offer_amount_vat'])) {
echo "Suma s DPH: {$cenovaPonuka['offer_amount_vat']} \n";
}
echo "Mena: {$cenovaPonuka['offer_currency']} \n";
echo "Dátum vystavenia: {$cenovaPonuka['offer_date_issue']} \n";
echo "Dátum platnosti: {$cenovaPonuka['offer_date_expiration']} \n";
echo "Vlastné dáta z API: {$cenovaPonuka['offer_api_custom']} \n";
echo "Tagy: {$cenovaPonuka['tags']} \n";
}
} else {
echo "Vyskytla sa chyba č." . $result['status'];
}
Array
(
[status] => 1
[offers] => Array
(
[0] => Array
(
[code] => ae47ece062b0021144d768446b071fee
[supplier] => Moja spoločnosť s.r.o.
[supplier_ico] => 43226520
[customer] => Andrej Klačanský
[customer_ico] => 40436097
[offer_number] => 20220123
[offer_amount] => 200
[offer_amount_vat] => 240
[offer_currency] => EUR
[offer_date_issue] => 2022-01-10
[offer_date_expiration] => 2021-01-25
[offer_api_custom] => data z API
[tags] => Tag1 ,Tag2
)
)
)
/api/peppol-send. The system immediately checks the invoice (supplier and customer data, permission, credit, VAT regimes) and validates the generated e-invoice (UBL format, EN 16931 and Peppol BIS rules). If anything is missing you get the error right in the response and nothing is sent. If the invoice only has warnings, it is not sent until you fix it or send it with the ignore_warnings=1 parameter. If everything is fine, the invoice is queued and the response status is queued./api/peppol-status.Note on timing. Sending an e-invoice is not instant. A call to /api/peppol-send usually takes 1 to 5 seconds because the whole e-invoice is generated and validated synchronously. The hand-over to the access point provider runs in the background, usually within 1 to 2 minutes of queueing (status sent). Delivery confirmation to the buyer (status accepted) may take 10 to 20 minutes. Do not wait for the result within a single call and do not resend the invoice while its status is not final.
/api/peppol-status:
| peppol_status | Meaning |
|---|---|
| not_sent | The invoice has not been queued for sending yet. |
| queued | Waiting in the queue (processed continuously, in the order of queueing). If the access point provider is temporarily unavailable, the system keeps retrying for about 30 minutes, after which the state changes to sent or failed. |
| sent | The access point provider has accepted the e-invoice and is delivering it into the Peppol network. |
| accepted | The e-invoice was delivered to the customer's access point. Final successful state. |
| rejected | The provider or the network rejected the e-invoice. Details are in peppol_error. |
| not_valid | The e-invoice failed validation in the network. Correct the data and send a corrective document. |
| failed | Sending failed (technical error or attempts exhausted). Details are in peppol_error and error_code. If error_code is receiver_unregistered, the invoice was sent and reported to the Financial Administration, do not send it again. |
accepted state is updated continuously from the provider's information, usually 10 to 20 minutes after sending. The system does not push the result (no webhook); you request the state yourself via /api/peppol-status.
/api/init, just like for the other API calls (see the basic API manual)./api/init). API call for sending an invoice:
POST https://www.faktury-online.com/api/peppol-send(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required | Email (or username) you use to log in to Faktúry online. | |
| code | required | Invoice code (returned by the API when the invoice was created). |
| validate_only | optional | Value 1 only checks and validates the invoice, nothing is sent and no credit is used. Useful to verify the data before the real sending. Default value: 0 |
| ignore_warnings | optional | Value 1 sends the invoice even if it has warnings (the warnings field). With value 0, an invoice with warnings is not sent and status 1622 is returned. Errors always block sending. Default value: 0 |
Array
(
[email] => name@example.com
[code] => 26915945a67c8b7ba74dac59c5badfbf
[validate_only] => 0
[ignore_warnings] => 0
)
Array
(
[status] => 1
[type] => OK
[invoice_code] => 26915945a67c8b7ba74dac59c5badfbf
[receiver_registered] => 1
[warnings] => Array
(
)
[test_mode] => 0
[peppol_status] => queued
[queue_id] => 1024
[message] => Queued for sending. Poll /api/peppol-status for the result.
)
| Field | Description |
|---|---|
| peppol_status | queued = queued for sending; with validate_only it is not_sent and the field validated is 1. |
| queue_id | Queue record number (a repeated call for the same invoice returns the same one). |
| receiver_registered | true = the customer is registered in the Peppol network, false = it is not, null = the registration could not be verified. The invoice is sent in all cases, the result is shown by /api/peppol-status. |
| warnings | List of warnings (code, message). The Peppol network accepts such an e-invoice, but the details may be wrong. The list of codes is below. |
| test_mode | 1 = the company sends through a test provider (the e-invoice does not enter the live network). |
Array
(
[status] => 1618
[type] => Error
[error_code] => rezim_k_bez_icdph
[message] => The e-invoice cannot be sent: the regime Intra-EU supply of goods requires the customer's VAT ID.
)
Response with warnings (status 1622):
Array
(
[status] => 1622
[type] => Error
[error_code] => warnings
[message] => The invoice has warnings. Check and fix the invoice, or send it again with ignore_warnings=1.
[invoice_code] => 26915945a67c8b7ba74dac59c5badfbf
[receiver_registered] => 1
[warnings] => Array
(
[0] => Array
(
[code] => issue_date_not_today
[message] => The issue date of an e-invoice should be the same as the day it is sent to the Peppol network. This invoice has the issue date 17.10.2026. We recommend changing the date.
)
[1] => Array
(
[code] => buyer_vat_id_missing
[message] => The customer is a VAT payer (VAT ID SK2020123456), but the VAT ID is missing on the invoice.
)
)
)
The field error_code is a machine-readable error code (see the list below), message is an English description. On e-invoice validation errors the field errors lists the violated rules. With code 1615 (invoice already sent) the response also contains peppol_document_id of the original sending.| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | The invoice was queued (or, with validate_only, passed the checks). |
| 1602 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 1603 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 1604 | Error | The API key is not entered correctly. |
| 1605 | Error | Email or username is missing. |
| 1606 | Error | The session is not initialised (call /api/init first). |
| 1607 | Error | The session is invalid. |
| 1608 | Error | Wrong combination of API key and email. |
| 1609 | Error | The account is not active or does not match the session. |
| 1610 | Error | The parameter code is missing. |
| 1611 | Error | No invoice exists with the given code. |
| 1612 | Error | This document type is not sent to the Peppol network (for example a proforma invoice). |
| 1613 | Error | Incorrect supplier VAT data (VAT payer without VAT ID, identical VAT ID of supplier and customer, missing or invalid Tax ID). |
| 1614 | Error | The company has not completed the e-invoice activation, the account has no sending permission or the provider is not active. |
| 1615 | Error | The invoice has already been sent; repeated sending is not possible. |
| 1616 | Error | The company has no active package or its transaction credit is used up. |
| 1617 | Error | The customer's country could not be recognised. |
| 1618 | Error | The VAT regime on the invoice is not allowed for an e-invoice (for example intra-EU supply without the customer's VAT ID, or intra-EU supply combined with export). |
| 1619 | Error | The e-invoice failed validation (the errors field lists the violated rules). |
| 1620 | Error | Unexpected error. |
| 1621 | Error | Too many requests, maximum 60 per minute. |
| 1622 | Error | The invoice has warnings and was not sent (the warnings field). Fix it or send it with ignore_warnings=1. |
/api/init). API call for the sending status:
POST https://www.faktury-online.com/api/peppol-status(request body: JSON with the parameters below)
| Parameter | Attribute | Description |
|---|---|---|
| key | optional parameter | API key. In version 2 it is sent in the Authorization header (see Call format). The key parameter in the request body is accepted for backward compatibility only. |
| required | Email (or username) you use to log in to Faktúry online. | |
| code | required | Invoice code. |
Array
(
[email] => name@example.com
[code] => 26915945a67c8b7ba74dac59c5badfbf
)
Array
(
[status] => 1
[type] => OK
[invoice_code] => 26915945a67c8b7ba74dac59c5badfbf
[invoice_number] => 2026099
[peppol_status] => accepted
[peppol_document_id] => doc_5b1c9a2e-7f40-4c8a-9d21-3e8f0a6b7c1d
[peppol_error] =>
[error_code] =>
[queue_attempts] => 1
[peppol_queued_at] => 2026-10-01 10:12:05
[peppol_sent_at] => 2026-10-01 10:13:02
[peppol_status_checked_at] => 2026-10-01 10:28:00
)
| Field | Description |
|---|---|
| peppol_status | Sending state (see the table of states in the first section). |
| peppol_document_id | Document identifier assigned by the access point provider on acceptance. |
| peppol_error | English error description for the states rejected, not_valid and failed, otherwise null. |
| error_code | Machine-readable code of the last error (see the list below), otherwise null. |
| queue_attempts | Number of sending attempts (a temporary error is retried up to three times). |
| peppol_queued_at | Time of queueing. |
| peppol_sent_at | Time of hand-over to the provider. |
| peppol_status_checked_at | Time of the last delivery check. |
accepted, rejected, not_valid or failed. Delivery confirmation may take 10 to 20 minutes, more frequent queries bring no new state.| Status ID | Meaning | Description |
|---|---|---|
| 1 | OK | Everything went fine. |
| 1702 | Error | Input data is missing: the request body is not valid JSON and the data parameter was not provided either. |
| 1703 | Error | The API key is missing (neither in the Authorization header nor in the data) or does not have 32 characters. |
| 1704 | Error | The API key is not entered correctly. |
| 1705 | Error | Email or username is missing. |
| 1706 | Error | The session is not initialised (call /api/init first). |
| 1707 | Error | The session is invalid. |
| 1708 | Error | Wrong combination of API key and email. |
| 1709 | Error | The account is not active or does not match the session. |
| 1710 | Error | The parameter code is missing. |
| 1711 | Error | No invoice exists with the given code. |
| 1712 | Error | Too many requests, maximum 60 per minute. |
/api/peppol-status.failed state and you can queue it again./api/peppol-send take 2 to 4 seconds; allow for that in your connection timeout.error_code in the responses lets you handle errors programmatically. The most common values:
| error_code | Meaning |
|---|---|
| fa_not_found | No invoice exists with the given code. |
| unsupported_type | The document type is not sent (proforma invoice). |
| vat_mismatch_platca_bez_icdph | The supplier is a VAT payer but has no VAT ID. |
| rovnake_icdph | Supplier and customer have the same VAT ID. |
| missing_dic, invalid_sk_dic | Missing or invalid supplier Tax ID. |
| no_postar | The company has not completed the e-invoice activation. |
| no_permission | The account has no permission to send for this company. |
| resend_blocked | The invoice has already been sent. |
| no_credit, no_credit_delegate | Credit used up or no package. |
| err_country_buyer | Unrecognised customer country. |
| receiver_unregistered | The customer is not registered in the Peppol network and the e-invoice could not be delivered. The sending was recorded, the invoice was reported to the Financial Administration and charged as sent. Do not send it again, you can email it to the customer. |
| warnings | The invoice has warnings and was not sent (the warnings field). Fix it or send it with ignore_warnings=1. |
| rezim_k_bez_icdph, rezim_k_bez_datumu, rezim_k_krajina, rezim_k_kombinacia, rezim_mimo_eu_krajina, rezim_ae_krajina | Not allowed combination of VAT regime and customer data. |
| validation_failed | The e-invoice failed validation before sending (errors field). |
| dp_rejected | The provider rejected the e-invoice (state rejected). |
| pdf_render_failed | The PDF attachment could not be created. |
| api_error, api_error_with_detail, api_error_with_rules | Error on the provider or network side; details in message or errors. |
| too_many_requests | Per-minute call limit exceeded. |
| code | Meaning |
|---|---|
| missing_supplier_street, missing_supplier_city, missing_supplier_zip | The supplier address is missing (street, city, postcode). |
| missing_buyer_street, missing_buyer_city, missing_buyer_zip | The customer address is missing. |
| missing_delivery_date | The date of supply is missing. |
| issue_date_not_today | The issue date is not today. |
| buyer_tax_id_not_found | The customer's Tax ID is not in the Financial Administration register. |
| buyer_tax_id_other_company | The customer's Tax ID belongs to a company with a different Company ID. The e-invoice is delivered according to the Tax ID. |
| buyer_vat_id_not_registered | The customer's VAT ID is not in the list of VAT payers. |
| buyer_vat_id_other_company | The customer's VAT ID belongs to a company with a different Company ID. |
| buyer_vat_id_tax_id_mismatch | The VAT ID does not match the Tax ID. |
| buyer_vat_id_missing | The customer is a VAT payer, but the VAT ID is missing on the invoice. |
<?php
// Príprava základných dát:
$data = [];
// Váš API kľúč (posiela sa v hlavičke Authorization, nie v dátach):
$api_key = "dJyMc*53@687*wGhofIWi!WDcEEQUdmj";
// Váš email (príp. používateľské meno):
$data['email'] = "name@example.com";
// Inicializácia sedenia (cookie.txt musí byť zapisovateľný). Všetky volania idú metódou POST,
// dáta sú v tele požiadavky ako JSON, kľúč v hlavičke Authorization:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.faktury-online.com/api/init');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Authorization: Bearer ' . $api_key]);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$result = json_decode(curl_exec($ch), true);
if ($result['status'] != 1) {
throw new Exception("Vyskytla sa chyba č. " . $result['status']);
}
// Kód faktúry (z odpovede API pri jej vytvorení):
$data['code'] = "14915945a66c8b7be74dac59c5badfbf";
// Faktúru s upozorneniami (pole warnings) odoslať aj tak? 0 = nie (predvolené), 1 = áno:
$data['ignore_warnings'] = "0";
// Zaradenie na odoslanie do siete Peppol (kontroly a validácia prebehnú hneď):
curl_setopt($ch, CURLOPT_URL, 'https://www.faktury-online.com/api/peppol-send');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$result = json_decode(curl_exec($ch), true);
if ($result['status'] != 1) {
// error_code = strojový kód chyby, message = popis
// Pri stave 1622 obsahuje $result['warnings'] zoznam upozornení (code, message)
throw new Exception("Odoslanie zamietnuté: " . $result['status'] . " " . $result['error_code'] . " (" . $result['message'] . ")");
}
// $result['peppol_status'] == 'queued'
// Stav odoslania (prvý dotaz asi po 2 minútach, potom najviac raz za 15 minút):
sleep(120);
curl_setopt($ch, CURLOPT_URL, 'https://www.faktury-online.com/api/peppol-status');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
// $result['peppol_status']: queued | sent | accepted | rejected | not_valid | failed
echo $result['peppol_status'], " ", $result['peppol_document_id'] ?? '', " ", $result['peppol_error'] ?? '';