1. Inicio
  2. Documentos
  3. NS CTe (English)
  4. CTe Issue
  5. Issue

Issue

The CT-e issuance service is responsible for validation the CT-e data sent according to the data types defined by Sefaz’s XML schemas and sending the document for processing in the WebService of the Portal da Secretaria da Fazenda.

The return from this service contains the receipt information of the CT-e by Sefaz or the error list in case of errors during the processing.

Due to the authorization process of a CT-e at Sefaz being carried out through the request of several asynchronous services and the minumum time required by Sefaz of 15 seconds of waiting between sending the CT-e and the Situation Consult, this method returns only the receipt confirmation of the CT-e by Sefaz or error messages if any information does not pass validation against the XML schema. To find out if the CT-e was authorized or not, it’s necessary to carry out the consult through the CT-e Processing Status method.

Fields auto-filled by the API

The list below presents the fields and attributes of the issuance layout that will be automatically filled in by the API if they are not sent:

  • Id (attribute of the infNFe tag)
  • cDV
  • dhCont
  • xJust
URL

Production CT-e 3.00: POST https://cte.ns.eti.br/cte/issue

Production CT-e OS: POST https://cte.ns.eti.br/cte/issueos

Input data

The CT-e data for the issuance method must be sent in JSON or in TXT.

Sending data in JSON format

To send data in JSON, the Content-Type of the request must be defined as application/json.

X-AUTH-TOKENUser access token
CTeGeneric data of the CT-e (according to the Sefaz Contributors’ Guidance Manual)
infModalSpecific data of the CT-e modal (according to the Sefaz Contributors’ Guidance Manual)

By clicking on the file below it’s possible to download a complete example of CT-e in JSON format:

Sending data in XML format

To send data in XML, the Content-Type of the request must be defined as application/xml and the X-AUTH-TOKEN must be sent in the HTTP header.

When sending in XML format, the request body must contains the XML content with the CT-e informations. This content must be generated from the layout of the Sefaz Contributors’ Guidance Manual.

By clicking in the file below it’s possible to download a complete example of CT-e in XML format.

Sending data in TXT format

To send data in TXT, the Content-type of the request mus be defined as text/plain;charset=utf-8.

When sending in TXT format, the request body must contain the TXT content with the CT-e information. This content must be generated from the layout of the TXT issued by the News Systems local integrator.

By clicking on the file below it’s possible to download a complete example of CT-e in TXT format:

Request example
CT-e issue request in JSON
curl -X POST \
    -H "Content-Type: application/json" \
    -d '{
      "X-AUTH-TOKEN":"...",
      "CTe":{...}, 
      "infModal":{...}
     }' \
    https://cte.ns.eti.br/cte/issue
CT-e issue request in TXT
curl -X POST \
    -H "Content-Type: text/plain" \
    -d 'CONHECIMENTO|1| \
        A|3.00|CTe|' \
     https://cte.ns.eti.br/cte/issue
Returned data
FieldDescriptionData TypeOccurrenceParentNotes
statusProcessing status codeInt1-1
motivoProcessing status literal descriptionString1-1
chCTeCT-e access keyInt0-1Only when status = 200
nsNRecReceipt number by NS CT-e APIInt0-1Only when status = 200, -6 or -7
errosArray containing the error list during the validation of the CT-e information according to the data typeArray0-1Only when status = -4
erroObject containing the information error of the processingObject0-1Only when status = -9
cStatError codeInt1-1erro
xMotivoError literal descriptionString1-1erro
Return example

Successful return

{
  "status": 200,
  "motivo": "CT-e enviado para Sefaz",
  "chCTe": "43151212936129000195570000000009451000009454",
  "nsNRec": "631034008736114"
}

Return with data error

{
  "status": -4,
  "motivo": "Modal invalido de acordo com a validacao contra schema",
  erros": [
        "O campo 'dhEmi' foi preenchido incorretamente com o valor '2020-04-10T11:30:04'. Este campo deve ser preenchido com data no seguinte formato: 'AAAA-MM-DDThh:mm:ss TZD (Ex.: 2010-            08-19T13:00:15-03:00)'. (cvc-pattern-valid: Value '2017-11-10T11:30:04' is not facet-valid with respect to pattern '(((20(([02468][048])|([13579][26]))-02-29))|(20[0-9][0-9])-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30)))))T(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d([\\-,\\+](0[0-9]|10|11):00|([\\+](12):00))' for type '#AnonType_dhEmiideinfCteTCTe'.)"
    ]
}
Return codes
CodeDescription
200CT-e sent successfully
-2CT-e not informed or empty (e.g.: {})
-3infModal not informed or empty (e.g.: {})
-4Information error according to data type
-5Non-existent validation schema for the informed CT-e version in CTe/infCTe/versao
-6Document already received, but still without processing status. Please, consult the reported nsNRec processing status
-7Document already received and authorized. Please, consult the processing status of the informed nsNRec
-8It was not possible to load the sent data
-9Error sending data to Sefaz. Verify the "erro" object for more information
-10Error obtaining URL from QRCode
-11Issuance with signed XML must contain QRCode information
-12Issuance with signed XML must have the verProc value finalized in NS+API

Como podemos ajudar?