{"id":150,"date":"2023-01-18T13:05:32","date_gmt":"2023-01-18T12:05:32","guid":{"rendered":"https:\/\/ksefapi.pl\/?p=150"},"modified":"2024-01-18T13:14:10","modified_gmt":"2024-01-18T12:14:10","slug":"wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef","status":"publish","type":"post","link":"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/","title":{"rendered":"Issuing a structured invoice using the Open API of the National e-Invoice System (KSeF)"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#Wystawienie_faktury_ustrukturyzowanej_z_wykorzystaniem_Open_API_Krajowego_Systemu_e-Faktur_KSeF\" >Issuing a structured invoice using the Open API of the National e-Invoice System (KSeF)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#1_Wyzwanie_autoryzacyjne\" >1. Authorization challenge<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#2_Sesja_podpisana\" >2. Session signed<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#3_Nadanie_uprawnien_do_wysylania_zadan_do_KSeF\" >3. Granting permission to send requests to KSeF<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#3a_Sprawdzenie_statusu_nadania_uprawnien\" >3a. Checking the status of granting permissions<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#4_Zadanie_uwierzytelniajace\" >4. Authentication request<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#5_Wygenerowanie_tokena_autoryzacyjnego\" >5. Generating an authorization token<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#5a_Sprawdzenie_statusu_generowania_tokenu\" >5a. Checking the token generation status<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#6_Nawiazanie_sesji_umozliwiajacej_wyslanie_e-Faktury\" >6. Establishing a session enabling sending e-Invoices<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#7_Wyslanie_e-Faktury_do_KSeF\" >7. Sending the e-Invoice to KSeF<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ksefapi.pl\/en\/wystawianie-efaktur-z-open-api-krajowego-systemu-efaktur-ksef\/#7a_Sprawdzenie_statusu_odebrania_przez_KSeF_wyslanej_przez_nas_faktury\" >7a. Checking the status of receipt of the invoice we sent by KSeF<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"Wystawienie_faktury_ustrukturyzowanej_z_wykorzystaniem_Open_API_Krajowego_Systemu_e-Faktur_KSeF\"><\/span>Issuing a structured invoice using the Open API of the National e-Invoice System (KSeF)<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">The process of issuing e-Invoices using API <\/span><span style=\"font-size: 12pt;\">KSeF<\/span><span style=\"font-size: 12pt;\"> is not trivial at all, which is why we have prepared the instructions below so that anyone who is not afraid can try their hand at this &quot;competition&quot;. Anyway, there&#039;s no point in extending the introduction - see for yourself:<\/span><\/p>\n<h1 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span class=\"ez-toc-section\" id=\"1_Wyzwanie_autoryzacyjne\"><\/span><span style=\"font-size: 13.5pt;\">1. <\/span><span style=\"font-size: 13.5pt;\">Authorization challenge<\/span><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">To start communication with the API <\/span><span style=\"font-size: 12pt;\">KSeF<\/span><span style=\"font-size: 12pt;\"> first we need to invoke <\/span><span style=\"font-size: 10pt;\">AutrhorisationChallenge<\/span><span style=\"font-size: 12pt;\"> , i.e. the so-called authorization challenge based on which we will be able to establish a session. So we invoke:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">POST \/online\/<\/span><span style=\"font-size: 10pt;\">Session<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">AuthorizationChallenge<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Where we give the time in the format <\/span><span style=\"font-size: 12pt;\">timestamp<\/span><span style=\"font-size: 12pt;\"> (e.g.: <\/span><span style=\"font-size: 10pt;\">&#8222;<\/span><span style=\"font-size: 10pt;\">timestamp<\/span><span style=\"font-size: 10pt;\">&quot;: &quot;2023-10-10T13:00:00Z&quot;<\/span><span style=\"font-size: 12pt;\">) and identifier type (<\/span><span style=\"font-size: 10pt;\">&#8222;<\/span><span style=\"font-size: 10pt;\">identifierType<\/span><span style=\"font-size: 10pt;\">&#8222;: &#8222;<\/span><span style=\"font-size: 10pt;\">onip<\/span><span style=\"font-size: 10pt;\">&#8222;<\/span><span style=\"font-size: 12pt;\">) and its value (<\/span><span style=\"font-size: 10pt;\">&#8222;<\/span><span style=\"font-size: 10pt;\">identifier<\/span><span style=\"font-size: 10pt;\">&quot;: &quot; &quot;<\/span><span style=\"font-size: 12pt;\">)<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">The timestamp and the value of the authorization challenge itself will be returned<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-1.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%201-605w204h.png\" alt=\"Faktury KSeF API - wyzwanie autoryzacyjne\" class=\"wp-image-293 size-full\" \/><\/a><\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_Sesja_podpisana\"><\/span>2. Session signed<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Then we invoke the establishment of a signed session:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">POST \/online\/<\/span><span style=\"font-size: 10pt;\">Session<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">InitSigned<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">InitSessionSignedRequest<\/span><span style=\"font-size: 12pt;\"> \u2013 contains an optional section <\/span><span style=\"font-size: 10pt;\">Encryption<\/span><span style=\"font-size: 12pt;\"> \u2013 each invoice sent as part of the created interactive session will be encrypted with the symmetric key indicated in the session <\/span><span style=\"font-size: 10pt;\">Encryption<\/span><span style=\"font-size: 12pt;\">.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">We add:<\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">1.<\/span><span style=\"font-size: 12pt;\">the context in which we work, i.e. attribute <\/span><span style=\"font-size: 10pt;\">&lt;<\/span><span style=\"font-size: 10pt;\">Context<\/span><span style=\"font-size: 10pt;\">&gt;<\/span><span style=\"font-size: 10pt;\">Identifier<\/span><span style=\"font-size: 10pt;\">&gt;<\/span><span style=\"font-size: 12pt;\"> \u2013 by entering the invoice issuer&#039;s Tax Identification Number<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">2.<\/span><span style=\"font-size: 12pt;\">authorization challenge, i.e. attribute <\/span><span style=\"font-size: 10pt;\">&lt;<\/span><span style=\"font-size: 10pt;\">Context<\/span><span style=\"font-size: 10pt;\">&gt;<\/span><span style=\"font-size: 12pt;\"> \u2013 we enter<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">3.<\/span><span style=\"font-size: 12pt;\">timestamp, i.e. attribute <\/span><span style=\"font-size: 10pt;\">&lt;<\/span><span style=\"font-size: 10pt;\">Context<\/span><span style=\"font-size: 10pt;\">&gt;<\/span><span style=\"font-size: 10pt;\">Timestamp<\/span><span style=\"font-size: 10pt;\">&gt;<\/span><span style=\"font-size: 12pt;\"> \u2013 we enter <\/span><span style=\"font-size: 12pt;\">timestamp<\/span><span style=\"font-size: 12pt;\"> returned from previous operation&gt; \u2013 <\/span><strong><span style=\"font-size: 12pt;\">Attention<\/span><\/strong><span style=\"font-size: 12pt;\">! the tag is valid for 5 minutes<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">4.<\/span><span style=\"font-size: 12pt;\">The authentication request prepared in this way should be signed using a qualified signature or an electronic seal that contains a number <\/span><strong><span style=\"font-size: 12pt;\">PESEL number<\/span><\/strong><span style=\"font-size: 12pt;\"> given in context<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">5.<\/span><span style=\"font-size: 12pt;\">Once the signature is completed, an element is added to the request <\/span><span style=\"font-size: 10pt;\">&lt;<\/span><span style=\"font-size: 10pt;\">ds:Signature<\/span><span style=\"font-size: 10pt;\">&gt;<\/span><span style=\"font-size: 12pt;\"> containing, among others, signature (value from the hash function) and an X.509 certificate which is used to verify the correctness of the signature <\/span><span style=\"font-size: 12pt;\">XAdES<\/span><span style=\"font-size: 12pt;\">.<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">6.<\/span><span style=\"font-size: 12pt;\">We send the authentication request prepared in this way using the method <\/span><span style=\"font-size: 10pt;\">POST \/online\/<\/span><span style=\"font-size: 10pt;\">Session<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">InitSigned<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">7.<\/span><strong><span style=\"font-size: 12pt;\">No authorization<\/span><\/strong><span style=\"font-size: 12pt;\">, because we cannot link the PESEL number to this specific company (company&#039;s Tax Identification Number) from the context.<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">8.<\/span><strong><span style=\"font-size: 12pt;\">The authentication request must be signed with a signature or electronic seal with the NIP number - so that it is possible to link (confirm) the provided NIP number in the context.<\/span><\/strong><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">9.<\/span><span style=\"font-size: 12pt;\">If we use the signature\/stamp with the NIP, then in response we will get:<\/span><\/div>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">1.<\/span><span style=\"font-size: 12pt;\">Session reference number <\/span><span style=\"font-size: 10pt;\">referenceNumber<\/span><span style=\"font-size: 12pt;\">&quot;- a very important attribute is used to check the session status and download UPO.<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 72pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">2.<\/span><span style=\"font-size: 12pt;\">Session token \u2013 attribute <\/span><span style=\"font-size: 10pt;\">sessionToken : { &quot;token&quot;, &quot;context&quot; \u2026. }<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-2.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%202-605w179h.png\" alt=\"Faktury KSeF API - nawi\u0105zanie sesji\" class=\"wp-image-294 size-full\" \/><\/a><\/span><\/strong><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"font-size: 12pt;\">Attention! Having <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> session \u2013 each subsequent query should be authorized with this <\/span><span style=\"font-size: 12pt;\">token<\/span><\/strong><\/p>\n<p>&nbsp;<\/p>\n<h3 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 13.5pt;\"><span class=\"ez-toc-section\" id=\"3_Nadanie_uprawnien_do_wysylania_zadan_do_KSeF\"><\/span>3. Granting permission to send requests to KSeF<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Granting authorizations (i.e. to whom and what we grant) for a specific PESEL number, i.e. to a person who within the company will be able to, for example, issue and read invoices:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-3.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%203.png\" alt=\"Faktury KSeF API - \u017c\u0105danie nadania uprawnie\u0144\" class=\"wp-image-295 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">POST \/online\/<\/span><span style=\"font-size: 10pt;\">Credentials<\/span><span style=\"font-size: 10pt;\">\/Grant<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-4.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%204-605w226h.png\" alt=\"Faktury KSeF API - wywo\u0142anie nawi\u0105zania sesji\" class=\"wp-image-296 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-5.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%205-605w98h.png\" alt=\"Faktury KSeF API - odpowied\u017a nawi\u0105zania sesji\" class=\"wp-image-297 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">The process of granting permissions is asynchronous and may take a while. But using the value of the returned attribute <\/span><span style=\"font-size: 10pt;\">elementReferenceNumber<\/span><span style=\"font-size: 12pt;\"> we can find out what the status is - in this case - of granting permissions.<\/span><\/p>\n<h4 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 12pt;\"><span class=\"ez-toc-section\" id=\"3a_Sprawdzenie_statusu_nadania_uprawnien\"><\/span>3a. Checking the status of granting permissions<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">GET \/online\/<\/span><span style=\"font-size: 10pt;\">Credentials<\/span><span style=\"font-size: 10pt;\">\/Status\/{<\/span><span style=\"font-size: 10pt;\">CredentialsElementReferenceNumber<\/span><span style=\"font-size: 10pt;\">}<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-6.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%206-605w68h.png\" alt=\"Faktury KSeF API - sprawdzenie statusu nadania uprawnie\u0144\" class=\"wp-image-298 size-full\" \/><\/a><\/span><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 10pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>\u00a0<\/span><span style=\"font-size: 12pt;\">Status <\/span><span style=\"font-size: 10pt;\">The trial has been registered<\/span><span style=\"font-size: 12pt;\"> (processingCode:100) means that the process of granting permissions has just started.<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 10pt;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>\u00a0<\/span><span style=\"font-size: 12pt;\">Status <\/span><span style=\"font-size: 10pt;\">The authorization process is complete<\/span><span style=\"font-size: 12pt;\"> (processingCode:200) means that permissions have been granted<\/span><\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<h3 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 13.5pt;\"><span class=\"ez-toc-section\" id=\"4_Zadanie_uwierzytelniajace\"><\/span>4. Authentication request<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Now, having been granted PESEL permissions, we can once again send a signed authentication request with a qualified signature (with PESEL):<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">POST \/online\/<\/span><span style=\"font-size: 10pt;\">Session<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">InitSigned<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">In response we should receive:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-7.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%207-605w123h.png\" alt=\"Faktury KSeF API - wys\u0142anie podpisanego \u017c\u0105dania uwierzytelniaj\u0105cego\" class=\"wp-image-299 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">He is important <\/span><strong><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> session<\/span><\/strong><span style=\"font-size: 12pt;\"> <\/span><strong><span style=\"font-size: 12pt;\">(<\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\">)<\/span><\/strong><span style=\"font-size: 12pt;\">, which allows you to perform operations such as issuing and receiving invoices. Of course, there is also a completely different session (different value for <\/span><span style=\"font-size: 10pt;\">referenceNumber<\/span><span style=\"font-size: 12pt;\">).<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 13.5pt;\"><span class=\"ez-toc-section\" id=\"5_Wygenerowanie_tokena_autoryzacyjnego\"><\/span>5. Generating an authorization token<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Below are examples of requests that should be sent to the method <\/span><span style=\"font-size: 10pt;\">GenerateToken<\/span><span style=\"font-size: 12pt;\">.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">POST \/online\/<\/span><span style=\"font-size: 10pt;\">Credentials<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">GenerateToken<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-8.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%208.png\" alt=\"Faktury KSeF API - przyk\u0142ad \u017c\u0105dania wygenerowania tokenu autoryzacyjnego\" class=\"wp-image-300 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Call and response:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-9.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%209-605w293h.png\" alt=\"Faktury KSeF API - wys\u0142anie \u017c\u0105dania wygenerowania tokenu autoryzacyjnego\" class=\"wp-image-301 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"font-size: 12pt;\">Attention<\/span><\/strong><span style=\"font-size: 12pt;\">! <\/span><span style=\"font-size: 12pt;\">Token<\/span><span style=\"font-size: 12pt;\"> authorization (<\/span><span style=\"font-size: 10pt;\">authorizationToken<\/span><span style=\"font-size: 12pt;\">) is returned and available for download <\/span><strong><span style=\"font-size: 12pt;\">only once<\/span><\/strong><span style=\"font-size: 12pt;\"> after calling the method <\/span><span style=\"font-size: 10pt;\">GenerateToken<\/span><span style=\"font-size: 12pt;\">, <\/span><span style=\"text-decoration: underline; font-size: 12pt;\">later it is no longer obtainable<\/span><span style=\"font-size: 12pt;\">.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">This <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> authorization code can now be entered in the application.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Due to <\/span><span style=\"font-size: 10pt;\">processingCode:100<\/span><span style=\"font-size: 12pt;\"> we need to check when the generation process will end <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\">\u2026. And only then (when it will be <\/span><span style=\"font-size: 10pt;\">processingCode:200<\/span><span style=\"font-size: 12pt;\">) <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> will be ready to use.<\/span><\/p>\n<h4 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 12pt;\"><span class=\"ez-toc-section\" id=\"5a_Sprawdzenie_statusu_generowania_tokenu\"><\/span>5a. Checking the token generation status<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">To check the generation status <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\">, we need to send the attribute value <\/span><span style=\"font-size: 10pt;\">elementReferenceNumber<\/span><span style=\"font-size: 12pt;\"> from the answer obtained in step 5 send to the method address:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">GET \/online\/Credentials\/Status\/{CredentialsElementReferenceNumber}<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 13.5pt;\"><span class=\"ez-toc-section\" id=\"6_Nawiazanie_sesji_umozliwiajacej_wyslanie_e-Faktury\"><\/span>6. Establishing a session enabling sending e-Invoices<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">if we have <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> authorization, now you need to establish a session with it in order to perform activities such as sending or receiving invoices.<\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">1.<\/span><span style=\"font-size: 12pt;\">We generate an authorization challenge in the same context: <\/span><span style=\"font-size: 10pt;\">POST \/online\/<\/span><span style=\"font-size: 10pt;\">Session<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">AuthorizationChallenge<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">2.<\/span><span style=\"font-size: 12pt;\">We are preparing the request <\/span><span style=\"font-size: 10pt;\">InitSessionTokenRequest<\/span><span style=\"font-size: 12pt;\">, where we fill in the attributes: <\/span><span style=\"font-size: 10pt;\">timestamp<\/span><span style=\"font-size: 12pt;\"> (from authorization challenge), <\/span><span style=\"font-size: 10pt;\">challenge<\/span><span style=\"font-size: 12pt;\"> (also from an authorization challenge), <\/span><span style=\"font-size: 10pt;\">identifier<\/span><span style=\"font-size: 12pt;\"> (consistent with the context) and <\/span><span style=\"font-size: 10pt;\">token<\/span><span style=\"font-size: 12pt;\"> \u2013 according to the documentation it is <\/span><span style=\"font-size: 10pt;\">Base64()<\/span><span style=\"font-size: 12pt;\">:<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%2010-605w47h.png\" alt=\"KSeF - kodowanie \u017c\u0105dania\" class=\"wp-image-302 size-full\" \/><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"font-size: 12pt;\">Attention<\/span><\/strong><span style=\"font-size: 12pt;\">! We no longer have to sign such a prepared request - this is the difference between establishing a session using a signature and a session using <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> authorization.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-11.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%2011-605w128h.png\" alt=\"KSeF API - odpowied\u017a zawieraj\u0105ca token sesyjny\" class=\"wp-image-303 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">In response we get <\/span><strong><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> session<\/span><\/strong><span style=\"font-size: 12pt;\">: in the attribute <\/span><span style=\"font-size: 10pt;\">sessionToken<\/span><span style=\"font-size: 10pt;\"> &gt; <\/span><span style=\"font-size: 10pt;\">token<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"font-size: 12pt;\">Attention<\/span><\/strong><span style=\"font-size: 12pt;\">! With this <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> We can only issue\/receive invoices!!!<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 13.5pt;\"><span class=\"ez-toc-section\" id=\"7_Wyslanie_e-Faktury_do_KSeF\"><\/span>7. Sending the e-Invoice to KSeF<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">PUT \/online\/<\/span><span style=\"font-size: 10pt;\">Invoice<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">Send<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Value in the invoice attribute <\/span><span style=\"font-size: 10pt;\">&lt;<\/span><span style=\"font-size: 10pt;\">Identification of<\/span><span style=\"font-size: 10pt;\">&gt;<\/span><span style=\"font-size: 12pt;\"> must be the same as the context value declared in the authorization challenge. An exception is e.g. <\/span><span style=\"font-size: 12pt;\">self-billing<\/span><span style=\"font-size: 12pt;\">, then a different NIP may appear in this field, but you must have permissions granted to <\/span><span style=\"font-size: 12pt;\">self-billing<\/span><span style=\"font-size: 12pt;\"> (and the recipient&#039;s data must be the same as the NIP declared in the authorization challenge).<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Request example:<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-12.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%2012-605w82h.png\" alt=\"Faktury KSeF API - przyk\u0142ad \u017c\u0105dania wystawienia e-Faktury\" class=\"wp-image-304 size-full\" \/><\/a><\/span><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">1.<\/span><span style=\"font-size: 12pt;\">We authorize the session using <\/span><span style=\"font-size: 12pt;\">token<\/span><span style=\"font-size: 12pt;\"> session<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">2.<\/span><span style=\"font-size: 12pt;\">If there is an active session, we invoke it <\/span><span style=\"font-size: 10pt;\">PUT \/online\/<\/span><span style=\"font-size: 10pt;\">Invoice<\/span><span style=\"font-size: 10pt;\">\/<\/span><span style=\"font-size: 10pt;\">Send<\/span><span style=\"font-size: 12pt;\"> and send the request containing: invoice abbreviation (<\/span><span style=\"font-size: 10pt;\">hashSHA<\/span><span style=\"font-size: 12pt;\">), size (<\/span><span style=\"font-size: 10pt;\">fileSize<\/span><span style=\"font-size: 12pt;\">) and the invoice itself (<\/span><span style=\"font-size: 10pt;\">invoiceBody<\/span><span style=\"font-size: 12pt;\">)<\/span><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-size: 12pt;\">3.<\/span><span style=\"font-size: 12pt;\">In response, we receive information that the process of collecting the sent invoice has started:<\/span><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-13.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%2013-605w289h.png\" alt=\"Faktury KSeF API - wys\u0142anie \u017c\u0105danie wystawienia efaktury ustrukturyzowanej i odbi\u00f3r odpowiedzi \" class=\"wp-image-305 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><strong><span style=\"font-size: 12pt;\">Attention<\/span><\/strong><span style=\"font-size: 12pt;\">! Attribute <\/span><span style=\"font-size: 10pt;\">referenceNumber<\/span><span style=\"font-size: 12pt;\">, i.e. the session reference number should be put aside because after it we will be able to check and download the UPO.<\/span><\/p>\n<h4 style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2; font-weight: bold; font-size: 12pt;\"><span class=\"ez-toc-section\" id=\"7a_Sprawdzenie_statusu_odebrania_przez_KSeF_wyslanej_przez_nas_faktury\"><\/span>7a. Checking the status of receipt of the invoice we sent by KSeF<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 10pt;\">GET \/online\/Credentials\/Status\/{CredentialsElementReferenceNumber}<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"color: #0000ff; font-size: 12pt;\"><a href=\"https:\/\/nip24.pl\/wp-content\/uploads\/2023\/12\/word-image-4519-14.png\"><img decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/01\/Picture%2014-605w102h.png\" alt=\"KSeF API - sprawdzenie statusu otrzymania wys\u0142anej efaktury przez Krajowy System e-Faktur\" class=\"wp-image-306 size-full\" \/><\/a><\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">If the invoice has been accepted (status 200), this attribute is important <\/span><span style=\"font-size: 10pt;\">ksefReferenceNumber<\/span><span style=\"font-size: 12pt;\">, which uniquely identifies the invoice. Attribute <\/span><span style=\"font-size: 10pt;\">acquisitionTimestamp<\/span><span style=\"font-size: 12pt;\"> will specify the date and time when exactly the invoice was accepted into the system <\/span><span style=\"font-size: 12pt;\">KSeF<\/span><span style=\"font-size: 12pt;\">.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">Yes, that&#039;s it and we can be happy to issue the first e-invoice in... <\/span><span style=\"font-size: 12pt;\">KSeF<\/span><span style=\"font-size: 12pt;\">.<\/span><\/p>\n<p style=\"margin-top: 5pt; padding-top: 0; margin-bottom: 5pt; padding-bottom: 0; line-height: 1.2;\"><span style=\"font-size: 12pt;\">This entry was based on <\/span><a href=\"https:\/\/www.youtube.com\/watch?v=dnBGO6IPtzA\"><span style=\"text-decoration: underline; color: #0000ff; font-size: 12pt;\">Webinar<\/span><\/a><span style=\"font-size: 12pt;\"> conducted on November 25, 2022. by representatives of the Ministry of Finance.<\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>","protected":false},"excerpt":{"rendered":"<p>Issuing a structured invoice using the Open API of the National e-Invoice System (KSeF) The process of issuing an e-Invoice using the KSeF API is not trivial at all, which is why we have prepared the following instructions so that anyone who is not afraid can try their hand at this &quot;competition&quot;. Anyway, there is no point in prolonging the introduction - see for yourself: 1. Challenge [\u2026]<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,10,6],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/posts\/150"}],"collection":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":12,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":309,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/posts\/150\/revisions\/309"}],"wp:attachment":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}