{"id":784,"date":"2024-04-16T23:41:24","date_gmt":"2024-04-16T21:41:24","guid":{"rendered":"https:\/\/ksefapi.pl\/?page_id=784"},"modified":"2024-04-19T13:54:27","modified_gmt":"2024-04-19T11:54:27","slug":"ksef-rest-api-dokumentacja","status":"publish","type":"page","link":"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/","title":{"rendered":"REST API KSeF \u2013 full documentation"},"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-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Komponenty\" >Components<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Procesy_obslugi_faktur_KSeF\" >KSeF invoice handling processes<\/a><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\/ksef-rest-api-dokumentacja\/#Wygenerowanie_faktury_KSeF_ustrukturyzowanej_zgodnej_ze_schema_FA_v2\" >Generating a KSeF (structured) invoice compliant with the FA_v2 schema<\/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\/ksef-rest-api-dokumentacja\/#Wyslanie_faktur_w_sesji_interaktywnej_do_KSeF_i_pobranie_UPO\" >Sending invoices in an interactive session to KSeF and downloading UPO<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Wyszukanie_i_pobranie_faktur_z_KSeF_kosztowych_lub_sprzedazowych\" >Searching and downloading invoices from KSeF (cost or sales)<\/a><\/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\/ksef-rest-api-dokumentacja\/#Pobranie_pojedynczej_faktury_z_KSeF_kosztowej_lub_sprzedazowej\" >Downloading a single invoice from KSeF (cost or sales)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Operacje\" >Operations<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#GET\" >GET<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefPublicKey\" >ksefPublicKey<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefSessionStatus\" >ksefSessionStatus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefSessionClose\" >ksefSessionClose<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefSessionUpo\" >ksefSessionUpo<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceStatus\" >ksefInvoiceStatus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceGet\" >ksefInvoiceGet<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceQueryStatus\" >ksefInvoiceQueryStatus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceQueryResult\" >ksefInvoiceQueryResult<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#POST\" >POST<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefSessionOpen\" >ksefSessionOpen<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceGenerate\" >ksefInvoiceGenerate<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Uwaga_Szczegolowy_opis_klas_i_atrybutow_wejsciowych_dla_operacji_zostal_zamieszczony_na_dedykowanej_podstronie_REST_API_%E2%80%93_generowanie_faktur_KSeF\" >Note! A detailed description of classes and input attributes for operations is available on a dedicated subpage: REST API \u2013 generating KSeF invoices.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceValidate\" >ksefInvoiceValidate<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceSend\" >ksefInvoiceSend<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceQueryStart\" >ksefInvoiceQueryStart<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ksefInvoiceVisualize\" >ksefInvoiceVisualize<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Parametry\" >Parameters<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Path\" >Path<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SessionId\" >SessionId<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#InvoiceId\" >InvoiceId<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#InvoiceKsefNumber\" >InvoiceKsefNumber<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#QueryId\" >QueryId<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#QueryPartNumber\" >QueryPartNumber<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-32\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#RequestBody\" >RequestBody<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-33\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefInvoiceEncrypted\" >KsefInvoiceEncrypted<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-34\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefInvoicePlain\" >KsefInvoicePlain<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-35\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefInvoiceQueryStartRange\" >KsefInvoiceQueryStartRange<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-36\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefInvoiceQueryStartRequest\" >KsefInvoiceQueryStartRequest<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-37\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefInvoiceSendRequest\" >KsefInvoiceSendRequest<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-38\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefSessionOpenRequest\" >KsefSessionOpenRequest<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-39\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefInvoiceVisualizeRequest\" >KsefInvoiceVisualizeRequest<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-40\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Enumeracje\" >Enumerations<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-41\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#InvoiceStatus\" >InvoiceStatus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-42\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Algorithm\" >Algorithm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-43\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KsefInvoiceVersion\" >KsefInvoiceVersion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-44\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#OutputFormat\" >OutputFormat<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-45\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#OutputLanguage\" >OutputLanguage<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-46\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SessionStatus\" >SessionStatus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-47\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SubjectType\" >SubjectType<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-48\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Odpowiedzi_typu_content\" >Content Answers<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-49\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Content\" >Content<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-50\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ApplicationZipContent\" >ApplicationZipContent<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-51\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ApplicationOctetStreamContent\" >ApplicationOctetStreamContent<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-52\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#TextXmlContent\" >TextXmlContent<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-53\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#ApplicationPdfContent\" >ApplicationPdfContent<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-54\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#TextHtmlContent\" >TextHtmlContent<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-55\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Komunikaty_bledow\" >Error messages<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-56\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Error\" >Error<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-57\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Autoryzacja_i_szyfrowanie\" >Authorization and encryption<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-58\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#AES_IV_LENGTH_%E2%80%93_Niepoprawna_dlugosc_wektora_inicjujacego\" >AES_IV_LENGTH - Incorrect initialization vector length<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-59\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#AES_KEY_LENGTH_%E2%80%93_Niepoprawna_dlugosc_klucza_symetrycznego_sluzacego_do_szyfrowania_danych\" >AES_KEY_LENGTH \u2013 Incorrect length of the symmetric key used to encrypt data<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-60\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#AUTH_CHALLENGE_%E2%80%93_Blad_pobrania_wyzwania_autoryzujacego\" >AUTH_CHALLENGE \u2013 Error getting authorization challenge<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-61\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#B64_DECODE_%E2%80%93_Blednie_kodowana_wartosc_z_wykorzystaniem_base64\" >B64_DECODE \u2013 Incorrectly encoded value using base64<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-62\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#KSEF_PUBLIC_KEY_%E2%80%93_Blad_pobierania_klucza_publicznego_KSeF\" >KSEF_PUBLIC_KEY \u2013 KSeF public key download error<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-63\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Sesja\" >Session<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-64\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_ACCESS_%E2%80%93_Blad_dostepu_do_sesji\" >SESSION_ACCESS \u2013 Session access error<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-65\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_CLOSE_%E2%80%93_Blad_podczas_proby_zamkniecia_sesji_interaktywnej\" >SESSION_CLOSE - Error while trying to close interactive session<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-66\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_INIT_%E2%80%93_Blad_inicjacji_sesji_interaktywnej_z_systemem_KSeF\" >SESSION_INIT \u2013 Error initiating an interactive session with the KSeF system<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-67\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_NO_UPO_%E2%80%93_Obiekt_UPO_nie_zostal_jeszcze_wygenerowany\" >SESSION_NO_UPO \u2013 UPO object has not been generated yet<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-68\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_OPEN_%E2%80%93_Blad_tworzenia_nowej_sesji_interaktywnej_z_KSeF\" >SESSION_OPEN \u2013 Error creating new interactive session with KSeF<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-69\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_REF_NUM_%E2%80%93_Niepoprawny_identyfikator_sesji_interaktywnej_KSeF\" >SESSION_REF_NUM \u2013 Invalid KSeF interactive session identifier<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-70\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_SAVE_%E2%80%93_Blad_aktualizacji_sesji\" >SESSION_SAVE - Session update error<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-71\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_STATUS_%E2%80%93_Blad_pobierania_statusu_sesji_interaktywnej_w_KSeF\" >SESSION_STATUS \u2013 Error getting interactive session status in KSeF<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-72\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_TOKEN_%E2%80%93_Blad_przygotowania_wyzwania_autoryzacyjnego\" >SESSION_TOKEN - Error preparing authorization challenge<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-73\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_UNKNOWN_%E2%80%93_Bledny_identyfikator_sesji\" >SESSION_UNKNOWN \u2013 Invalid session id<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-74\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#SESSION_UPO_%E2%80%93_Blad_pobrania_UPO\" >SESSION_UPO \u2013 Error downloading UPO<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-75\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Faktura\" >Invoice<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-76\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_FORMAT_%E2%80%93_Bledny_format_przeslanej_faktury\" >INVOICE_FORMAT \u2013 Incorrect format of the sent invoice<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-77\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_INPUT_%E2%80%93_Brak_wymaganych_metadanych_opisujacych_fakture\" >INVOICE_INPUT \u2013 Missing required metadata describing the invoice<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-78\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_SAVE_%E2%80%93_Wystapil_blad_podczas_aktualizacji_danych_faktury\" >INVOICE_SAVE \u2013 An error occurred while updating the invoice data<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-79\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_SEND_%E2%80%93_Wystapil_blad_podczas_przesylania_faktury_do_KSeF\" >INVOICE_SEND \u2013 An error occurred while sending the invoice to KSeF<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-80\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_SIZE_%E2%80%93_Za_duzy_rozmiar_faktury\" >INVOICE_SIZE \u2013 Invoice size too large<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-81\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_STATUS_%E2%80%93_Wystapil_blad_podczas_pobierania_statusu_faktury\" >INVOICE_STATUS \u2013 An error occurred while retrieving the invoice status<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-82\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_UNKNOWN_%E2%80%93_Bledny_identyfikator_faktury\" >INVOICE_UNKNOWN \u2013 Invalid invoice identifier<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-83\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_VERSION_%E2%80%93_Bledna_wersja_schemy_faktury\" >INVOICE_VERSION \u2013 Incorrect invoice schema version<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-84\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#INVOICE_VISUALIZE_%E2%80%93_Wystapil_blad_podczas_generowania_wizualizacji_faktury\" >INVOICE_VISUALIZE \u2013 An error occurred while generating the invoice visualization<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-85\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#Wyszukiwanie\" >Search<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-86\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#QUERY_INVOICE_INIT_%E2%80%93_Wystapil_blad_podczas_inicjacji_procesu_wyszukiwania_faktur\" >QUERY_INVOICE_INIT \u2013 An error occurred while initiating the invoice search process<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-87\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#QUERY_INVOICE_PARAMS_%E2%80%93_Bledne_kryteria_wyszukiwania\" >QUERY_INVOICE_PARAMS - Incorrect search criteria<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-88\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#QUERY_INVOICE_RESULT_%E2%80%93_Wystapil_blad_podczas_pobierania_wynikow_wyszukiwania_faktur\" >QUERY_INVOICE_RESULT \u2013 An error occurred while retrieving invoice search results<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-89\" href=\"https:\/\/ksefapi.pl\/en\/ksef-rest-api-dokumentacja\/#QUERY_INVOICE_STATUS_%E2%80%93_Wystapil_blad_podczas_sprawdzania_statusu_wyszukiwania_faktur\" >QUERY_INVOICE_STATUS \u2013 An error occurred while checking the invoice search status<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Komponenty\"><\/span><a id=\"post-449-KOMPONENTY\"><\/a><a id=\"post-449-BKM_06D1A7CB_6C3E_486A_8FD9_DF6F34E57EA0\"><\/a>Components<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>For the purposes of this documentation, 3 basic components were adopted that participate in business processes related to invoice handling within KSeF:<\/p>\r\n<ul>\r\n<li><a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a><\/li>\r\n<li><a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a><\/li>\r\n<li><a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a><\/li>\r\n<\/ul>\r\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/1.png\" alt=\"KSeF REST API - komponenty\" width=\"702\" height=\"152\" class=\"wp-image-628 size-full aligncenter\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/1.png 702w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/1-300x65.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/1-18x4.png 18w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/p>\r\n<p style=\"text-align: center;\">Drawing: Components<\/p>\r\n<h6><a id=\"post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\"><\/a>Calling system<\/h6>\r\n<p>The client&#039;s IT system that communicates with the KSeF System via the KSEF REST API interface.<\/p>\r\n<h6><a id=\"post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\"><\/a>National e-Invoice System (KSeF)<\/h6>\r\n<p><a href=\"https:\/\/ksef.mf.gov.pl\/\">National e-Invoice System<\/a> is the central repository of structured electronic invoices, managed and maintained by the Ministry of Finance.<\/p>\r\n<h6><a id=\"post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\"><\/a>REST API KSeF<\/h6>\r\n<p>REST interface providing <a href=\"#post-449-BKM_5F662507_70BF_4E7A_A7F0_5FFC1D1B6F95\">operations (methods)<\/a> enabling comprehensive implementation <a href=\"#post-449-BKM_C9933E96_1B60_4648_AF07_E8A62082F94B\">business processes<\/a> related to the handling of KSeF structured invoices<\/p>\r\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Procesy_obslugi_faktur_KSeF\"><\/span><a id=\"post-449-PROCESY_OBS\u00a3UGI_FAKTUR_KSEF\"><\/a><a id=\"post-449-BKM_C9933E96_1B60_4648_AF07_E8A62082F94B\"><\/a>KSeF invoice handling processes<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>The chapter describes in detail the four main processes related to handling KSeF invoices: \u2022 Generating a KSeF invoice (structured) in accordance with the FA_v2 schema \u2022 Sending invoices in an interactive session to KSeF and downloading UPO \u2022 Searching for and downloading invoices from KSeF (cost or sales) \u2022 Downloading a single invoice from KSeF (cost or sales) The individual steps of each process contain links to the operations that must be called in order to complete a given step. \u00a0<\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Wygenerowanie_faktury_KSeF_ustrukturyzowanej_zgodnej_ze_schema_FA_v2\"><\/span><a id=\"post-449-WYGENEROWANIE_FAKTURY_KSEF__USTRUKTURYZO\"><\/a><a id=\"post-449-BKM_E80C0C75_C70F_410B_BC83_09676651EA94\"><\/a>Generating a KSeF (structured) invoice compliant with the FA_v2 schema<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The purpose of the described process is to enable the generation of a KSeF invoice, the format and structure of which will be consistent with the latest, currently applicable scheme. The process describes a positive scenario and the steps to be taken to generate a structured KSeF invoice using the interface <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KseF<\/a>. Each call to an operation provided in the interface <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a> may generate an error. Possible errors that may occur due to the handling of the request by <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a>, are described in detail in the chapter <a href=\"#post-449-BKM_FB59E57F_F3F5_41DF_90B9_4A86EB621297\">Error messages<\/a>.<\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wygenerowanie-faktury-KSeF.jpg\" alt=\"KSeF REST API - proces generowania faktury KSeF\" width=\"1067\" height=\"530\" class=\"aligncenter size-full wp-image-703\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wygenerowanie-faktury-KSeF.jpg 1067w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wygenerowanie-faktury-KSeF-300x149.jpg 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wygenerowanie-faktury-KSeF-1024x509.jpg 1024w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wygenerowanie-faktury-KSeF-768x381.jpg 768w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wygenerowanie-faktury-KSeF-18x9.jpg 18w\" sizes=\"(max-width: 1067px) 100vw, 1067px\" \/>Figure: Generating a KSeF invoice<\/p>\r\n<p>Description of the process flow:<\/p>\r\n<p>1. <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a> prepares the request accordingly <a href=\"#post-449-BKM_D0838924_3476_452F_AC1F_E736D36F1362\">KsefInvoiceGenerateRequest<\/a> and calls the method <a href=\"#post-449-BKM_50F79695_ADB8_4A0D_8322_D287CC1E262B\">ksefInvoiceGenerate<\/a>.<\/p>\r\n<p>2. Then <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a> based on the data contained in the request, it generates an XML invoice file compliant with the current (up-to-date) version of the schema.<\/p>\r\n<p>3. The generated invoice XML file is returned to <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">calling system<\/a>, which saves the invoice XML file on its side.<\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Wyslanie_faktur_w_sesji_interaktywnej_do_KSeF_i_pobranie_UPO\"><\/span><a id=\"post-449-WYS\u00a3ANIE_FAKTUR_W_SESJI_INTERAKTYWNEJ_DO\"><\/a><a id=\"post-449-BKM_6D6ED1D4_1729_4DE3_BFC0_4BC80014765B\"><\/a>Sending invoices in an interactive session to KSeF and downloading UPO<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The purpose of the described process is to send the KSeF invoice (or invoices) to <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">National e-Invoice System<\/a> as part of the created interactive session and downloading the Official Confirmation of Receipt from KSeF confirming the receipt of the sent invoices by <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF system<\/a>. The process describes a positive scenario and the steps to be taken to send a structured invoice to KSeF using the interface <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a>. Each call to an operation provided in the interface <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a> may generate an error. Possible errors that may occur due to the handling of the request by <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a>, but also <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> were described in detail in the chapter <a href=\"#post-449-BKM_FB59E57F_F3F5_41DF_90B9_4A86EB621297\">Error messages<\/a>.<\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyslanie-faktur-w-sesji-interaktywnej-do-KSeF-i-pobranie-UPO-1.jpg\" alt=\"KSeF REST API - proces wysy\u0142ki faktur do KSeF\" width=\"1103\" height=\"1803\" class=\"aligncenter size-full wp-image-710\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyslanie-faktur-w-sesji-interaktywnej-do-KSeF-i-pobranie-UPO-1.jpg 1103w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyslanie-faktur-w-sesji-interaktywnej-do-KSeF-i-pobranie-UPO-1-184x300.jpg 184w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyslanie-faktur-w-sesji-interaktywnej-do-KSeF-i-pobranie-UPO-1-626x1024.jpg 626w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyslanie-faktur-w-sesji-interaktywnej-do-KSeF-i-pobranie-UPO-1-768x1255.jpg 768w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyslanie-faktur-w-sesji-interaktywnej-do-KSeF-i-pobranie-UPO-1-940x1536.jpg 940w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyslanie-faktur-w-sesji-interaktywnej-do-KSeF-i-pobranie-UPO-1-7x12.jpg 7w\" sizes=\"(max-width: 1103px) 100vw, 1103px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Sending invoices in an interactive session to KSeF and downloading UPO<\/p>\r\n<p>Description of the process flow:<\/p>\r\n<p>1. For each generated pose <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a> invoices we recommend calling the operation <a href=\"#post-449-BKM_9BFAFDBE_A342_404F_9DC0_5CBED265ABC4\">ksefInvoiceValidate<\/a> to check the correctness of the invoice with the schema. <br \/><strong>Attention<\/strong>! One of the reasons for rejection of an invoice by KSeF may be non-compliance with the applicable XSD schema.<\/p>\r\n<p>2. After verifying the correctness of the generated invoices, the operation should be triggered <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a> in order to create an interactive session within which the sending will be performed. Details describing the methods and types of sessions created, as well as the possibilities associated with them, are described in the chapter describing the given method.<\/p>\r\n<p>3. After successfully establishing an interactive session, <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> returns session id (<a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>), which should be written on the side <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a>, because this identifier will be used to call other operations.<\/p>\r\n<p>4. Next, before we start sending invoices, we need to check whether the session we created earlier is still active. This step is especially important if a few minutes have passed since the session was created or the quality of the network connection is poor. In order to verify the activity of the session, we need to call the operation <a href=\"#post-449-BKM_98527052_04F0_4C0E_9059_2806F75B65A1\">ksefSessionStatus<\/a>, and as a call parameter, specify the interactive session identifier (<a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>).<\/p>\r\n<p>5. If in response to the method call <a href=\"#post-449-BKM_98527052_04F0_4C0E_9059_2806F75B65A1\">ksefSessionStatus<\/a>, we have received information about the active session status, we can proceed to iterative sending of all invoices by calling the operation as many times as necessary <a href=\"#post-449-BKM_A746644D_69CD_44A9_98E8_6C12405264CE\">ksefInvoiceSend<\/a>, how many invoices do we intend to send to <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF<\/a>. In response <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> should return in attribute <a href=\"#post-449-BKM_C03DEBBC_C4C2_493E_BB68_84FA80CDBE1C\">id<\/a>, technical invoice identifier (<a href=\"#post-449-BKM_F42656AB_ADAE_4E26_B039_484273B3C51A\">InvoiceId<\/a>).<\/p>\r\n<p>6. Returned technical invoice identifier (<a href=\"#post-449-BKM_F42656AB_ADAE_4E26_B039_484273B3C51A\">InvoiceId<\/a>) should be written on the side <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a>, because this identifier will be used to trigger the operation checking the invoice receipt status (<a href=\"#post-449-BKM_4E604362_F662_48C7_B38C_8BE64F4F0738\">ksefInvoiceStatus<\/a>) sent to <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a>.<\/p>\r\n<p>7. After sending all invoices to KSeF [5] and saving their technical identifiers [6], you should check the receipt status of each of the sent invoices. To do this, you should call the operation for each sent invoice <a href=\"#post-449-BKM_4E604362_F662_48C7_B38C_8BE64F4F0738\">ksefInvoiceStatus<\/a> with parameter <a href=\"#post-449-BKM_F42656AB_ADAE_4E26_B039_484273B3C51A\">InvoiceId<\/a>, containing the technical identifier of the invoice.<\/p>\r\n<p>8. If in response (<a href=\"#post-449-BKM_5A623BA4_65E7_40EB_8218_16C9A3739076\">KsefInvoiceStatusResponse<\/a>) status of a given invoice (<a href=\"#post-449-BKM_3107DB78_BF59_438B_8455_BC16B7B2E84B\">InvoiceStatus<\/a>) has value <strong>accepted<\/strong>, it means that the invoice has been correctly saved in the KSeF system and we can save the invoice number generated by KSeF (<a href=\"#post-449-BKM_910A77E5_5D3A_484E_A625_6FE27F087AB7\">ksefReferenceNumber<\/a>) and acquisition date (<a href=\"#post-449-BKM_0F039184_2427_4648_9D61_26C6B2B346CC\">acquisitionTimestamp<\/a>), i.e. the exact date and time of recording in <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a>.<\/p>\r\n<p>9. After downloading all KSeF numbers of issued invoices (<a href=\"#post-449-BKM_910A77E5_5D3A_484E_A625_6FE27F087AB7\">ksefReferenceNumber<\/a>) you need to correctly end the interactive session by calling the operation <a href=\"#post-449-BKM_E969B48C_1604_4449_9C3F_C30D467B7614\">ksefSessionClose<\/a> with parameter <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a> (session ID returned when creating it in step 3).<\/p>\r\n<p>10. Only after closing the interactive session is it possible to invoke the operation <a href=\"#post-449-BKM_1D26730A_5896_4AD6_8096_B488C2140502\">ksefSessionUpo<\/a>, with parameter <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a> (session identifier returned during its creation in step 3) returning the Official Receipt Confirmation (UPO). UPO is returned as an object <a href=\"#post-449-BKM_A98BD425_F9DF_41D1_9D4A_6520F08ED831\">TextXmlContent<\/a>.<\/p>\r\n<p>11. The last step of the process is to save the downloaded UPO (<a href=\"#post-449-BKM_A98BD425_F9DF_41D1_9D4A_6520F08ED831\">TextXmlContent<\/a>) on the side <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system.<\/a><\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Wyszukanie_i_pobranie_faktur_z_KSeF_kosztowych_lub_sprzedazowych\"><\/span><a id=\"post-449-WYSZUKANIE_I_POBRANIE_FAKTUR_Z_KSEF__KOS\"><\/a><a id=\"post-449-BKM_6533E600_B7A5_4C34_9CB4_9F9540613BF8\"><\/a>Searching and downloading invoices from KSeF (cost or sales)<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The purpose of the described process is to asynchronously search and download found invoices (cost or sales) in <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">National e-Invoice System<\/a>. Individual operations are performed within the created interactive session. The process describes a positive scenario and the steps to be performed to search and download found invoices that meet the defined search criteria. Within a single call, you can search either your cost invoices or your sales invoices. Each call of the operation made available in the interface <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a> may generate an error. Possible errors that may occur due to the handling of the request by <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a>, but also <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> were described in detail in the chapter <a href=\"#post-449-BKM_FB59E57F_F3F5_41DF_90B9_4A86EB621297\">Error messages<\/a>.<\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyszukanie-i-pobranie-faktur-z-KSeF-kosztowych-lub-sprzedazowych.jpg\" alt=\"KSeF REST API - proces wyszukania i pobrania faktur z KSeF\" width=\"1196\" height=\"1827\" class=\"aligncenter size-full wp-image-701\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyszukanie-i-pobranie-faktur-z-KSeF-kosztowych-lub-sprzedazowych.jpg 1196w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyszukanie-i-pobranie-faktur-z-KSeF-kosztowych-lub-sprzedazowych-196x300.jpg 196w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyszukanie-i-pobranie-faktur-z-KSeF-kosztowych-lub-sprzedazowych-670x1024.jpg 670w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyszukanie-i-pobranie-faktur-z-KSeF-kosztowych-lub-sprzedazowych-768x1173.jpg 768w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyszukanie-i-pobranie-faktur-z-KSeF-kosztowych-lub-sprzedazowych-1006x1536.jpg 1006w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Wyszukanie-i-pobranie-faktur-z-KSeF-kosztowych-lub-sprzedazowych-8x12.jpg 8w\" sizes=\"(max-width: 1196px) 100vw, 1196px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Searching and downloading invoices from KSeF (cost or sales)<\/p>\r\n<p>Description of the process flow:<\/p>\r\n<p>1. First of all, you need to call the operation <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a> in order to create an interactive session within which the remaining operations will be performed. Details describing the methods and types of session creation, as well as the possibilities associated with them, are described in the chapter describing the given method.<\/p>\r\n<p>2. After the interactive session has been successfully set up, <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> returns session id (<a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>), which should be written on the side <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a>, because this identifier will be used to trigger subsequent operations.<\/p>\r\n<p>3. Then you need to prepare your search criteria accordingly (<a href=\"#post-449-BKM_380F543B_A59E_417C_B15F_FBC666DFC45B\">KsefInvoiceQueryStartRequest<\/a>) and initiate an asynchronous fact retrieval process by calling the operation <a href=\"#post-449-BKM_085D7653_C47C_4DF3_A9A7_AA3865243668\">ksefInvoiceQueryStart<\/a>.<\/p>\r\n<p>4. After successfully sending the query, <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> returns search id (<a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">QueryId<\/a>), which should be written on the side <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a>, because this identifier will be used to trigger the operation of checking the search status (whether invoices were found) and to download found invoice batches.<\/p>\r\n<p>5. To check if any invoices meet the defined search criteria and have been found, you need to call the operation <a href=\"#post-449-BKM_A750875A_D53F_4B2E_9B81_17E7D02A9821\">ksefInvoiceQueryStatus<\/a>. In the returned response <a href=\"#post-449-BKM_BEC9F82F_09FF_4D8B_8793_B3A3605DA235\">KsefInvoiceQueryStatusResponse<\/a>, attribute content <a href=\"#post-449-BKM_B78B9B4A_99E1_4988_A234_6F2125F92269\">items[]<\/a> informs about the number of packages with invoices found. Each package is identified by a package identifier (<a href=\"#post-449-BKM_BC3C4915_1195_411B_B2F3_2E6B406EAB11\">QueryPartNumber<\/a>).<\/p>\r\n<p>6. To download invoices that meet the defined search criteria, for each returned batch of invoices (<a href=\"#post-449-BKM_BC3C4915_1195_411B_B2F3_2E6B406EAB11\">QueryPartNumber<\/a>) call the operation <a href=\"#post-449-BKM_35BA07AC_4346_4A83_A701_50206EF74F4D\">ksefInvoiceQueryResult<\/a>.<\/p>\r\n<p>7. After downloading all found invoices (all packages), close the session by calling the operation <a href=\"#post-449-BKM_E969B48C_1604_4449_9C3F_C30D467B7614\">ksefSessionClose<\/a>.<\/p>\r\n<p>8. Optional step. If the session was configured to encrypt transmitted data during creation, all downloaded packages must be decrypted.<\/p>\r\n<p>9. Then, unpack each downloaded package (ZIP archive) and save it on the site <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a>.<\/p>\r\n<p>10. In order to generate a visualization for the downloaded XML invoice file from KSeF, the operation should be called for each invoice <a href=\"#post-449-BKM_EEDE0DC9_EFBD_49F6_B250_A748C985221D\">ksefInvoiceVisualize<\/a>.<\/p>\r\n<p>11. The last step of the process is to save the downloaded file (PDF or HTML) containing the KSeF invoice visualization.<\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Pobranie_pojedynczej_faktury_z_KSeF_kosztowej_lub_sprzedazowej\"><\/span><a id=\"post-449-POBRANIE_POJEDYNCZEJ_FAKTURY_Z_KSEF__KOS\"><\/a><a id=\"post-449-BKM_5C12AFD1_8613_4E2E_9C1D_1C0C82FEE014\"><\/a>Downloading a single invoice from KSeF (cost or sales)<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The purpose of the described process is to download a specific invoice (cost or sales) in <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">National e-Invoice System<\/a>. Individual operations are performed within the created interactive session. The process describes a positive scenario and the steps to be taken to download a single invoice for which the <a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">KSeF invoice number<\/a>. Each call to an operation provided in the interface <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a> may generate an error. Possible errors that may occur due to the handling of the request by <a href=\"#post-449-BKM_8B8E7387_2644_4057_9B27_0DDAFD03F5A8\">REST API KSeF<\/a>, but also <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> were described in detail in the chapter <a href=\"#post-449-BKM_FB59E57F_F3F5_41DF_90B9_4A86EB621297\">Error messages<\/a>.<\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Pobranie-pojedynczej-faktury-z-KSeF-kosztowej-lub-sprzedazowej.jpg\" alt=\"KSeF REST API - pobranie pojedynczej faktury z KSeF\" width=\"1130\" height=\"1136\" class=\"aligncenter size-full wp-image-702\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Pobranie-pojedynczej-faktury-z-KSeF-kosztowej-lub-sprzedazowej.jpg 1130w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Pobranie-pojedynczej-faktury-z-KSeF-kosztowej-lub-sprzedazowej-298x300.jpg 298w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Pobranie-pojedynczej-faktury-z-KSeF-kosztowej-lub-sprzedazowej-1019x1024.jpg 1019w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Pobranie-pojedynczej-faktury-z-KSeF-kosztowej-lub-sprzedazowej-150x150.jpg 150w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Pobranie-pojedynczej-faktury-z-KSeF-kosztowej-lub-sprzedazowej-768x772.jpg 768w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/Pobranie-pojedynczej-faktury-z-KSeF-kosztowej-lub-sprzedazowej-12x12.jpg 12w\" sizes=\"(max-width: 1130px) 100vw, 1130px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Downloading a single invoice from KSeF (cost or sales)<\/p>\r\n<p>Description of the process flow:<\/p>\r\n<p>1. In the first step, you need to call the operation <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a> in order to create an interactive session within which the remaining operations will be performed. Details describing the methods and types of session creation, as well as the possibilities associated with them, are described in the chapter describing the given method.<\/p>\r\n<p>2. After the interactive session has been successfully set up, <a href=\"#post-449-BKM_A30627E5_CC2C_43B7_B656_95C94A111764\">KSeF System<\/a> returns session id (<a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>), which should be written on the side <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a>, because this identifier will be used to trigger subsequent operations.<\/p>\r\n<p>3. Optional step. We check if the session we created earlier is still active. This step is especially important if a few minutes have passed since the session was created or the quality of the network connection is poor. In order to verify the activity of the session, the operation should be called <a href=\"#post-449-BKM_98527052_04F0_4C0E_9059_2806F75B65A1\">ksefSessionStatus<\/a>, and as a call parameter, specify the interactive session identifier (<a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>).<\/p>\r\n<p>4. If in response to the method call <a href=\"#post-449-BKM_98527052_04F0_4C0E_9059_2806F75B65A1\">ksefSessionStatus<\/a>, we have received information about the active session status, we can proceed to download the invoice by calling the operation <a href=\"#post-449-BKM_E16AE26F_B84A_480B_89C6_95DC926FFEB8\">ksefInvoiceGet<\/a>.<\/p>\r\n<p>5. The downloaded invoice in the form of an XML file should be saved on the page <a href=\"#post-449-BKM_270E933B_936D_4A01_BFA2_B7B4829EFCF3\">Calling system<\/a>.<\/p>\r\n<p>6. If we still have some KSeF invoice numbers for which we want to download invoices from KSeF, we should repeat the steps described in points 4-5. Otherwise, we should close the session by calling the operation <a href=\"#post-449-BKM_E969B48C_1604_4449_9C3F_C30D467B7614\">ksefSessionClose<\/a>.<\/p>\r\n<p>7. Optional step. Depending on your business needs, the last step of the process may be to generate a visualization of the invoice in PDF or HTML format. To do this, you need to call the operation <a href=\"#post-449-BKM_EEDE0DC9_EFBD_49F6_B250_A748C985221D\">ksefInvoiceVisualize<\/a> and select the appropriate visualization parameters if requested.<\/p>\r\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Operacje\"><\/span><a id=\"post-449-OPERACJE\"><\/a><a id=\"post-449-BKM_5F662507_70BF_4E7A_A7F0_5FFC1D1B6F95\"><\/a>Operations<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>The chapter contains a description of the methods provided by the KSeF REST API interface. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/2.png\" alt=\"KSeF REST API - interfejs\" width=\"685\" height=\"433\" class=\"wp-image-630 size-full aligncenter\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/2.png 685w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/2-300x190.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/2-18x12.png 18w\" sizes=\"(max-width: 685px) 100vw, 685px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: KSeF API REST Interface<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"GET\"><\/span>GET<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>HTTP GET type methods.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefPublicKey\"><\/span><a id=\"post-449-BKM_DA691A51_7832_4BB5_83F4_604D2B065754\"><\/a><a id=\"post-449-BKM_17968CD3_B61C_4A13_8029_9926483007D9\"><\/a>ksefPublicKey<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefPublicKey<\/strong>(): KsefPublicKeyResponse<\/code> The method allows you to download the KSeF public key, which is used to encrypt the AES256 symmetric key, used to encrypt sent XML invoices using the operation <a href=\"#post-449-BKM_A746644D_69CD_44A9_98E8_6C12405264CE\">ksefInvoiceSend<\/a> in session encryption mode \u2013 i.e. the set parameters: <a href=\"#post-449-BKM_E9ED5F18_4A0B_42AE_90AD_66BE89AD3DFD\">encryptedKey<\/a> and <a href=\"#post-449-BKM_3D24F7C3_E986_4141_9957_3DC252E9EEA5\">initVector<\/a> when creating a session (<a href=\"#post-449-BKM_663A19D5_1CA9_45A4_9D58_95D3B0DAFBCD\">KsefSessionOpenRequest<\/a>). The method does not require any parameter at the input, and returns a response in accordance with the output. <a href=\"#post-449-BKM_12332196_A513_4F5D_8750_6FFC1E360A5F\">KsefPublicKeyResponse<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/10.png\" alt=\"KSeF REST API - pobranie klucza publicznego KSeF\" width=\"455\" height=\"118\" class=\"aligncenter size-full wp-image-646\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/10.png 455w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/10-300x78.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/10-18x5.png 18w\" sizes=\"(max-width: 455px) 100vw, 455px\" \/><\/p>\r\n<p style=\"text-align: center;\">Image: ksefPublicKey<\/p>\r\n<h5><em>Algorithm<\/em><\/h5>\r\n<p>Supported Cryptographic Key Algorithms by KSeF <strong>RSA<\/strong> :- Supported cryptographic key algorithm<\/p>\r\n<h5><em><a id=\"post-449-BKM_12332196_A513_4F5D_8750_6FFC1E360A5F\"><\/a>KsefPublicKeyResponse<\/em><\/h5>\r\n<p>The class contains the public key of the KSeF system and information about the algorithm according to which it was created. <a id=\"post-449-BKM_CAABDC4E_165C_4DB2_882E_B0821FBD8437\"><\/a><strong>Algorithm<\/strong> : Algorithm \u2013 <a href=\"#post-449-BKM_AA76CC42_39D3_4287_B024_34CF08DF017F\">Algorithm<\/a> according to which the public key was generated <a id=\"post-449-BKM_8C6AAFD4_2558_434B_AE6A_3E62FD11DC49\"><\/a><strong>publicKey<\/strong> : string \u2013 Public key in the form of DER encoding of the ASN.1 SubjectPublicKeyInfo object in the form of a base64 string. The KSeF public key is used to encrypt a symmetric key (AES256), which key should be generated before creating a session with encryption, and then XML invoices sent to KSeF should be encrypted with this symmetric key.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefSessionStatus\"><\/span><a id=\"post-449-KSEFSESSIONSTATUS\"><\/a><a id=\"post-449-BKM_98527052_04F0_4C0E_9059_2806F75B65A1\"><\/a>ksefSessionStatus<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefSessionStatus<\/strong>(sessionId : SessionId): KsefSessionStatusResponse<\/code> The method allows you to retrieve the current session status. In the call path (URL) it takes a parameter <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>. In response, it returns <a href=\"#post-449-BKM_B469E2A6_26E8_44DA_910A_F89F7C73C44A\">KsefSessionStatusResponse<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/12.png\" alt=\"KSeF REST API - status sesji\" width=\"618\" height=\"280\" class=\"aligncenter size-full wp-image-648\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/12.png 618w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/12-300x136.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/12-18x8.png 18w\" sizes=\"(max-width: 618px) 100vw, 618px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefSessionStatus<\/p>\r\n<h5><em>SessionId<\/em><\/h5>\r\n<p>The class represents a session identifier generated by the KSEF system. <strong>sessionId<\/strong> : string \u2013 Unique session identifier<\/p>\r\n<h5><em>SessionStatus<\/em><\/h5>\r\n<p>Enumeration defines what statuses an interactive session can have <code><strong>active<\/strong> <\/code>: string \u2013 The attribute indicates an active session <code><strong>closed<\/strong> <\/code>: string \u2013 The attribute indicates a ended session.<\/p>\r\n<h5><em><a id=\"post-449-BKM_B469E2A6_26E8_44DA_910A_F89F7C73C44A\"><\/a>KsefSessionStatusResponse<\/em><\/h5>\r\n<p>A response containing the status of a given interactive session <code><a id=\"post-449-BKM_E56BEC04_4D2A_4071_BF9C_97C02B55C654\"><\/a><strong>status<\/strong> <\/code>: SessionStatus \u2013 One of two possible interactive session statuses defined in the enum <a href=\"#post-449-BKM_6D341082_98B9_42D2_B3BC_E8325D57AF97\">SessionStatus<\/a><\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefSessionClose\"><\/span><a id=\"post-449-KSEFSESSIONCLOSE\"><\/a><a id=\"post-449-BKM_E969B48C_1604_4449_9C3F_C30D467B7614\"><\/a>ksefSessionClose<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefSessionClose<\/strong>(sessionId : SessionId): KsefSessionCloseResponse<\/code> This method allows you to close a session established with KSeF. <strong>Attention<\/strong>! Correct closing of the interactive session is necessary to download UPO, i.e. the object confirming invoices received by KSeF. In the call path (URL) it takes the parameter <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>. In response, it returns <a href=\"#post-449-BKM_C2AC3C9D_2ADE_4B03_B1F1_82B742649FEE\">KsefSessionCloseResponse<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/13.png\" alt=\"KSeF REST API - zamkni\u0119cie sesji\" width=\"528\" height=\"106\" class=\"aligncenter size-full wp-image-649\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/13.png 528w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/13-300x60.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/13-18x4.png 18w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/p>\r\n<p style=\"text-align: center;\">Drawing: ksefSessionClose<\/p>\r\n<h5><em>SessionId<\/em><\/h5>\r\n<p>The class represents a session identifier generated by the KSEF system. <strong>sessionId<\/strong> : string \u2013 Unique session identifier<\/p>\r\n<h5><em><a id=\"post-449-BKM_C2AC3C9D_2ADE_4B03_B1F1_82B742649FEE\"><\/a>KsefSessionCloseResponse<\/em><\/h5>\r\n<p>A response containing information on whether the interactive session was successfully completed <code><a id=\"post-449-BKM_646D6E4B_DD0B_4686_AA82_259D97612460\"><\/a><strong>result<\/strong> <\/code>: boolean \u2013 A value of True (1) indicates that the session was terminated successfully, while a value of False (0) indicates that the session could not be terminated successfully.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefSessionUpo\"><\/span><a id=\"post-449-KSEFSESSIONUPO\"><\/a><a id=\"post-449-BKM_1D26730A_5896_4AD6_8096_B488C2140502\"><\/a>ksefSessionUpo<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefSessionUpo<\/strong>(sessionId : SessionId): TextXmlContent<\/code> The method enables downloading the Official Confirmation of Receipt (UPO) for all invoices that were sent within a given interactive session compared with KSeF. <strong>Attention<\/strong>! Before calling the ksefSessionUpo operation, you must first close the interactive session correctly using the operation <a href=\"#post-449-BKM_E969B48C_1604_4449_9C3F_C30D467B7614\">ksefSessionClose<\/a>. UPO can only be downloaded for a session in which at least one invoice was issued correctly. In the call path (URL) it takes the parameter <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>In response, the operation returns an object <a href=\"#post-449-BKM_4ABF7647_7686_47D5_B5B0_70C5513BF908\">TextXmlContent<\/a> containing UPO. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/14.png\" alt=\"KSeF REST API - pobranie upo\" width=\"593\" height=\"106\" class=\"aligncenter size-full wp-image-650\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/14.png 593w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/14-300x54.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/14-18x3.png 18w\" sizes=\"(max-width: 593px) 100vw, 593px\" \/><\/p>\r\n<p style=\"text-align: center;\">Drawing: ksefSessionUpo<\/p>\r\n<h5><em>SessionId<\/em><\/h5>\r\n<p>The class represents a session identifier generated by the KSEF system. <strong>sessionId<\/strong> : string \u2013 Unique session identifier<\/p>\r\n<h5><em>TextXmlContent<\/em><\/h5>\r\n<p>The class represents a KSeF Invoice or an Official Receipt Confirmation (UPO) in XML format <code><strong>description<\/strong> <\/code>: string \u2013 = Invoice or UPO<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceStatus\"><\/span><a id=\"post-449-KSEFINVOICESTATUS\"><\/a><a id=\"post-449-BKM_4E604362_F662_48C7_B38C_8BE64F4F0738\"><\/a>ksefInvoiceStatus<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceStatus<\/strong>(invoiceId : InvoiceId): KsefInvoiceStatusResponse<\/code> The method allows you to check the processing status of an invoice sent to KSeF. <strong>Attention<\/strong>!The method checks the processing status of an invoice sent to KSeF using the operation <a href=\"#post-449-BKM_A746644D_69CD_44A9_98E8_6C12405264CE\">ksefInvoiceSend<\/a>. The method requires a parameter to be sent in the call path (URL) on the input <a href=\"#post-449-BKM_F42656AB_ADAE_4E26_B039_484273B3C51A\">InvoiceId<\/a>, and the output returns a response consistent with <a href=\"#post-449-BKM_5A623BA4_65E7_40EB_8218_16C9A3739076\">KsefInvoiceStatusResponse<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/18.png\" alt=\"KSeF REST API - sprawdzenie statusu odebrania faktury przez KSeF\" width=\"652\" height=\"270\" class=\"aligncenter size-full wp-image-654\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/18.png 652w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/18-300x124.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/18-18x7.png 18w\" sizes=\"(max-width: 652px) 100vw, 652px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceStatus<\/p>\r\n<h5><em>InvoiceId<\/em><\/h5>\r\n<p>The class represents the technical identifier of the invoice, which is returned as an attribute <a href=\"#post-449-BKM_C03DEBBC_C4C2_493E_BB68_84FA80CDBE1C\">id<\/a> Classes <a href=\"#post-449-BKM_1C28A96A_30E8_4D8E_AEDB_02C85E1EF62D\">KsefInvoiceSendResponse<\/a>, and then it can be used to check the invoice processing status by calling the operation <a href=\"#post-449-BKM_4E604362_F662_48C7_B38C_8BE64F4F0738\">ksefInvoiceStatus<\/a>. <strong>invoiceId<\/strong> : string \u2013 Invoice ID (technical)<\/p>\r\n<h5><em>InvoiceStatus<\/em><\/h5>\r\n<p>Enumeration defining the possible statuses of the sent invoice returned by <a href=\"#post-449-BKM_5A623BA4_65E7_40EB_8218_16C9A3739076\">KsefInvoiceStatusResponse<\/a>. <code><strong>processing<\/strong> <\/code>: string \u2013 The status returned from KSeF means that the sent invoice is still being processed. You should wait a moment and check the invoice status again. <code><strong>accepted<\/strong> <\/code>: string \u2013 The status returned from KSeF means that the sent invoice has been received correctly and a unique KSeF number has been assigned to it (<a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">InvoiceKsefNumber<\/a>). <code><strong>Rejected<\/strong> <\/code>: string \u2013 The status returned from KSeF means that the sent invoice was rejected by KSeF. In the error message details (<a href=\"#post-449-BKM_ED51A11B_2565_461E_9F49_113848DDC4F1\">Error<\/a>), you should check what was the reason for rejection of the invoice.<\/p>\r\n<h5><em><a id=\"post-449-BKM_5A623BA4_65E7_40EB_8218_16C9A3739076\"><\/a>KsefInvoiceStatusResponse<\/em><\/h5>\r\n<p>The class represents the response of the KSeF system in the context of the processing status of an invoice sent to KSeF. <a id=\"post-449-BKM_0F039184_2427_4648_9D61_26C6B2B346CC\"><\/a><strong>acquisitionTimestamp<\/strong> : string \u2013 Optional attribute, informs about the exact date and time of receipt of the invoice by KSeF. The attribute contains a value only if the status of the sent invoice has the value <code><strong>accepted<\/strong><\/code>. (Required: [0..1]) <a id=\"post-449-BKM_22FFCEA5_33FD_45B4_BE81_4F1A2FB76075\"><\/a><strong>invoiceNumber<\/strong> : string \u2013 Optional attribute, returns information about the invoice number assigned by the entity issuing the invoice. The attribute contains a value only if the status of the sent invoice has a value <code><strong>accepted<\/strong><\/code>. (Required: [0..1]) <a id=\"post-449-BKM_910A77E5_5D3A_484E_A625_6FE27F087AB7\"><\/a><strong>ksefReferenceNumber<\/strong> : string \u2013 Optional attribute, returns information about the KSeF invoice number, which is assigned by KSeF and is unique within KSeF. The attribute refers to the same as the parameter <a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">InvoiceKsefNumber<\/a>. The attribute contains a value only if the status of the sent invoice has a value <strong>accepted<\/strong>. (Required: [0..1]) <code><a id=\"post-449-BKM_73317933_BA53_44B6_A34A_762798E19E9C\"><\/a><strong>status<\/strong> <\/code>: InvoiceStatus \u2013 Attribute returns the current status of the sent invoice. Value consistent with the items in the enumeration <a href=\"#post-449-BKM_3107DB78_BF59_438B_8455_BC16B7B2E84B\">InvoiceStatus<\/a>.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceGet\"><\/span><a id=\"post-449-KSEFINVOICEGET\"><\/a><a id=\"post-449-BKM_E16AE26F_B84A_480B_89C6_95DC926FFEB8\"><\/a>ksefInvoiceGet<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceGet<\/strong>(sessionId : SessionId, invoiceKsefNumber : InvoiceKsefNumber): KsefInvoiceGetContent<\/code> The method allows you to download a single invoice from KSeF by specifying <a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">KSeF invoice number<\/a>. <strong>Attention<\/strong>! Calling the method requires previously opening an interactive session using the operation <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a>. The method requires two parameters to be sent in the call path (URL): <a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">InvoiceKsefNumber<\/a> and <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>, and the output returns a response consistent with <a href=\"#post-449-BKM_4ABF7647_7686_47D5_B5B0_70C5513BF908\">TextXmlContent<\/a> if the downloaded invoice is not encrypted or <a href=\"#post-449-BKM_14FB405A_D772_455F_8B44_3252BB80A3DC\">ApplicationOctetStreamContent<\/a> when downloading an invoice in encrypted form. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/19.png\" alt=\"KSeF REST API - pobranie faktury z KseF\" width=\"747\" height=\"319\" class=\"aligncenter size-full wp-image-655\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/19.png 747w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/19-300x128.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/19-18x8.png 18w\" sizes=\"(max-width: 747px) 100vw, 747px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceGet<\/p>\r\n<h5><em>SessionId<\/em><\/h5>\r\n<p>The class represents a session identifier generated by the KSEF system. <strong>sessionId<\/strong> : string \u2013 Unique session identifier<\/p>\r\n<h5><em>InvoiceKsefNumber<\/em><\/h5>\r\n<p>KSeF invoice number generated by KSeF. <strong>invoiceKsefNumber<\/strong> : string \u2013 Invoice ID generated by KSeF. Generation of this ID confirms saving the sent invoice in KSeF.<\/p>\r\n<h5><em>Content<\/em><\/h5>\r\n<p>A parent class describing the content from which other classes inherit. <code><strong>description<\/strong> <\/code>: string \u2013 Description of the content for a given class <code><strong>format<\/strong> <\/code>: binary - Content format - always BINARY <code><strong>type<\/strong> <\/code>: string \u2013 Content type \u2013 always STRING<\/p>\r\n<h5><em>ApplicationOctetStreamContent<\/em><\/h5>\r\n<p>The class represents data in one of two possible forms: a) an encrypted single KSeF invoice (XML), b) an encrypted ZIP archive with multiple KSeF invoices (XML) <code><strong>description<\/strong> <\/code>: string \u2013 = Encrypted single XML invoice or encrypted ZIP archive with XML invoices<\/p>\r\n<h5><em>TextXmlContent<\/em><\/h5>\r\n<p>The class represents a KSeF Invoice or an Official Receipt Confirmation (UPO) in XML format <code><strong>description<\/strong> <\/code>: string \u2013 = Invoice or UPO<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceQueryStatus\"><\/span><a id=\"post-449-KSEFINVOICEQUERYSTATUS\"><\/a><a id=\"post-449-BKM_A750875A_D53F_4B2E_9B81_17E7D02A9821\"><\/a>ksefInvoiceQueryStatus<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceQueryStatus<\/strong>(sessionId : SessionId, queryId : QueryId): KsefInvoiceQueryStatusResponse<\/code> The method allows you to obtain the invoice search status in KSeF. <strong>Attention<\/strong>! Calling the method requires previously opening an interactive session using the operation <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a> and call operations <a href=\"#post-449-BKM_085D7653_C47C_4DF3_A9A7_AA3865243668\">ksefInvoiceQueryStart<\/a> in response the search identifier is returned (<a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">QueryId<\/a>) The input method requires sending two parameters in the call path (URL): <a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">QueryId<\/a> and <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>, and the output returns a response consistent with <a href=\"#post-449-BKM_BEC9F82F_09FF_4D8B_8793_B3A3605DA235\">KsefInvoiceQueryStatusResponse<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/21.png\" alt=\"KSeF REST API - sprawdzenie statusu wyszukiwania faktur\" width=\"633\" height=\"226\" class=\"aligncenter size-full wp-image-657\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/21.png 633w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/21-300x107.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/21-18x6.png 18w\" sizes=\"(max-width: 633px) 100vw, 633px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceQueryStatus<\/p>\r\n<h5><em>SessionId<\/em><\/h5>\r\n<p>The class represents a session identifier generated by the KSEF system. <strong>sessionId<\/strong> : string \u2013 Unique session identifier<\/p>\r\n<h5><em>QueryId<\/em><\/h5>\r\n<p>The class contains the search identifier that is generated by KSeF <strong>queryId<\/strong> : string \u2013 Search process identifier<\/p>\r\n<h5><em><a id=\"post-449-BKM_BEC9F82F_09FF_4D8B_8793_B3A3605DA235\"><\/a>KsefInvoiceQueryStatusResponse<\/em><\/h5>\r\n<p>The object represents the result of searching for invoices in KSeF <a id=\"post-449-BKM_B78B9B4A_99E1_4988_A234_6F2125F92269\"><\/a><code><strong>items[]<\/strong> <\/code>: string \u2013 The attribute contains an array of package identifiers (each package is a ZIP file) of found invoices (<a href=\"#post-449-BKM_BC3C4915_1195_411B_B2F3_2E6B406EAB11\">QueryPartNumber<\/a>) that matched the search criteria defined in the class <a href=\"#post-449-BKM_380F543B_A59E_417C_B15F_FBC666DFC45B\">KsefInvoiceQueryStartRequest<\/a>.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceQueryResult\"><\/span><a id=\"post-449-KSEFINVOICEQUERYRESULT\"><\/a><a id=\"post-449-BKM_35BA07AC_4346_4A83_A701_50206EF74F4D\"><\/a>ksefInvoiceQueryResult<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceQueryResult<\/strong>(sessionId : SessionId, queryId : QueryId, queryPartNumber : QueryPartNumber): KsefInvoiceQueryResultZipContent<\/code> This method allows you to download all invoices found in KSeF. <strong>Attention<\/strong>! Calling a method requires a prior call to the operation: <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a>which will return the session id (<a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>) and <a href=\"#post-449-BKM_085D7653_C47C_4DF3_A9A7_AA3865243668\">ksefInvoiceQueryStart<\/a>, which returns the search identifier (<a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">QueryId<\/a>). <strong>Attention<\/strong>! If session (<a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a>) was opened with encryption, then the downloaded invoice packages in ZIP format (identified with <a href=\"#post-449-BKM_BC3C4915_1195_411B_B2F3_2E6B406EAB11\">QueryPartNumber<\/a>), must be decrypted before unpacking. Each package must be decrypted using the symmetric AES256 key (<a href=\"#post-449-BKM_E9ED5F18_4A0B_42AE_90AD_66BE89AD3DFD\">encryptedKey<\/a>), which was generated when the session was created (<a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a>). The method requires three parameters to be sent in the call path (URL): <a href=\"#post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\">SessionId<\/a>, <a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">QueryId<\/a> and <a href=\"#post-449-BKM_BC3C4915_1195_411B_B2F3_2E6B406EAB11\">QueryPartNumber<\/a>, and the output returns a response consistent with <a href=\"#post-449-BKM_0F091857_5CA9_4A1C_9E5F_B65F98CDF963\">ApplicationZipContent<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/22.png\" alt=\"KSeF REST API - pobranie wynik\u00f3w wyszukiwania faktur KSeF\" width=\"662\" height=\"319\" class=\"aligncenter size-full wp-image-658\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/22.png 662w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/22-300x145.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/22-18x9.png 18w\" sizes=\"(max-width: 662px) 100vw, 662px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceQueryResult<\/p>\r\n<h5><em>SessionId<\/em><\/h5>\r\n<p>The class represents a session identifier generated by the KSEF system. <strong>sessionId<\/strong> : string \u2013 Unique session identifier<\/p>\r\n<h5><em>QueryId<\/em><\/h5>\r\n<p>The class contains a search identifier that is generated by KSeF. <strong>queryId<\/strong> : string \u2013 Search process identifier<\/p>\r\n<h5><em>QueryPartNumber<\/em><\/h5>\r\n<p>The class represents the search pack number. <strong>partNumber<\/strong> : string \u2013 Fragment (package) identifier of the search result<\/p>\r\n<h5><em>ApplicationZipContent<\/em><\/h5>\r\n<p>The class represents a ZIP archive with KSeF invoices in XML format <code><strong>description<\/strong> <\/code>: string \u2013 = ZIP archive with XML invoices<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"POST\"><\/span>POST<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>HTTP POST type methods.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefSessionOpen\"><\/span><a id=\"post-449-KSEFSESSIONOPEN\"><\/a><a id=\"post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\"><\/a>ksefSessionOpen<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefSessionOpen<\/strong>(invoice : KsefSessionOpenRequest): KsefSessionOpenResponse<\/code> The method enables the establishment of an interactive session with the KSeF system, thanks to which it will be possible to send invoices to KSeF using the operation <a href=\"#post-449-BKM_A746644D_69CD_44A9_98E8_6C12405264CE\">ksefInvoiceSend<\/a>. The input method requires the creation of a request that complies with <a href=\"#post-449-BKM_663A19D5_1CA9_45A4_9D58_95D3B0DAFBCD\">KsefSessionOpenRequest<\/a>, and the output returns a response consistent with <a href=\"#post-449-BKM_B38BB36D_B873_4B21_9B57_6700ACD76F46\">KsefSessionOpenResponse<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/11.png\" alt=\"KSeF REST API - otwarcie sesji\" width=\"601\" height=\"297\" class=\"aligncenter size-full wp-image-647\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/11.png 601w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/11-300x148.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/11-18x9.png 18w\" sizes=\"(max-width: 601px) 100vw, 601px\" \/><\/p>\r\n<p style=\"text-align: center;\">Drawing: ksefSessionOpen<\/p>\r\n<h5><em>KsefSessionOpenRequest<\/em><\/h5>\r\n<p>The class represents a request to create an interactive session <strong>encryptedKey<\/strong> : string \u2013 If encryption of transmitted data (invoices) is to be used within the interactive session, the attribute should contain a symmetric encryption key (AES256) generated before opening a new session and encrypted with the RSA public key of the KSeF platform obtained using the operation <a href=\"#post-449-BKM_DA691A51_7832_4BB5_83F4_604D2B065754\">ksefPublicKey<\/a>. (Required: [0..1]) <strong>initVector<\/strong> : string \u2013 The attribute describes the so-called initialization vector. The allowed AES symmetric key encryption algorithm is AES\/CBC\/PKCS5Padding (PKCS#7). The allowed symmetric key is AES with a length of 256 bits supported by a random initialization vector of length 16 bytes. (Required: [0..1]) <strong>invoiceVersion<\/strong> : KsefInvoiceVersion \u2013 Indication of the schema version in which KSeF invoices will be sent as part of the established session.<\/p>\r\n<h5><em>KsefInvoiceVersion<\/em><\/h5>\r\n<p>Schema version for KSeF invoices <strong>v1<\/strong> : \u2013 First version of the schema <strong>v2<\/strong> : \u2013 Second version of the schema (valid)<\/p>\r\n<h5><em><a id=\"post-449-BKM_B38BB36D_B873_4B21_9B57_6700ACD76F46\"><\/a>KsefSessionOpenResponse<\/em><\/h5>\r\n<p>Response in case of correctly created session <a id=\"post-449-BKM_70D38C86_7AC4_4917_B36E_8B39AF95A73E\"><\/a><strong>created<\/strong> : string \u2013 The attribute contains the date and time of session creation in date-time format. <a id=\"post-449-BKM_B4E2F9F2_43E3_4B05_8C85_5888E4A9BACC\"><\/a><strong>id<\/strong> : string \u2013 The attribute contains the identifier of the created session. It should be saved on the calling system side, because it will be used in most of the remaining operations.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceGenerate\"><\/span><a id=\"post-449-KSEFINVOICEGENERATE\"><\/a><a id=\"post-449-BKM_50F79695_ADB8_4A0D_8322_D287CC1E262B\"><\/a>ksefInvoiceGenerate<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceGenerate<\/strong>(ksefInvoiceGenerateRequest : KsefInvoiceGenerateRequest): KsefInvoiceGenerateResponse<\/code> A method that allows you to generate an XML structured invoice that is compliant with the current (up-to-date) version of the schema used in KSeF. \u00a0<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Uwaga_Szczegolowy_opis_klas_i_atrybutow_wejsciowych_dla_operacji_zostal_zamieszczony_na_dedykowanej_podstronie_REST_API_%E2%80%93_generowanie_faktur_KSeF\"><\/span><strong><\/strong><strong>Attention<\/strong>! A detailed description of the classes and input attributes for the operation is available on a dedicated subpage: <br \/><a href=\"\/en\/rest-api-generowanie-faktur-ksef\/\">REST API \u2013 generating KSeF invoices<\/a>.<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>\u00a0 \u00a0 <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/15.png\" alt=\"KSeF REST API - generowanie faktury\" width=\"556\" height=\"80\" class=\"aligncenter size-full wp-image-651\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/15.png 556w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/15-300x43.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/15-18x3.png 18w\" sizes=\"(max-width: 556px) 100vw, 556px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceGenerate<\/p>\r\n<h5><em><a id=\"post-449-BKM_D0838924_3476_452F_AC1F_E736D36F1362\"><\/a>KsefInvoiceGenerateRequest<\/em><\/h5>\r\n<p>The class represents input attributes describing the KSeF invoice<\/p>\r\n<h5><em><a id=\"post-449-BKM_BE083D7B_7D88_4483_8750_324FF0889975\"><\/a>KsefInvoiceGenerateResponse<\/em><\/h5>\r\n<p>The class represents the response returned by the operation <a href=\"#post-449-BKM_50F79695_ADB8_4A0D_8322_D287CC1E262B\">ksefInvoiceGenerate<\/a>, which contains a generated KSeF invoice compliant with the schema applicable in KSeF.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceValidate\"><\/span><a id=\"post-449-KSEFINVOICEVALIDATE\"><\/a><a id=\"post-449-BKM_9BFAFDBE_A342_404F_9DC0_5CBED265ABC4\"><\/a>ksefInvoiceValidate<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceValidate<\/strong>(ksefInvoice : KsefInvoice): KsefInvoiceValidateResponse<\/code> The method allows you to verify the KSeF invoice for compliance with the schema. The object should be sent as a parameter to call the operation <a href=\"#post-449-BKM_4ABF7647_7686_47D5_B5B0_70C5513BF908\">TextXmlContent<\/a> containing the generated KSeF invoice. An external tool or operation can be used to generate the invoice <a href=\"#post-449-BKM_50F79695_ADB8_4A0D_8322_D287CC1E262B\">ksefInvoiceGenerate<\/a>In response, the operation returns an object <a href=\"#post-449-BKM_9EE0569D_8FC8_4DBA_8884_7420EF52505D\">KsefInvoiceValidateResponse<\/a> with information about what schema version the invoice was generated in and whether it is compatible with this structure. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/16.png\" alt=\"KSeF REST API - walidacja faktury\" width=\"737\" height=\"245\" class=\"aligncenter size-full wp-image-652\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/16.png 737w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/16-300x100.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/16-18x6.png 18w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceValidate<\/p>\r\n<h5><em>KsefInvoiceVersion<\/em><\/h5>\r\n<p>Schema version for KSeF invoices <strong>v1<\/strong> : \u2013 First version of the schema <strong>v2<\/strong> : \u2013 Second version of the schema (valid)<\/p>\r\n<h5><em>TextXmlContent<\/em><\/h5>\r\n<p>The class represents a KSeF Invoice or an Official Receipt Confirmation (UPO) in XML format <strong>description<\/strong> : string \u2013 = Invoice or UPO<\/p>\r\n<h5><em><a id=\"post-449-BKM_9EE0569D_8FC8_4DBA_8884_7420EF52505D\"><\/a>KsefInvoiceValidateResponse<\/em><\/h5>\r\n<p>A response containing information about the schema version in which the sent KSeF invoice was generated and whether it is compatible with this schema. <a id=\"post-449-BKM_3C83286F_5D8E_40F0_9837_43B431038999\"><\/a><strong>invoiceVersion<\/strong> : KsefInvoiceVersion \u2013 One of two possible schema versions defined in the enum <a href=\"#post-449-BKM_A99F02C7_8367_44FB_9233_EDEF13514E5D\">KsefInvoiceVersion<\/a>. <a id=\"post-449-BKM_E184A3A9_2FF2_4A43_B10D_6835636DF350\"><\/a><strong>valid<\/strong> : boolean \u2013 The True value (1) means that the invoice sent for verification is compliant with the schema, however, if the invoice XML file is found to be incompatible with the schema, the HTTP code and the object are returned <a href=\"#post-449-BKM_10DB3E1E_4E99_4AE7_B63C_11FF70E9C13B\">Error<\/a> with the description of the first detected schema mismatch error in the attribute <a href=\"#post-449-BKM_332861F1_6F93_490C_9977_2A6D30C258D8\">details<\/a>.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceSend\"><\/span><a id=\"post-449-KSEFINVOICESEND\"><\/a><a id=\"post-449-BKM_A746644D_69CD_44A9_98E8_6C12405264CE\"><\/a>ksefInvoiceSend<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceSend<\/strong>(invoice : KsefInvoiceSendRequest): KsefInvoiceSendResponse<\/code> The method enables sending one invoice to the KSeF system as part of a set interactive session. <strong>Attention<\/strong>! The method can be called any number of times within a set session and thus send more invoices to KSeF. <strong>Attention<\/strong>! To send invoices to KSeF using this method, you must first call the operation <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a> in order to establish an interactive session. The input method requires the creation of a request in accordance with <a href=\"#post-449-BKM_2DF5E4BB_F801_4566_A088_CF9A6D2C8007\">KsefInvoiceSendRequest<\/a>, and the output returns a response consistent with <a href=\"#post-449-BKM_1C28A96A_30E8_4D8E_AEDB_02C85E1EF62D\">KsefInvoiceSendResponse<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/17.png\" alt=\"KSeF REST API - wys\u0142anie faktury do KSeF\" width=\"604\" height=\"307\" class=\"aligncenter size-full wp-image-653\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/17.png 604w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/17-300x152.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/17-18x9.png 18w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceSend<\/p>\r\n<h5><a id=\"post-449-BKM_2DF5E4BB_F801_4566_A088_CF9A6D2C8007\"><\/a><em>KsefInvoiceSendRequest<\/em><\/h5>\r\n<p>The class represents a request to send an invoice in two modes: with or without encryption of invoices. <strong>encrypted<\/strong> : KsefInvoiceEncrypted \u2013 The attribute specifies the variant (choice) used to send an encrypted invoice in a session created with encryption, i.e. the set parameters: <a href=\"#post-449-BKM_E9ED5F18_4A0B_42AE_90AD_66BE89AD3DFD\">encryptedKey<\/a> and <a href=\"#post-449-BKM_3D24F7C3_E986_4141_9957_3DC252E9EEA5\">initVector<\/a> when creating a session (<a href=\"#post-449-BKM_663A19D5_1CA9_45A4_9D58_95D3B0DAFBCD\">KsefSessionOpenRequest<\/a>). (Required: [0..1]) <strong>plain<\/strong> : KsefInvoicePlain \u2013 Attribute specifies the variant (choice) that is used to send unencrypted invoice XML in a session created with no encryption. (Required: [0..1]) <strong>sessionId<\/strong> : string \u2013 <a href=\"#post-449-BKM_B4E2F9F2_43E3_4B05_8C85_5888E4A9BACC\">Session ID<\/a> obtained when establishing an interactive session: <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a>.<\/p>\r\n<h5><em>KsefInvoiceEncrypted<\/em><\/h5>\r\n<p>The object represents the invoice being sent in encrypted form. <strong>encryptedInvoice<\/strong> : string \u2013 Attribute containing the invoice XML file in encrypted form, which is sent to KSeF. The invoice XML file is encrypted with the AES256 algorithm using the initialization vector (attribute <a href=\"#post-449-BKM_3D24F7C3_E986_4141_9957_3DC252E9EEA5\">initVector<\/a> Classes <a href=\"#post-449-BKM_663A19D5_1CA9_45A4_9D58_95D3B0DAFBCD\">KsefSessionOpenRequest<\/a>) and the symmetric key generated when creating the session. <strong>invoiceHash<\/strong> : string \u2013 The attribute contains the SHA256 hash value of the original (unencrypted) XML form of the invoice that is sent to KSeF. <strong>invoiceSize<\/strong> : int \u2013 Attribute containing the calculated invoice size (size in bytes of the original, unencrypted XML form of the invoice) that is sent to KSeF.<\/p>\r\n<h5><em>KsefInvoicePlain<\/em><\/h5>\r\n<p>The object represents the invoice being sent in clear (unencrypted) form <code><strong>invoice<\/strong> <\/code>: string \u2013 Attribute containing the invoice XML file in unencrypted byte format with UTF-8 encoding, which is sent to KSeF.<\/p>\r\n<h5><em><a id=\"post-449-BKM_1C28A96A_30E8_4D8E_AEDB_02C85E1EF62D\"><\/a>KsefInvoiceSendResponse<\/em><\/h5>\r\n<p>The class represents the response obtained from KSeF in case of successful invoice sending. <strong>Attention<\/strong>! The response informs that the invoice has been correctly sent to KSeF, however, to be sure that the invoice has been correctly saved in KSeF, the operation should be called <a href=\"#post-449-BKM_4E604362_F662_48C7_B38C_8BE64F4F0738\">ksefInvoiceStatus<\/a>, one of the input parameters of which is <a href=\"#post-449-BKM_F42656AB_ADAE_4E26_B039_484273B3C51A\">technical invoice identifier<\/a> returned as attribute value <a href=\"#post-449-BKM_C03DEBBC_C4C2_493E_BB68_84FA80CDBE1C\">id<\/a>. <code><a id=\"post-449-BKM_E3583970_16D0_4D19_A513_9F7E6A70164A\"><\/a><strong>created<\/strong> <\/code>: string \u2013 The attribute contains information about the exact date and time of sending the invoice to KSeF <code><a id=\"post-449-BKM_C03DEBBC_C4C2_493E_BB68_84FA80CDBE1C\"><\/a><strong>id<\/strong> <\/code>: string \u2013 Attribute contains <a href=\"#post-449-BKM_F42656AB_ADAE_4E26_B039_484273B3C51A\">technical invoice identifier<\/a> sent to KSeF<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceQueryStart\"><\/span><a id=\"post-449-KSEFINVOICEQUERYSTART\"><\/a><a id=\"post-449-BKM_085D7653_C47C_4DF3_A9A7_AA3865243668\"><\/a>ksefInvoiceQueryStart<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceQueryStart <\/strong>(KsefInvoiceQueryStartRequest : KsefInvoiceQueryStartRequest): KsefInvoiceQueryStartResponse<\/code> The method allows you to define and send invoice search criteria to KSeF. <strong>Attention<\/strong>! Calling the method requires previously opening an interactive session using the operation <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a>. The input method requires sending a request that complies with <a href=\"#post-449-BKM_380F543B_A59E_417C_B15F_FBC666DFC45B\">KsefInvoiceQueryStartRequest<\/a>. The method returns an object that complies with <a href=\"#post-449-BKM_2965E670_555F_4AD5_A22A_70C4AE897D00\">KsefInvoiceQueryStartResponse<\/a>, which contains <a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">search id<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/20.png\" alt=\"KSeF REST API - rozpocz\u0119cie procesu wyszukania faktur w KSeF\" width=\"763\" height=\"317\" class=\"aligncenter size-full wp-image-656\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/20.png 763w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/20-300x125.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/20-18x7.png 18w\" sizes=\"(max-width: 763px) 100vw, 763px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceQueryStart<\/p>\r\n<h5><em>KsefInvoiceQueryStartRequest<\/em><\/h5>\r\n<p>The class represents a request that allows defining search parameters. <code><strong>range<\/strong> <\/code>: KsefInvoiceQueryStartRange \u2013 Select the period for which invoices are to be searched<a id=\"post-449-Att.Alias.End\"><\/a><a id=\"post-449-Att.Alias.Start\"><\/a> (Required: [0..1]) <strong>sessionId<\/strong> : string \u2013 Active session ID <strong>subjectType<\/strong> : SubjectType \u2013 Specifies what type of invoice we are looking for:<\/p>\r\n<ul>\r\n<li>sales (subject1),<\/li>\r\n<li>cost (subject2),<\/li>\r\n<li>third party (subject3),<\/li>\r\n<li>Authorized entity (subjectAuthorized)<\/li>\r\n<\/ul>\r\n<h5><em>SubjectType<\/em><\/h5>\r\n<p>Enumeration defines the possible types of entity <strong>subject1<\/strong> : \u2013 The attribute indicates the entity issuing the invoice <strong>subject2<\/strong> : \u2013 The attribute indicates the entity receiving the invoice <strong>subject3<\/strong> : - The attribute denotes a third party <strong>SubjectAuthorized<\/strong> : \u2013 The attribute denotes an authorized entity<\/p>\r\n<h5><em>KsefInvoiceQueryStartRange<\/em><\/h5>\r\n<p>The class represents the period for which invoices are to be searched <code><strong>from<\/strong> <\/code>: string \u2013 Date from which invoices will be searched. <code><strong>this<\/strong> <\/code>: string \u2013 Date until which invoices will be searched.<\/p>\r\n<h5><em><a id=\"post-449-BKM_2965E670_555F_4AD5_A22A_70C4AE897D00\"><\/a>KsefInvoiceQueryStartResponse<\/em><\/h5>\r\n<p>The object represents a response from the KSeF system containing <a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">search id<\/a>, which search was started asynchronously on the KSeF side. <a id=\"post-449-BKM_3A272247_1DAF_4F57_AC28_F795A0BF7649\"><\/a><strong>queryId<\/strong> : string \u2013 The attribute specifies <a href=\"#post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\">search id<\/a>, which is generated by KSeF.<\/p>\r\n<h4 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"ksefInvoiceVisualize\"><\/span><a id=\"post-449-KSEFINVOICEVISUALIZE\"><\/a><a id=\"post-449-BKM_EEDE0DC9_EFBD_49F6_B250_A748C985221D\"><\/a>ksefInvoiceVisualize<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><code><strong>ksefInvoiceVisualize<\/strong>(KsefInvoiceVisualizeRequest : KsefInvoiceVisualizeRequest): KsefInvoiceVisualizeContent<\/code> A method that allows you to generate a visualization of an XML structured invoice in one of the formats: HTML and PDF. The method requires the preparation of a request in accordance with the input <a href=\"#post-449-BKM_971DE727_C4DE_4C3F_A3B6_94318FC8866B\">KsefInvoiceVisualizeRequest<\/a>and in response returns an object of type <a href=\"#post-449-BKM_A98BD425_F9DF_41D1_9D4A_6520F08ED831\">TextHtmlContent<\/a> for HTML visualization or <a href=\"#post-449-BKM_B4C5AFC5_C4FA_4E6C_AD88_49F26B7AF795\">ApplicationPdfContent<\/a> for visualization in a PDF file. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/23.png\" alt=\"KSeF REST API - wizualizacja faktury KSeF\" width=\"761\" height=\"334\" class=\"aligncenter size-full wp-image-659\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/23.png 761w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/23-300x132.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/23-18x8.png 18w\" sizes=\"(max-width: 761px) 100vw, 761px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: ksefInvoiceVisualize<\/p>\r\n<h5><em>KsefInvoiceVisualizeRequest<\/em><\/h5>\r\n<p>The class allows you to define parameters related to the visualization of a structured invoice (KSeF invoice) <strong>includeLogo<\/strong> : boolean \u2013 The attribute specifies whether a logo should be included in the visualization. <strong>includeQrCode<\/strong> : boolean \u2013 The attribute determines whether a QR code should be attached to the visualization. This option may be used for invoices issued to foreign contractors who will not have access to KSeF anyway, and the method of transferring (delivering) the invoice will depend on the issuing entity. <strong>invoiceDate<\/strong> : string \u2013 The attribute passes the XML file of the KSeF invoice for which the visualization is to be performed. <strong>invoiceKsefNumber<\/strong> : string \u2013 The attribute contains a unique <a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">KSeF invoice number<\/a> assigned by the National e-Invoice System when the invoice is correctly sent to the National e-Invoice System. <strong>outputFormat<\/strong> : OutputFormat \u2013 The attribute can take one of two possible values defined in the enumeration <a href=\"#post-449-BKM_228F709D_A191_4EC3_B3D0_1E5C58CBE49E\">OutputFormat<\/a>:<\/p>\r\n<ul>\r\n<li>html<\/li>\r\n<li>pdf<\/li>\r\n<\/ul>\r\n<p><strong>outputLanguage<\/strong> : OutputLanguage \u2013 The attribute can take one of three possible values defined in the enumeration <a href=\"#post-449-BKM_D4CAA4F7_067E_4E52_817E_931699AB95DE\">OutputLanguage<\/a>:<\/p>\r\n<ul>\r\n<li>en<\/li>\r\n<li>en<\/li>\r\n<li>pl_en<\/li>\r\n<\/ul>\r\n<h5><em>OutputFormat<\/em><\/h5>\r\n<p>Enumeration defines the format in which the invoice visualization is to be generated <strong>html<\/strong> : string \u2013 The value specifies that the invoice visualization should be returned in HTML format. <strong>pdf<\/strong> : string \u2013 The value specifies that the invoice visualization should be returned in PDF format.<\/p>\r\n<h5><em>OutputLanguage<\/em><\/h5>\r\n<p>Enumeration defines the language in which the invoice visualization is to be generated <strong>en<\/strong> : string \u2013 The value specifies that the invoice visualization should be in Polish. <strong>en<\/strong> : string \u2013 The value specifies that the invoice visualization should be in English. <strong>pl_en<\/strong> : string \u2013 The value specifies that the invoice visualization should be in Polish and English.<\/p>\r\n<h5><em>Content<\/em><\/h5>\r\n<p>A parent class describing the content from which other classes inherit. <code><strong>description<\/strong> <\/code>: string \u2013 Description of the content for a given class <code><strong>format<\/strong> <\/code>: binary - Content format - always BINARY <code><strong>type<\/strong> <\/code>: string \u2013 Content type \u2013 always STRING<\/p>\r\n<h5><em>ApplicationPdfContent<\/em><\/h5>\r\n<p>The class represents the generated visualization of a KSeF invoice in the form of a PDF file. <code><strong>description<\/strong> <\/code>: string \u2013 = PDF Visualization<\/p>\r\n<h5><em>TextHtmlContent<\/em><\/h5>\r\n<p>The class represents the generated KSeF invoice visualization in the form of an HTML file. <code><strong>description<\/strong> <\/code>: string<a id=\"post-449-Att.Scope.Start\"><\/a> &#8211; <a id=\"post-449-Att.Const.End\"><\/a> = HTML visualization \u00a0 \u00a0<\/p>\r\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Parametry\"><\/span><a id=\"post-449-PARAMETRY\"><\/a><a id=\"post-449-BKM_4050067F_D17B_4C47_9E37_765376AE8406\"><\/a>Parameters<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>The chapter contains a list of all parameters divided by type:<\/p>\r\n<ul>\r\n<li>path \u2013 parameter passed in the URL path<\/li>\r\n<li>requestBody \u2013 parameter passed in the request body<\/li>\r\n<\/ul>\r\n<p><a id=\"post-449-BKM_C69F08CB_BB62_46A2_85C0_F988411FDA77\"><\/a><\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/3.png\" alt=\"KSeF REST API - parametry\" width=\"723\" height=\"697\" class=\"aligncenter size-full wp-image-631\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/3.png 723w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/3-300x289.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/3-12x12.png 12w\" sizes=\"(max-width: 723px) 100vw, 723px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Parameters<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Path\"><\/span>Path<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The operation call parameters contained in the path.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SessionId\"><\/span><a id=\"post-449-BKM_5FDFF597_22B9_49D7_BD55_5B0A5A057D46\"><\/a><em>SessionId<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class represents a session identifier generated by the KSEF system <a id=\"post-449-BKM_BB12D693_5AA3_4D52_BAFD_9638B04BDE6F\"><\/a><strong>sessionId<\/strong> : string \u2013 Unique session identifier<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"InvoiceId\"><\/span><em><a id=\"post-449-BKM_F42656AB_ADAE_4E26_B039_484273B3C51A\"><\/a>InvoiceId<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class represents the technical identifier of the invoice, which is returned as an attribute <a href=\"#post-449-BKM_C03DEBBC_C4C2_493E_BB68_84FA80CDBE1C\">id<\/a> Classes <a href=\"#post-449-BKM_1C28A96A_30E8_4D8E_AEDB_02C85E1EF62D\">KsefInvoiceSendResponse<\/a>, and then it can be used to check the invoice processing status by calling the operation <a href=\"#post-449-BKM_4E604362_F662_48C7_B38C_8BE64F4F0738\">ksefInvoiceStatus.<\/a> <a id=\"post-449-BKM_8331B5B0_7855_4C5F_A2F8_6B21FCA07298\"><\/a><strong>invoiceId<\/strong> : string \u2013 Invoice ID (technical)<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"InvoiceKsefNumber\"><\/span><em><a id=\"post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\"><\/a>InvoiceKsefNumber<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>KSeF invoice number generated by KSeF. <a id=\"post-449-BKM_154AFA1C_9D0C_4C75_AAD7_29BB63423C6E\"><\/a><strong>invoiceKsefNumber<\/strong> : string \u2013 Invoice ID generated by KSeF. Generation of this ID confirms saving the sent invoice in KSeF.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"QueryId\"><\/span><em><a id=\"post-449-BKM_5EDA1BCB_C6D9_4C25_8D89_4EBC94C91214\"><\/a>QueryId<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class contains a search identifier that is generated by KSeF. <a id=\"post-449-BKM_5ED45ACC_8176_4DA5_85DD_F8C3EAE2FC4B\"><\/a><strong>queryId<\/strong> : string \u2013 Search process identifier<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"QueryPartNumber\"><\/span><em><a id=\"post-449-BKM_BC3C4915_1195_411B_B2F3_2E6B406EAB11\"><\/a>QueryPartNumber<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class represents the search pack number. <a id=\"post-449-BKM_4D45BFA7_7251_4801_A2B2_7D9CE337DEE7\"><\/a><strong>partNumber<\/strong> : string \u2013 Fragment (package) identifier of the search result<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"RequestBody\"><\/span>RequestBody<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Parameters of type requestBody.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"KsefInvoiceEncrypted\"><\/span><em>KsefInvoiceEncrypted<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The object represents the invoice being sent in encrypted form. <a id=\"post-449-BKM_713C307A_E504_4167_951E_FC2B6BD04566\"><\/a><strong>encryptedInvoice<\/strong> : string \u2013 Attribute containing the invoice XML file in encrypted form, which is sent to KSeF. The invoice XML file is encrypted with the AES256 algorithm using the initialization vector (attribute <a href=\"#post-449-BKM_3D24F7C3_E986_4141_9957_3DC252E9EEA5\">initVector<\/a> Classes <a href=\"#post-449-BKM_663A19D5_1CA9_45A4_9D58_95D3B0DAFBCD\">KsefSessionOpenRequest<\/a>) and the symmetric key generated when creating the session. <a id=\"post-449-BKM_FF7AC31E_AA3C_43C4_8B5A_69CD0DAAD3BD\"><\/a><strong>invoiceHash<\/strong> : string \u2013 The attribute contains the SHA256 hash value of the original (unencrypted) XML form of the invoice that is sent to KSeF. <a id=\"post-449-BKM_57CB7FB1_75D9_486F_A485_7C9A09FCDB3C\"><\/a><strong>invoiceSize<\/strong> : int \u2013 Attribute containing the calculated invoice size (size in bytes of the original, unencrypted XML form of the invoice) that is sent to KSeF.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"KsefInvoicePlain\"><\/span><a id=\"post-449-BKM_F926B7AB_E3B6_4334_99FA_9709C2B6DF91\"><\/a><em>KsefInvoicePlain<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The object represents the invoice being sent in clear (unencrypted) form. <a id=\"post-449-BKM_9106C645_07E9_489E_8990_A10300007B53\"><\/a><strong>invoice<\/strong> : string \u2013 Attribute containing the invoice XML file in unencrypted byte format with UTF-8 encoding, which is sent to KSeF.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"KsefInvoiceQueryStartRange\"><\/span><a id=\"post-449-BKM_A4AA4DAB_30D5_45CC_BF4A_818BF2ED74B6\"><\/a><em>KsefInvoiceQueryStartRange<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class represents the period for which invoices are to be searched. <a id=\"post-449-BKM_F12FA3E7_F336_4C14_9437_67CC4F096BDC\"><\/a><strong>from<\/strong> : string \u2013 Date from which invoices will be searched. <a id=\"post-449-BKM_E5148190_437E_44E0_A518_6471C2BA5FFD\"><\/a><strong>this<\/strong> : string \u2013 Date until which invoices will be searched.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"KsefInvoiceQueryStartRequest\"><\/span><a id=\"post-449-BKM_380F543B_A59E_417C_B15F_FBC666DFC45B\"><\/a><em>KsefInvoiceQueryStartRequest<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class represents a request that allows defining search parameters. <a id=\"post-449-BKM_76940378_CE17_4967_BA01_577794467EB5\"><\/a><strong>range<\/strong> : KsefInvoiceQueryStartRange \u2013 Select the period for which invoices are to be searched (Maintenance: [0..1]) <a id=\"post-449-BKM_4B51EB78_A094_45E8_95EB_E64939529912\"><\/a><strong>sessionId<\/strong> : string \u2013 Active session ID <a id=\"post-449-BKM_0ABABBD0_3548_449C_ABDD_638B071404E3\"><\/a><strong>subjectType<\/strong> : SubjectType \u2013 Specifies what type of invoice we are looking for:<\/p>\r\n<ul>\r\n<li>sales (subject1),<\/li>\r\n<li>cost (subject2),<\/li>\r\n<li>third party (subject3),<\/li>\r\n<li>Authorized entity (subjectAuthorized)<\/li>\r\n<\/ul>\r\n<h4><span class=\"ez-toc-section\" id=\"KsefInvoiceSendRequest\"><\/span><em>KsefInvoiceSendRequest<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class represents a request to send an invoice in two modes: with or without encryption of invoices. <a id=\"post-449-BKM_CA1ADD54_F98A_419B_9FB9_918117D58060\"><\/a><strong>encrypted<\/strong> : KsefInvoiceEncrypted \u2013 The attribute specifies the variant (choice) used to send an encrypted invoice in a session created with encryption, i.e. the set parameters: <a href=\"#post-449-BKM_E9ED5F18_4A0B_42AE_90AD_66BE89AD3DFD\">encryptedKey<\/a> and <a href=\"#post-449-BKM_3D24F7C3_E986_4141_9957_3DC252E9EEA5\">initVector<\/a> when creating a session (<a href=\"#post-449-BKM_663A19D5_1CA9_45A4_9D58_95D3B0DAFBCD\">KsefSessionOpenRequest<\/a>). (Required: [0..1]) <a id=\"post-449-BKM_CE798D91_F138_4693_8DD8_E507BB105717\"><\/a><strong>plain<\/strong> : KsefInvoicePlain \u2013 Attribute specifies the variant (choice) that is used to send unencrypted invoice XML in a session created with no encryption. (Required: [0..1]) <a id=\"post-449-BKM_B7C141BC_BF3D_4469_A1FC_DE4FFE16722A\"><\/a><strong>sessionId<\/strong> : string \u2013 <a href=\"#post-449-BKM_B4E2F9F2_43E3_4B05_8C85_5888E4A9BACC\">Session ID<\/a> obtained when establishing an interactive session: <a href=\"#post-449-BKM_4B52DA5F_584D_4A16_B161_4AF463A3BDA3\">ksefSessionOpen<\/a>.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"KsefSessionOpenRequest\"><\/span><a id=\"post-449-BKM_663A19D5_1CA9_45A4_9D58_95D3B0DAFBCD\"><\/a><em>KsefSessionOpenRequest<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class represents a request to create an interactive session <a id=\"post-449-BKM_E9ED5F18_4A0B_42AE_90AD_66BE89AD3DFD\"><\/a><strong>encryptedKey<\/strong> : string \u2013 If encryption of transmitted data (invoices) is to be used within the interactive session, the attribute should contain a symmetric encryption key (AES256) generated before opening a new session and encrypted with the RSA public key of the KSeF platform obtained using the operation <a href=\"#post-449-BKM_DA691A51_7832_4BB5_83F4_604D2B065754\">ksefPublicKey<\/a>. (Required: [0..1]) <a id=\"post-449-BKM_3D24F7C3_E986_4141_9957_3DC252E9EEA5\"><\/a><strong>initVector<\/strong> : string \u2013 The attribute describes the so-called initialization vector. The allowed AES symmetric key encryption algorithm is AES\/CBC\/PKCS5Padding (PKCS#7). The allowed symmetric key is AES with a length of 256 bits supported by a random initialization vector of length 16 bytes. (Required: [0..1]) <a id=\"post-449-BKM_02235351_A60F_4FCF_A825_41090167E8B3\"><\/a><strong>invoiceVersion<\/strong> : KsefInvoiceVersion \u2013 Indication of the schema version in which KSeF invoices will be sent as part of the established session.<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"KsefInvoiceVisualizeRequest\"><\/span><a id=\"post-449-BKM_971DE727_C4DE_4C3F_A3B6_94318FC8866B\"><\/a><em>KsefInvoiceVisualizeRequest<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p>The class allows you to define parameters related to the visualization of a structured invoice (KSeF invoice). <a id=\"post-449-BKM_D0FE7C79_D7A4_4DB8_93B3_DD57344A5184\"><\/a><strong>includeLogo<\/strong> : boolean \u2013 The attribute specifies whether a logo should be included in the visualization. <a id=\"post-449-BKM_D6AE6D4E_076B_431A_8948_F826F8AEE20B\"><\/a><strong>includeQrCode<\/strong> : boolean \u2013 The attribute determines whether a QR code should be attached to the visualization. This option may be used for invoices issued to foreign contractors who will not have access to KSeF anyway, and the method of transferring (delivering) the invoice will depend on the issuing entity. <a id=\"post-449-BKM_50C43555_0CE9_493E_A678_CC1585763576\"><\/a><strong>invoiceDate<\/strong> : string \u2013 The attribute passes the XML file of the KSeF invoice for which the visualization is to be performed. <a id=\"post-449-BKM_E217E3CB_B2FA_40F0_AE78_57BC96D23AA2\"><\/a><strong>invoiceKsefNumber<\/strong> : string \u2013 The attribute contains a unique <a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">KSeF invoice number<\/a> assigned by the National e-Invoice System when the invoice is correctly sent to the National e-Invoice System. <a id=\"post-449-BKM_AAC3502B_368C_460D_958C_649C50B3E1EF\"><\/a><strong>outputFormat<\/strong> : OutputFormat \u2013 The attribute can take one of two possible values defined in the enumeration <a href=\"#post-449-BKM_228F709D_A191_4EC3_B3D0_1E5C58CBE49E\">OutputFormat<\/a>:<\/p>\r\n<ul>\r\n<li>html<\/li>\r\n<li>pdf<\/li>\r\n<\/ul>\r\n<p><a id=\"post-449-BKM_4D9A7177_F6D5_4614_8D4A_BEE030065F45\"><\/a><strong>outputLanguage<\/strong> : OutputLanguage \u2013 The attribute can take one of three possible values defined in the enumeration <a href=\"#post-449-BKM_D4CAA4F7_067E_4E52_817E_931699AB95DE\">OutputLanguage<\/a>:<\/p>\r\n<ul>\r\n<li>en<\/li>\r\n<li>en<\/li>\r\n<li>pl_en<\/li>\r\n<\/ul>\r\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Enumeracje\"><\/span><a id=\"post-449-ENUMERACJE\"><\/a><a id=\"post-449-BKM_D9A08F90_A57A_4C3D_B5D8_E226CDFA5A5B\"><\/a>Enumerations<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>This chapter contains a list of all enumerations that can be used in the interface. <a id=\"post-449-BKM_B4955BAF_4CDF_444D_905F_E74BBD946D06\"><\/a> <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/4.png\" alt=\"KSeF REST API - Enumeracje\" width=\"496\" height=\"231\" class=\"aligncenter size-full wp-image-632\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/4.png 496w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/4-300x140.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/4-18x8.png 18w\" sizes=\"(max-width: 496px) 100vw, 496px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Enumerations<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"InvoiceStatus\"><\/span><a id=\"post-449-BKM_3107DB78_BF59_438B_8455_BC16B7B2E84B\"><\/a><em>InvoiceStatus<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Enumeration defining the possible statuses of the sent invoice returned by <a href=\"#post-449-BKM_5A623BA4_65E7_40EB_8218_16C9A3739076\">KsefInvoiceStatusResponse<\/a> <a id=\"post-449-BKM_B6FF2C38_D527_4216_AADD_43EA4F2AAA24\"><\/a><strong>processing<\/strong> : string \u2013 The status returned from KSeF means that the sent invoice is still being processed. You should wait a moment and check the invoice status again. <a id=\"post-449-BKM_BC2A5432_4439_4CE2_91BF_527E7C711E59\"><\/a><strong>accepted<\/strong> : string \u2013 The status returned from KSeF means that the sent invoice has been received correctly and a unique KSeF number has been assigned to it (<a href=\"#post-449-BKM_A332AC3F_A29E_4CCD_964A_114B6C3F7A90\">InvoiceKsefNumber<\/a>). <a id=\"post-449-BKM_E18D6FC2_ABE2_485E_A480_5252E27BBB73\"><\/a><strong>Rejected<\/strong> : string \u2013 The status returned from KSeF means that the sent invoice was rejected by KSeF. In the error message details (<a href=\"#post-449-BKM_ED51A11B_2565_461E_9F49_113848DDC4F1\">Error<\/a>), you should check what was the reason for rejection of the invoice.<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Algorithm\"><\/span><a id=\"post-449-BKM_AA76CC42_39D3_4287_B024_34CF08DF017F\"><\/a><em>Algorithm<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Supported Cryptographic Key Algorithms by KSeF <a id=\"post-449-BKM_A0CE3580_2292_4A6B_932F_9386439ED3EC\"><\/a><strong>RSA<\/strong> :- Supported cryptographic key algorithm<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"KsefInvoiceVersion\"><\/span><a id=\"post-449-BKM_A99F02C7_8367_44FB_9233_EDEF13514E5D\"><\/a><em>KsefInvoiceVersion<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Schema version for KSeF invoices <strong>v1<\/strong> : \u2013 First version of the schema <strong>v2<\/strong> : \u2013 Second version of the schema (valid)<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"OutputFormat\"><\/span><a id=\"post-449-BKM_228F709D_A191_4EC3_B3D0_1E5C58CBE49E\"><\/a><em>OutputFormat<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Enumeration defines the format in which the invoice visualization is to be generated <strong>html<\/strong> : string \u2013 The value specifies that the invoice visualization should be returned in HTML format. <strong>pdf<\/strong> : string \u2013 The value specifies that the invoice visualization should be returned in PDF format.<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"OutputLanguage\"><\/span><a id=\"post-449-BKM_D4CAA4F7_067E_4E52_817E_931699AB95DE\"><\/a><em>OutputLanguage<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Enumeration defines the language in which the invoice visualization is to be generated <strong>en<\/strong> : string \u2013 The value specifies that the invoice visualization should be in Polish. <strong>en<\/strong> : string \u2013 The value specifies that the invoice visualization should be in English. <strong>pl_en<\/strong> : string \u2013 The value specifies that the invoice visualization should be in Polish and English.<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"SessionStatus\"><\/span><a id=\"post-449-BKM_6D341082_98B9_42D2_B3BC_E8325D57AF97\"><\/a><em>SessionStatus<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Enumeration defines what statuses an interactive session can have <a id=\"post-449-BKM_7C82D54C_343F_4384_8E86_771F1B33E3A8\"><\/a><strong>active<\/strong> : string \u2013 The attribute indicates an active session <a id=\"post-449-BKM_267D3F3E_3F3D_4E80_A40D_DFCF26125384\"><\/a><strong>closed<\/strong> : string \u2013 The attribute indicates a ended session.<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"SubjectType\"><\/span><em>SubjectType<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Enumeration defines the possible types of entity <strong>subject1<\/strong> : \u2013 The attribute indicates the entity issuing the invoice <strong>subject2<\/strong> : \u2013 The attribute indicates the entity receiving the invoice <strong>subject3<\/strong> : - The attribute denotes a third party <strong>SubjectAuthorized<\/strong> : \u2013 The attribute denotes an authorized entity<\/p>\r\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Odpowiedzi_typu_content\"><\/span>Content Answers<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>The chapter identifies and groups classes related to specific content that may occur during information exchange with KSeF. <a id=\"post-449-BKM_745E1B39_4BEC_4008_ABE9_A8CCCE40CF88\"><\/a><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/5.png\" alt=\"KSeF REST API - zawarto\u015b\u0107 (content)\" width=\"720\" height=\"300\" class=\"aligncenter size-full wp-image-634\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/5.png 720w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/5-300x125.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/5-18x8.png 18w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Content Responses<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Content\"><\/span><em>Content<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>A parent class describing the content from which other classes inherit. <a id=\"post-449-BKM_B7EF5834_1374_4C1E_B543_9A164F6809D5\"><\/a><strong>description<\/strong> : string \u2013 Description of the content for a given class <a id=\"post-449-BKM_3DD9DA92_7C63_4A87_8116_D15B1247DBB8\"><\/a><strong>format<\/strong> : binary - Content format - always BINARY <a id=\"post-449-BKM_94BBE744_5A94_4590_903D_EEAB9D128EA4\"><\/a><strong>type<\/strong> : string \u2013 Content type \u2013 always STRING<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"ApplicationZipContent\"><\/span><em><a id=\"post-449-BKM_0F091857_5CA9_4A1C_9E5F_B65F98CDF963\"><\/a>ApplicationZipContent<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The class represents a ZIP archive with KSeF invoices in XML format <a id=\"post-449-BKM_C80819E4_4AFD_4575_954C_E2B2EEE75DDB\"><\/a><strong>description<\/strong> : string \u2013 = ZIP archive with XML invoices<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"ApplicationOctetStreamContent\"><\/span><a id=\"post-449-BKM_14FB405A_D772_455F_8B44_3252BB80A3DC\"><\/a><em>ApplicationOctetStreamContent<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The class represents data in one of two possible forms: a) an encrypted single KSeF invoice (XML), b) an encrypted ZIP archive with multiple KSeF invoices (XML) <a id=\"post-449-BKM_CA642B21_6B8C_4F01_B780_A548B8003BA9\"><\/a><strong>description<\/strong> : string \u2013 = Encrypted single XML invoice or encrypted ZIP archive with XML invoices<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"TextXmlContent\"><\/span><a id=\"post-449-BKM_4ABF7647_7686_47D5_B5B0_70C5513BF908\"><\/a><em>TextXmlContent<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p><a id=\"post-449-BKM_A98BD425_F9DF_41D1_9D4A_6520F08ED831\"><\/a>The class represents a KSeF Invoice or an Official Receipt Confirmation (UPO) in XML format <a id=\"post-449-BKM_41330EDB_1FFE_4F4A_8C15_37DCDA7D669E\"><\/a><strong>description<\/strong> : string \u2013 = Invoice or UPO<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"ApplicationPdfContent\"><\/span><a id=\"post-449-BKM_B4C5AFC5_C4FA_4E6C_AD88_49F26B7AF795\"><\/a><em>ApplicationPdfContent<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The class represents the generated visualization of the KSeF invoice in the form of a PDF file <a id=\"post-449-BKM_066A9F50_094B_4E3C_AADE_8E16D453063F\"><\/a><strong>description<\/strong> : string \u2013 = PDF Visualization<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"TextHtmlContent\"><\/span><em>TextHtmlContent<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The class represents the generated visualization of the KSeF invoice in the form of an HTML file <a id=\"post-449-BKM_207D48DD_B04F_4E80_B8FE_E7B954EF2AE5\"><\/a><strong>description<\/strong> : string \u2013 = HTML Visualization<\/p>\r\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Komunikaty_bledow\"><\/span><a id=\"post-449-KOMUNIKATY_B\u00a3\u00caD\u00d3W\"><\/a><a id=\"post-449-BKM_FB59E57F_F3F5_41DF_90B9_4A86EB621297\"><\/a>Error messages<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>This chapter contains a description of the class responsible for handling error messages.<\/p>\r\n<h3><span class=\"ez-toc-section\" id=\"Error\"><\/span><em><a id=\"post-449-BKM_10DB3E1E_4E99_4AE7_B63C_11FF70E9C13B\"><\/a>Error<\/em><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>The class represents the structure of returned errors <a id=\"post-449-BKM_440F2C0D_B02E_40C8_83F4_FF6089EE9CA9\"><\/a><strong>code<\/strong> : string \u2013 Unique error code <a id=\"post-449-BKM_205B6F52_6695_4462_9F87_1131B5D3DC1D\"><\/a><strong>description<\/strong> : string \u2013 Error description <a id=\"post-449-BKM_332861F1_6F93_490C_9977_2A6D30C258D8\"><\/a><strong>details<\/strong> : string \u2013 Detailed description of the error. Attribute used in particular when generating an XML invoice file (<a href=\"#post-449-BKM_50F79695_ADB8_4A0D_8322_D287CC1E262B\">ksefInvoiceGenerate<\/a>) in case of a schema incompatibility error. Information about the first error encountered is always returned. (Required: [0..1]). Errors occurring in the invoice generation area are described in detail in the chapter <a href=\"#post-449-BKM_D0DBD58D_D4AD_400E_9BC6_DD7A925B0B35\">Error messages - Invoice<\/a>.<\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Autoryzacja_i_szyfrowanie\"><\/span><a id=\"post-449-AUTORYZACJA_I_SZYFROWANIE\"><\/a><a id=\"post-449-BKM_2BDC9422_4B92_476A_B551_76F2B179E4A9\"><\/a>Authorization and encryption<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>A set of errors related to the area of authorization and encryption. <a id=\"post-449-BKM_ED51A11B_2565_461E_9F49_113848DDC4F1\"><\/a><\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/6.png\" alt=\"KSeF REST API - komunikaty b\u0142\u0119d\u00f3w (autoryzacja i szyfrowanie)\" width=\"560\" height=\"437\" class=\"aligncenter size-full wp-image-639\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/6.png 560w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/6-300x234.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/6-15x12.png 15w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Error messages - authorization and encryption<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"AES_IV_LENGTH_%E2%80%93_Niepoprawna_dlugosc_wektora_inicjujacego\"><\/span><a id=\"post-449-BKM_05AA074B_45D0_45B9_9612_67F8126D0B84\"><\/a>AES_IV_LENGTH\u00a0<span style=\"color: #000080;\">-Incorrect initialization vector length<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1002 <strong>description<\/strong> = Initialization vector has invalid length<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"AES_KEY_LENGTH_%E2%80%93_Niepoprawna_dlugosc_klucza_symetrycznego_sluzacego_do_szyfrowania_danych\"><\/span>AES_KEY_LENGTH \u2013 <span style=\"color: #000080;\">Incorrect length of the symmetric key used to encrypt data<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1003 <strong>description<\/strong> = Symmetric key has incorrect length<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"AUTH_CHALLENGE_%E2%80%93_Blad_pobrania_wyzwania_autoryzujacego\"><\/span><a id=\"post-449-BKM_4DF7C840_6CA0_4F12_84AE_7C13E0BE196F\"><\/a>AUTH_CHALLENGE \u2013 <span style=\"color: #000080;\">Error getting authorization challenge<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1001 <strong>description<\/strong> = Failed to download authorization challenge from KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"B64_DECODE_%E2%80%93_Blednie_kodowana_wartosc_z_wykorzystaniem_base64\"><\/span><a id=\"post-449-BKM_D622D6B5_ABEB_4B8D_8FD3_AE4655EF9AE9\"><\/a>B64_DECODE \u2013 <span style=\"color: #000080;\">Incorrect base64 encoded value<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1005 <strong>description<\/strong> = Invalid base64 encoding of value<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"KSEF_PUBLIC_KEY_%E2%80%93_Blad_pobierania_klucza_publicznego_KSeF\"><\/span><a id=\"post-449-BKM_C8DCAC4C_3CB4_4126_BC42_EA46CDC95604\"><\/a>KSEF_PUBLIC_KEY \u2013 <span style=\"color: #000080;\">KSeF public key download error<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1004 <strong>description<\/strong> = Failed to get the KSeF public key<\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Sesja\"><\/span><a id=\"post-449-SESJA\"><\/a><a id=\"post-449-BKM_EAE18B50_220A_42F6_840F_19CE03BB8E3B\"><\/a>Session<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>A set of errors related to managing an interactive session. <a id=\"post-449-BKM_F0AC801E_65ED_4A4E_8C1D_257EC354C5EC\"><\/a><\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/7.png\" alt=\"KSeF REST API - komunikaty b\u0142\u0119d\u00f3w (sesja)\" width=\"766\" height=\"867\" class=\"aligncenter size-full wp-image-640\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/7.png 766w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/7-265x300.png 265w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/7-11x12.png 11w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Error messages - session<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_ACCESS_%E2%80%93_Blad_dostepu_do_sesji\"><\/span><a id=\"post-449-BKM_A2B1E0CA_BB97_4E48_80F0_2D48EBC42260\"><\/a>SESSION_ACCESS \u2013 <span style=\"color: #000080;\">Session access error<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1110 <strong>description<\/strong> = User does not have access to the specified session<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_CLOSE_%E2%80%93_Blad_podczas_proby_zamkniecia_sesji_interaktywnej\"><\/span><a id=\"post-449-BKM_570A7B8B_2753_4F77_8DD1_AE3A820AE40C\"><\/a>SESSION_CLOSE \u2013 <span style=\"color: #000080;\">Error while trying to close interactive session<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1106 <strong>description<\/strong> = Failed to close session in KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_INIT_%E2%80%93_Blad_inicjacji_sesji_interaktywnej_z_systemem_KSeF\"><\/span><a id=\"post-449-BKM_93311677_C938_425A_BE3C_7980DDB074DF\"><\/a>SESSION_INIT \u2013 <span style=\"color: #000080;\">Error initiating interactive session with KSeF system<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1102 <strong>description<\/strong> = Failed to initiate a new session in the KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_NO_UPO_%E2%80%93_Obiekt_UPO_nie_zostal_jeszcze_wygenerowany\"><\/span><a id=\"post-449-BKM_921BF248_7E0F_4029_A5CE_B4A070809704\"><\/a>SESSION_NO_UPO \u2013 <span style=\"color: #000080;\">UPO object has not been generated yet<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1111 <strong>description<\/strong> = No UPO<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_OPEN_%E2%80%93_Blad_tworzenia_nowej_sesji_interaktywnej_z_KSeF\"><\/span>SESSION_OPEN \u2013 <span style=\"color: #000080;\">Error creating new interactive session with KSeF<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1103 <strong>description<\/strong> = Failed to create a new session in the KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_REF_NUM_%E2%80%93_Niepoprawny_identyfikator_sesji_interaktywnej_KSeF\"><\/span><a id=\"post-449-BKM_8751B452_9D5B_4295_A792_0FC3D86650DF\"><\/a>SESSION_REF_NUM \u2013 <span style=\"color: #000080;\">Invalid KSeF interactive session id<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1104 <strong>description<\/strong> = No new KSeF session ID<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_SAVE_%E2%80%93_Blad_aktualizacji_sesji\"><\/span><a id=\"post-449-BKM_F777D6B3_99EF_4824_A942_554FBA18D7CB\"><\/a>SESSION_SAVE \u2013 <span style=\"color: #000080;\">Session update error<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1108 <strong>description<\/strong> = Failed to update KSeF session data<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_STATUS_%E2%80%93_Blad_pobierania_statusu_sesji_interaktywnej_w_KSeF\"><\/span><a id=\"post-449-BKM_B3DBC2B6_B6C6_42DA_B74F_E65A977046F5\"><\/a>SESSION_STATUS \u2013 <span style=\"color: #000080;\">Error getting interactive session status in KSeF<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1105 <strong>description<\/strong> = Failed to retrieve current session status from KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_TOKEN_%E2%80%93_Blad_przygotowania_wyzwania_autoryzacyjnego\"><\/span><a id=\"post-449-BKM_C24B5BC2_C0D8_4591_8CBA_F4FD074879DF\"><\/a>SESSION_TOKEN \u2013 <span style=\"color: #000080;\">Error preparing authorization challenge<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1101 <strong>description<\/strong> = Failed to prepare response to authorization challenge for KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_UNKNOWN_%E2%80%93_Bledny_identyfikator_sesji\"><\/span><a id=\"post-449-BKM_BDD8BC9D_FBD6_4B9A_B3DA_F03C76AD7724\"><\/a>SESSION_UNKNOWN \u2013<span style=\"color: #000080;\"> Invalid session id<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1109 <strong>description<\/strong> = Unknown KSeF session id<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"SESSION_UPO_%E2%80%93_Blad_pobrania_UPO\"><\/span><a id=\"post-449-BKM_44587751_4678_4FD1_AB0B_DA2685E2AD6E\"><\/a>SESSION_UPO \u2013 <span style=\"color: #000080;\">UPO download error<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1107 <strong>description<\/strong> = Failed to download UPO from KSeF system<\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Faktura\"><\/span><a id=\"post-449-FAKTURA\"><\/a><a id=\"post-449-BKM_D0DBD58D_D4AD_400E_9BC6_DD7A925B0B35\"><\/a>Invoice<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>A set of errors related to the generation, sending, downloading and visualization of invoices. <a id=\"post-449-BKM_F6264D58_F4C2_4D53_85ED_908571B83AF4\"><\/a><\/p>\r\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/8.png\" alt=\"KSeF REST API - komunikaty b\u0142\u0119d\u00f3w (faktura)\" width=\"639\" height=\"707\" class=\"aligncenter size-full wp-image-643\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/8.png 639w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/8-271x300.png 271w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/8-11x12.png 11w\" sizes=\"(max-width: 639px) 100vw, 639px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Error messages - invoice<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_FORMAT_%E2%80%93_Bledny_format_przeslanej_faktury\"><\/span><a id=\"post-449-BKM_C9DD9726_B4B1_43E4_A4FB_8DF204AE457E\"><\/a>INVOICE_FORMAT \u2013 Incorrect format of the sent invoice<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>description<\/strong> = The invoice has an invalid format <strong>code<\/strong> = 1203<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_INPUT_%E2%80%93_Brak_wymaganych_metadanych_opisujacych_fakture\"><\/span><a id=\"post-449-BKM_E218F5D7_D0BD_4A57_A826_18DEC27F90B4\"><\/a>INVOICE_INPUT \u2013 Missing required metadata describing the invoice<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1208 <strong>description<\/strong> = Required invoice metadata missing<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_SAVE_%E2%80%93_Wystapil_blad_podczas_aktualizacji_danych_faktury\"><\/span><a id=\"post-449-BKM_ECFB8D38_DF27_4FDD_9969_3B6C2D77C905\"><\/a>INVOICE_SAVE \u2013 An error occurred while updating the invoice data<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1206 <strong>description<\/strong> = Failed to update invoice details<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_SEND_%E2%80%93_Wystapil_blad_podczas_przesylania_faktury_do_KSeF\"><\/span><a id=\"post-449-BKM_6BBCE424_A084_4686_B4FE_3A99359CA922\"><\/a>INVOICE_SEND \u2013 An error occurred while sending the invoice to KSeF<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1204 <strong>description<\/strong> = Failed to send invoice to KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_SIZE_%E2%80%93_Za_duzy_rozmiar_faktury\"><\/span><a id=\"post-449-BKM_1AEA9A93_A06E_4119_B269_CC61B304FF4D\"><\/a>INVOICE_SIZE \u2013 Invoice size too large<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1202 <strong>description<\/strong> = The invoice is of an unacceptable size<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_STATUS_%E2%80%93_Wystapil_blad_podczas_pobierania_statusu_faktury\"><\/span><a id=\"post-449-BKM_EA59C349_9CA4_4730_92A4_9CEE996DBFA8\"><\/a>INVOICE_STATUS \u2013 An error occurred while retrieving the invoice status<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1205 <strong>description<\/strong> = Failed to retrieve current invoice status from KSeF system<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_UNKNOWN_%E2%80%93_Bledny_identyfikator_faktury\"><\/span><a id=\"post-449-BKM_BF80D85C_3DC8_40AB_AF95_025A54E6655B\"><\/a>INVOICE_UNKNOWN \u2013 Invalid invoice identifier<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1207 <strong>description<\/strong> = Unknown invoice id<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_VERSION_%E2%80%93_Bledna_wersja_schemy_faktury\"><\/span><a id=\"post-449-BKM_DCB669EA_E73D_4E0A_A083_BF32CC1FDAF3\"><\/a>INVOICE_VERSION \u2013 Incorrect invoice schema version<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1201 <strong>description<\/strong> = Invalid invoice format version<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"INVOICE_VISUALIZE_%E2%80%93_Wystapil_blad_podczas_generowania_wizualizacji_faktury\"><\/span><a id=\"post-449-BKM_63351713_B0B0_49BB_B268_ED3072DBD40D\"><\/a>INVOICE_VISUALIZE \u2013 An error occurred while generating the invoice visualization<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1209 <strong>description<\/strong> = Failed to generate invoice visualization<\/p>\r\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Wyszukiwanie\"><\/span><a id=\"post-449-WYSZUKIWANIE\"><\/a><a id=\"post-449-BKM_34B67330_F5BA_4B8E_8493_123D2BEEBBDC\"><\/a>Search<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>A set of errors related to inserting invoices into KSeF <a id=\"post-449-BKM_9A507DC2_4F40_430C_AC2A_C4280427ACF9\"><\/a> <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/9.png\" alt=\"KSeF REST API - wyszukiwanie\" width=\"639\" height=\"319\" class=\"aligncenter size-full wp-image-645\" srcset=\"https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/9.png 639w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/9-300x150.png 300w, https:\/\/ksefapi.pl\/wp-content\/uploads\/2024\/04\/9-18x9.png 18w\" sizes=\"(max-width: 639px) 100vw, 639px\" \/><\/p>\r\n<p style=\"text-align: center;\">Figure: Error messages - search<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"QUERY_INVOICE_INIT_%E2%80%93_Wystapil_blad_podczas_inicjacji_procesu_wyszukiwania_faktur\"><\/span><a id=\"post-449-BKM_5736024C_DC45_4459_ADD1_D00D39621D24\"><\/a>QUERY_INVOICE_INIT \u2013 An error occurred while initiating the invoice search process<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1302 <strong>description<\/strong> = Failed to start invoice search process<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"QUERY_INVOICE_PARAMS_%E2%80%93_Bledne_kryteria_wyszukiwania\"><\/span><a id=\"post-449-BKM_74C732A8_4230_44F6_8AA1_78CF9CA73E71\"><\/a>QUERY_INVOICE_PARAMS - Incorrect search criteria<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1301 <strong>description<\/strong> = Incorrect or incomplete invoice search criteria<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"QUERY_INVOICE_RESULT_%E2%80%93_Wystapil_blad_podczas_pobierania_wynikow_wyszukiwania_faktur\"><\/span><a id=\"post-449-BKM_C2F6549E_7944_4356_B8FA_047AA593855E\"><\/a>QUERY_INVOICE_RESULT \u2013 An error occurred while retrieving invoice search results<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1304 <strong>description<\/strong> = Failed to fetch invoice search result<\/p>\r\n<h4><span class=\"ez-toc-section\" id=\"QUERY_INVOICE_STATUS_%E2%80%93_Wystapil_blad_podczas_sprawdzania_statusu_wyszukiwania_faktur\"><\/span><a id=\"post-449-BKM_8C805E80_0CA0_4D0E_B344_4201B636589A\"><\/a>QUERY_INVOICE_STATUS \u2013 An error occurred while checking the invoice search status<span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n<p><strong>code<\/strong> = 1303 <strong>description<\/strong> = Failed to get invoice search process status \u00a0<\/p>\r\n\r\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis: 100%;\"><\/div>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Components For the purposes of this documentation, 3 basic components have been adopted that participate in business processes related to handling invoices within the KSeF: System calling the KSeF REST API KSeF System Figure: Components System calling the Client&#039;s IT system that communicates with the KSeF System via the KSEF REST API interface. National System [\u2026]<\/p>","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-templates\/template-pagebuilder-full-width.php","meta":{"footnotes":""},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/pages\/784"}],"collection":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/types\/page"}],"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=784"}],"version-history":[{"count":8,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/pages\/784\/revisions"}],"predecessor-version":[{"id":810,"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/pages\/784\/revisions\/810"}],"wp:attachment":[{"href":"https:\/\/ksefapi.pl\/en\/wp-json\/wp\/v2\/media?parent=784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}