### Example NF-e XML Schema Structure This snippet demonstrates the basic structure of an NF-e XML Schema, including namespaces, imports of other schemas (like XMLDSig and basic types), and element definitions with annotations. ```xml Nota Fiscal Eletrônica ``` -------------------------------- ### SOAP Header Example (Deprecated in NF-e v4.0) This snippet illustrates the structure of a SOAP Header that was previously used for message control in NF-e Web Services. It contained 'versaoDados' and 'cUF' to manage message versions and origin SEFAZ. This method has been removed starting from NF-e version 4.0. ```xml string string ``` -------------------------------- ### Web Service - NFeConsultaCadastro Used to query the cadastro (registration) of a CNPJ/CPF to get information about a company. ```APIDOC ## POST /NFeConsultaCadastro ### Description This service is used to query the cadastro (registration) of a CNPJ/CPF. ### Method POST ### Endpoint /NFeConsultaCadastro ### Parameters #### Request Body - **Cadastro XML** (XML) - Required - The XML containing the CNPJ/CPF to be consulted. ### Request Example ```xml ``` ### Response #### Success Response (200) - **Response XML** (XML) - Contains the cadastro information. #### Response Example ```xml ``` ``` -------------------------------- ### Web Services Overview Complete list of available NF-e Web Services for electronic invoice management, including authorization, consultation, distribution, and event registration endpoints. ```APIDOC ## NF-e Web Services Available ### Web Service List #### Core Services - **NFeAutorizacao** - NF-e Authorization - **NFeRetAutorizacao** - Authorization Return Consultation - **NFeInutilização** - NF-e Sequence Number Inutilization - **NFeConsultaProtocolo** - Protocol Consultation - **NFeStatusServico** - Service Status - **NFeConsultaCadastro** - Taxpayer Database Consultation - **NFeDistribuicaoDFe** - Distribution of Documents - **NFeRecepcaoEvento** - Event Registration #### Event Types (NFeRecepcaoEvento) - **Cancelamento** - NF-e/NFC-e Cancellation - **Cancelamento por substituição** - Substitution Cancellation (NFC-e) - **Carta de Correção** - Correction Letter - **Manifestação do Destinatário** - Recipient Manifestation - **EPEC** - Contingency Electronic Invoice - **Pedido de Prorrogação** - Extension Request - **Transportador** - Carrier Information - **Comprovante de Entrega da NF-e** - Delivery Certificate - **Cancelamento Comprovante de Entrega** - Delivery Certificate Cancellation - **Eventos apuração do IBS e da CBS** - IBS and CBS Calculation Events - **Consulta GTIN** - GTIN Consultation ### Documentation Structure #### For Each Web Service 1. **Leiaute** - XML message structure and schema 2. **Regras de Validação** - Validation rules and business logic 3. **DANFE** - Document generation (Código de Barras and QR-code) 4. **Contingência** - Contingency procedures ### Document Types - **NF-e** - Electronic Invoice (normal mode) - **NFC-e** - Contingency Electronic Invoice ### Supported Features - Digital signature with X.509 certificates - Batch processing - Synchronous and asynchronous operations - Event-based communication - Protocol-based return tracking - Service status verification - Contingency mode operations ### Update Information - Manual version: Updated to NT 2024.003 v.1.08 - Publication date: 24/10/2025 - Project: Nota Fiscal Eletrônica (Electronic Invoice) - Regulatory body: SEFAZ (State Tax Administration) ``` -------------------------------- ### Exemplo de URL QR Code com CDATA Demonstra o formato de preenchimento da URL do QR Code para a NFC-e, utilizando a seção CDATA para lidar com caracteres reservados do XML como o '&'. Inclui o protocolo, endereço do site da UF e parâmetros concatenados. ```xml ``` -------------------------------- ### GET /event/cancel This endpoint allows the cancellation of a previously registered event. The request includes the necessary information to identify and cancel the specified event. ```APIDOC ## GET /event/cancel ### Description Cancels a previously registered event. ### Method GET ### Endpoint /event/cancel ### Parameters #### Path Parameters - **eventId** (string) - Required - The ID of the event to cancel. ### Request Example ```json { "eventId": "event_id" } ``` ### Response #### Success Response (200) - **response** (XML) - XML structure with the cancellation result. #### Response Example ```json { "response": "..." } ``` ``` -------------------------------- ### Exemplo de Requisição SOAP para NF-e Estrutura de mensagem SOAP 1.2 para requisição ao Web Service de recepção da NF-e. Inclui o cabeçalho com a versão dos dados e UF, e o corpo com os dados da mensagem XML. ```xml string string xml ``` -------------------------------- ### GET /api/epec/validate/cancellation-database Accesses the cancellation/inutilization database to verify if the EPEC numbering is marked as inutilized in the SEFAZ database. Returns rejection code 662 if the numbering has been inutilized. ```APIDOC ## GET /api/epec/validate/cancellation-database ### Description Accesses the inutilization database to check if the EPEC numbering is marked as inutilized in the SEFAZ database. This prevents reuse of cancelled or inutilized fiscal document numbers. ### Method GET ### Endpoint /api/epec/validate/cancellation-database ### Parameters #### Query Parameters - **uf** (string) - Required - State code (UF) of the emitter - **cnpj_cpf** (string) - Required - CNPJ or CPF of the emitter - **serie** (string) - Required - Series number - **numero** (string) - Required - Number of the fiscal document - **modelo** (integer) - Optional - Model number (default: 55) ### Request Example GET /api/epec/validate/cancellation-database?uf=PR&cnpj_cpf=12345678901234&serie=1&numero=123&modelo=55 ### Response #### Success Response (200) - **inutilized** (boolean) - Indicates if numbering is inutilized - **error_code** (integer) - Error code if inutilized (662) - **message** (string) - Descriptive message #### Response Example { "inutilized": false, "error_code": null, "message": "Numbering is available for use" } #### Error Response (200) { "inutilized": true, "error_code": 662, "message": "Rejeição: Numeração do EPEC está inutilizada na Base de Dados da SEFAZ" } ``` -------------------------------- ### GET /nfce/qrcode (Offline) This endpoint describes the URL structure for generating the QR Code in the offline (contingency) scenario. It outlines the parameters required to construct the URL for accessing NFC-e data. ```APIDOC ## GET /nfce/qrcode/?p=||||||| ### Description Generates a QR code URL for NFC-e in the offline contingency scenario. ### Method GET ### Endpoint /nfce/qrcode/ ### Parameters #### Query Parameters - **p** (string) - Required - Contains the parameters separated by '|'. See parameter details below. #### Parameters within the 'p' query parameter (Offline): - **chave_acesso** (string) - Required - 44 bytes - NFC-e access key. - **versao_qrcode** (string) - Required - 1 byte - QR Code version (e.g., "2"). - **tipo_ambiente** (string) - Required - 1 byte - Environment identifier (1 –Production, 2 –Homologation). - **dia_data_emissao** (string) - Required - 2 bytes - Day of the emission date. - **valor_total_nfce** (string) - Required - 15 bytes - Total value of the NFC-e. - **digVal** (string) - Required - 56 bytes - DigestValue of the NFC-e (SHA1). - **identificador_csc** (string) - Required - 1-6 bytes - CSC identifier. - **codigo_hash** (string) - Required - 40 bytes - Hash code of parameters (see section 3.3.2). ### Request Example ``` http:///nfce/qrcode/?p=||||||| ``` ### Response #### Success Response (200) - Returns a QR code image to be rendered. #### Response Example ``` QR Code Image ``` ``` -------------------------------- ### XML Signature Example for NF-e This XML snippet provides a sample structure for signing the NF-e document. It shows the placement of the signature, signed info, and key information, including the certificate. The signature process involves canonicalization, signature method, reference, transforms, digest method, and digest value. ```XML ... vFL68WETQ+mvj1aJAMDx+oVi928= IhXNhbdL1F9UGb2ydVc5v/gTB/y6r0KIFaf5evUi1i ... MIIFazCCBFOgAwIBAgIQaHEfNaxSeOEvZGlVDANB ... ``` -------------------------------- ### GET /nfce/qrcode (Online) This endpoint describes the URL structure for generating the QR Code in the online (non-contingency) scenario. It outlines the parameters required to construct the URL for accessing NFC-e data. ```APIDOC ## GET /nfce/qrcode?p=|||| ### Description Generates a QR code URL for NFC-e in the online scenario. ### Method GET ### Endpoint /nfce/qrcode ### Parameters #### Query Parameters - **p** (string) - Required - Contains the parameters separated by '|'. See parameter details below. #### Parameters within the 'p' query parameter (Online): - **chave_acesso** (string) - Required - 44 bytes - NFC-e access key. - **versao_qrcode** (string) - Required - 1 byte - QR Code version (e.g., "2"). - **tipo_ambiente** (string) - Required - 1 byte - Environment identifier (1 - Production, 2 - Homologation). - **identificador_csc** (string) - Required - 1-6 bytes - CSC identifier. - **codigo_hash** (string) - Required - 40 bytes - Hash code of parameters (see section 3.3.1). ### Request Example ``` http:///nfce/qrcode?p=|||| ``` ### Response #### Success Response (200) - Returns a QR code image to be rendered. #### Response Example ``` QR Code Image ``` ``` -------------------------------- ### Web Service - NFeDistribuicaoDFe Allows the distribution of DFe (Documentos Fiscais Eletrônicos) to interested parties. ```APIDOC ## POST /NFeDistribuicaoDFe ### Description This service handles the distribution of DFe (Documentos Fiscais Eletrônicos). ### Method POST ### Endpoint /NFeDistribuicaoDFe ### Parameters #### Request Body - **Distribuicao XML** (XML) - Required - The XML containing the distribution request parameters. ### Request Example ```xml ``` ### Response #### Success Response (200) - **Response XML** (XML) - Contains the distribution results. #### Response Example ```xml ``` ``` -------------------------------- ### Exemplo de Retorno SOAP da NF-e Estrutura de mensagem SOAP 1.2 para o retorno do Web Service de recepção da NF-e. Contém o cabeçalho com informações de versão e UF, e o corpo com o resultado da operação. ```xml string string xml ```