The Webmania® REST API issues the CT-e and the CT-e OS at SEFAZ, the state tax authority. It creates the XML and the DACTE (the printable summary of the CT-e) and sends the result by notification. It also registers the events of each document: cancellation, correction letter, delivery confirmation and payment link. To start, read the Quick guide. To issue other document types, see all the APIs.
What is the CT-e? The CT-e (Conhecimento de Transporte Eletrônico) is the electronic freight bill: the tax document of a transport service. The carrier issues it for each freight job. It names who sends the cargo, who receives it and who pays for the freight (the tomador); see Parties. The API issues both models at the same endpoint, and the modelo field sets which one:
For cargo transport, in one of the six transport modes: road, air, water, rail, pipeline or multimodal. Send modelo = cte; see Issuing a CT-e.
For the transport of passengers, valuables or excess baggage, by road. Send modelo = cte_os, with the tomador (payer) object; see Issuing a CT-e OS.
Brazilian tax terms you will see. They keep their Brazilian names in the payload and on the CT-e:
SEFAZ: the state tax authority. It authorizes each CT-e and answers with a status code; 100 = authorized.
DACTE: the printable summary of the CT-e that travels with the cargo; the legal document is the XML.
CFOP: the 4-digit code that says what kind of transaction it is (first digit 5 = inside the state, 6 = to another state). Field impostos.cfop.
ICMS: the state tax on transport between cities or states, tax base × rate. Group impostos.icms; its CST (tax status code) goes in classificacao_tributaria.
RNTRC / ANTT: the carrier's registration with ANTT, the national land transport agency. Field rntrc of the road mode.
CNPJ / CPF / IE: the company ID (14 digits), the individual taxpayer ID (11 digits) and the state registration of each party.
IBS / CBS / cClassTrib: the new taxes of the tax reform and the code that says how they apply; see Tax reform.
Every term in plain English: glossary of Brazilian tax terms.
Send every API request over encrypted HTTPS to https://api.webmania.com.br. The /2/ prefix means you are using version 2.0 of the API.
| URL | HTTP Verb | CT-e | CT-e OS | Function |
|---|---|---|---|---|
/2/cte/emissao | POST | Available | Available | Issue a CT-e |
/2/cte/emissao/simplificada | POST | Available | Not available yet | Simplified CT-e issuing |
/2/cte/entrega | POST | Available | Not used | Add the delivery event to the CT-e |
/2/cte/correcao | POST | Available | Available | Add a correction letter to the CT-e |
/2/cte/evento | POST | Available | Available | Link a payment to the CT-e (event 110300) |
/2/cte/consulta/{identifier} | GET | Available | Available | Look up a CT-e by UUID (36 characters) or access key (44 characters) |
/2/cte/consulta/evento/{identifier} | GET | Available | Available | Look up the payment events of the CT-e |
/2/cte/cancelar | PUT | Available | Available | Cancel a CT-e |
/2/cte/entrega/cancelar | PUT | Available | Not used | Cancel the delivery event of the CT-e |
/2/cte/evento/cancelar | PUT | Available | Available | Cancel a payment link (event 110301) |
Responses are in JSON. Send Authorization: Bearer YOUR_ACCESS_TOKEN in every call and Content-Type: application/json in calls with a body; see Authentication.
Check both the HTTP status and the JSON body of the response. Validation errors can return HTTP 200 with the error field. An HTTP 2xx status does not prove the tax authorization: follow the status and motivo fields of the CT-e. For example, an authentication failure returns HTTP 401 with this message ("Restricted access. Token missing or invalid."):
{
"error": "Acesso restrito. Token não informado ou inválido."
} How to integrate the CT-e:
Authorization header. modelo field sets which one. /2/cte/emissao, with ambiente = 2 (sandbox) for tests. The response has the uuid of the CT-e; store it in your system. url_notificacao when the CT-e is authorized, rejected, denied or canceled. xml and dacte URLs of the response. The CT-e (the electronic freight bill) and the CT-e OS (the bill for passenger, valuables and excess baggage transport) are issued at the same endpoint, POST /2/cte/emissao. The service you provide decides which document to issue:
| What changes | CT-e | CT-e OS |
|---|---|---|
| What it is for | Cargo transport | Transport of passengers, valuables or excess baggage |
modelo | cte | cte_os |
servico.tipo | Optional: 0 to 4, with 0 (Normal) as the default | Required: 6, 7 or 8 |
| Transport mode | All six in Transport modes | Road (modalidade = 1) |
tomador (payer) | Required when indicador_tomador = 4 | Always required |
| Simplified issuing | Available, from the XML of an NF-e | Not available |
| Delivery confirmation | Available | Not available |
| Issuing fields | Issuing a CT-e | Issuing a CT-e OS |
Every CT-e and CT-e OS gets a uuid as soon as the API accepts the issuing request. From then on, it goes through the statuses below. They appear in the response, in the lookup and in the notifications:
processando and contingencia statuses are not notified and do not prove authorization: follow the CT-e through the lookup, without issuing it again. SEFAZ can also deny the use of the CT-e (denegado); see the table below.| Status | What it means | What to do |
|---|---|---|
processando | SEFAZ has not given the result of the CT-e yet. | Wait for the notification or look up the CT-e. Do not issue it again. |
contingencia | SEFAZ and the SVC (its backup authorization servers) are unavailable. Webmania sends the CT-e again automatically when the connection comes back, after checking SEFAZ. | Follow the same uuid, without issuing again. See Contingency. |
aprovado | SEFAZ authorized the CT-e; the XML and the DACTE are available. | Download the XML and the DACTE. Register the events you need or, if the service does not take place, cancel it. |
reprovado | SEFAZ rejected the CT-e; motivo has the response. | Fix the data pointed out in motivo and issue a new CT-e. |
denegado | SEFAZ denied the use of the CT-e; motivo has the response. | Do not use this CT-e. Read the motivo before you issue again. |
cancelado | SEFAZ approved the cancellation. | Do not use this CT-e for the transport service. |
After the authorization, the CT-e accepts the events below. All of them need a CT-e with status aprovado:
| Event | Endpoint | What changes |
|---|---|---|
| Cancellation | PUT /2/cte/cancelar | The CT-e becomes cancelado. |
| Correction letter | POST /2/cte/correcao | The CT-e stays aprovado; the CC-e has its own XML and DACCE (the printable summary of the correction letter). |
| Delivery confirmation | POST /2/cte/entrega | CT-e only. The CT-e stays aprovado; the confirmation can be canceled. |
| Payment link | POST /2/cte/evento | The CT-e stays aprovado; the link can be canceled and looked up. |
The CT-e is issued in one of six transport modes, chosen in modalidade. Each mode has its own object in the request. In the air, water, rail, pipeline and multimodal modes, the object is required when you choose that modalidade.
| Transport mode | modalidade | Object | Fields |
|---|---|---|---|
| Road (trucks) | 1 | rodoviario | Road · for the CT-e OS, Road (CT-e OS) |
| Air (aircraft) | 2 | aereo | Air |
| Water (ships and barges) | 3 | aquaviario | Water |
| Rail (trains) | 4 | ferroviario | Rail |
| Pipeline | 5 | dutoviario | Pipeline |
| Multimodal (two or more modes) | 6 | multimodal | Multimodal |
Take this reference to your AI assistant, integrate the API with an official SDK, or start from the ready-made modules and examples.
Send an AI the section index of this reference: it reads the index and fetches only the sections it needs, in Markdown. The Markdown is in Portuguese; the assistant can answer in English.
Official open-source SDKs on GitHub to integrate the Webmania APIs in the language of your project. Each repository includes installation, examples and the operations it covers.
Node.js / TypeScript Available
git clone https://github.com/
Python Available
git clone https://github.com/
PHP Available
git clone https://github.com/
Perl Available
git clone https://github.com/
Go Available
git clone https://github.com/
C Available
git clone https://github.com/
C++ Available
git clone https://github.com/
Lua Available
git clone https://github.com/
Dart Available
git clone https://github.com/
R Available
git clone https://github.com/
Java Available
git clone https://github.com/
Kotlin Available
git clone https://github.com/
Scala Available
git clone https://github.com/
Clojure Available
git clone https://github.com/
Ruby Available
git clone https://github.com/
.NET (C#) Available
git clone https://github.com/
PowerShell Available
git clone https://github.com/
Elixir Available
git clone https://github.com/
Rust Available
git clone https://github.com/
Haskell Available
git clone https://github.com/
Swift Available
git clone https://github.com/
Test the CT-e REST API without writing a line of code, and speed up your integration with the official Webmania® tools.
To use the API, authenticate every request with an HTTP header. Use the Authorization header in this format:
Authorization: Bearer {Access-Token} You find the API 2.0 Access-Token in the Webmania® Panel. Include it in every request. Send the request body in JSON, with the Content-Type and Accept headers set to application/json.
Keep your credentials safe. Never publish the Access Token in the source code of a website, app or system where other people can easily read it.
For mobile apps (iOS and Android), we recommend issuing the documents on your server (back end). The app code should only send the request; the processing should happen on your server.
To keep your platform up to date, Webmania® sends automatic notifications (webhooks) for every result of the CT-e and the CT-e OS. With them, you do not need to build a routine of periodic lookups: wait for the webhook and update the document in your system when it arrives.
The notification is sent by POST, in JSON, to the URL in url_notificacao of the issuing request. Without this parameter, it goes to the notification URL registered for the company. Use the uuid to identify the CT-e and update your database.
| Notified status | When it is sent |
|---|---|
aprovado | SEFAZ authorized the CT-e; the body has the chave, the xml and the dacte. |
reprovado | SEFAZ rejected the CT-e; the body has the motivo. |
denegado | SEFAZ denied the use of the CT-e; the body has the motivo. |
cancelado | The cancellation was approved; the body has the xml_cancelamento. |
processando and contingencia statuses are not notified. In these cases, do not issue the CT-e again: wait for the next notification or check the result in the lookup.What is the UUID? The UUID (Universally Unique Identifier) is a unique 36-character ID, in the 8-4-4-4-12 format, that Webmania gives to each CT-e.
It is created as soon as our API receives the request successfully, that is, after it passes our validations and before anything is sent to SEFAZ. So the UUID exists whatever the status of the CT-e at SEFAZ: it applies to aprovado, reprovado, cancelado, processando and contingencia.
Once created, the UUID is permanent: it does not change on retries, contingency or resending. The access key is a different field and can change. So use the UUID, not the access key, as your reference in the database.
The notification body has the same format as the CT-e lookup:
| Parameter | Type | Description |
|---|---|---|
uuid | string | Unique ID of the CT-eUse the UUID to match the notification you receive. |
chave | string or null | Access key of the CT-e at SEFAZ, when available. |
serie | number or null | Series of the document, when assigned. |
cte | number or null | CT-e number Managed automatically by the issuer. It can be null while no number is assigned. |
status | string | Status of the CT-e; see the lifecycle.aprovado |
motivo | string or null | Reason for the status, when available.E.g.: Autorizado o uso do CT-e (use of the CT-e authorized) |
modelo | string | Document model: cte or cte_os. |
epec | boolean | Tells whether the document was issued in EPEC. Learn more |
xml | string | URL of the CT-e XML |
xml_cancelamento | string | URL of the XML of the canceled CT-eAvailable only for a canceled CT-e. |
dacte | string | URL of the DACTE (the printable summary of the CT-e) |
log | object or array | SEFAZ response or validation details. It can be an empty array while there is no response. |
The notification is sent with the POST method, in application/json format:
-X POST \
-header "Content-type: application/json" \ Example of a notification for an authorized CT-e:
{
"uuid": "00000000-0000-0000-0000-000000000000",
"chave": "00000000000000000000000000000000000000000000",
"serie": 1,
"cte": 123,
"status": "aprovado",
"motivo": "Autorizado o uso do CT-e",
"epec": false,
"xml": "https://api.webmania.com.br/xmlcte/[chave]",
"dacte": "https://api.webmania.com.br/dacte/[chave]",
"log": {}
} The CT-e (the electronic freight bill) documents a cargo transport service in one of the six transport modes. Send the data in the request body, in JSON, with modelo = cte. To reuse the data of an NF-e (electronic invoice) that was already issued, use simplified issuing.
To issue a CT-e, send a POST request to /2/cte/emissao.
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ambiente": 1,
"modelo": "cte",
"modalidade": 1,
...
}' \
https://api.webmania.com.br/2/cte/emissao The example below shows the structure of a request in the sandbox (ambiente: 2). Replace the sample data and complete the required groups and the taxes that apply to the transaction before you send it.
{
"ambiente": 2,
"finalidade": "0",
"natureza_operacao": "Prestação de serviço de transporte - interestadual",
"modalidade": "1",
"modelo": "cte",
"data_emissao": "2023-10-27 09:21:22", // Optional. Replace with a date within the last 168 hours
"inscricao_suframa": "123456789", // Optional. SUFRAMA registration of the issuer. Omit it if there is none
"local_inicio_prestacao": {
"cidade": "Curitiba",
"uf": "PR"
},
"local_termino_prestacao": {
"cidade": "São Paulo",
"uf": "SP"
},
"contribuicao_tomador": "9",
"indicador_tomador": "0",
"entrega": {
"data_inicial": "2023-10-27 09:21:22"
},
"pagamento_antecipado": {
"tipo": 3, // Optional. 1 = this CT-e is itself the advance payment (credit); 3 = payment made earlier
"chaves": ["13260706074104000127570010000001231210730009"] // Sample 44-digit key. Replace it with the real key of the advance payment document, issued by the same CNPJ as the issuer. Required when tipo=3 and not allowed when tipo=1
},
"impostos": {
"cfop": "0000",
"classificacao_tributaria": "00",
"ibs_cbs": {
"cbs": {
"alc_zfm_cbs": {
"aliquota_efetiva_referencia": "8.8000" // Effective reference rate (% with 4 decimal places) for the ZFM/ALC regime
}
}
}
},
"remetente": {
"nome_razao": "Remetente Carga",
"cnpj": "00000000000000",
"nome_fantasia": "Rementente",
"telefone": "11999999999",
"endereco": "Rua Exemplo",
"numero": "321",
"complemento": "Edifício",
"bairro": "Jardim",
"cep": "82400000",
"cidade": "Curitiba",
"uf": "PR"
},
"destinatario": {
"nome_razao": "Destinatario Carga",
"cnpj": "00000000000000",
"telefone": "11999999999",
"endereco": "Rua Exemplo",
"numero": "123",
"bairro": "Jardim",
"cidade": "São Paulo",
"cep": "01153000",
"uf": "SP"
},
"servico": {
"tipo": 0,
"valor_total": 100,
"valor_recebido": 100
},
"carga": {
"valor_total": 100,
"produto_predominante": "Chocolate",
"quantidades": [
{
"unidade_medida": "1",
"tipo_medida": "LITROS",
"quantidade": 2
}
]
},
"documentos_fiscais": [
{
"tipo": "1",
"chave": "00000000000000000000000000000000000000000000"
}
],
"rodoviario": {
"rntrc": "00000000"
}
} Example of an HTTP 200 response with the fields uuid, chave, serie, cte, status, motivo, modelo, epec, xml, dacte and log, described in Notification fields. HTTP 200 does not confirm the authorization: check the status in the lifecycle.
{
"uuid": "00000000-0000-0000-0000-000000000000", // Unique ID
"chave": "00000000000000000000000000000000000000000000", // Access key at SEFAZ
"serie": 1, // CT-e series
"cte": 123, // CT-e number
"status": "aprovado", // aprovado, reprovado, cancelado, processando, contingencia or denegado
"motivo": "Autorizado o uso do CT-e", // Reason for the status
"modelo": "cte", // Document model
"epec": false, // Whether the EPEC event was issued
"xml": "https://api.webmania.com.br/xmlcte/[chave]",
"dacte": "https://api.webmania.com.br/dacte/[chave]",
"log": {} // Sample object of the SEFAZ response; it can be [] while there is no response
} The final result is sent by POST to the url_notificacao; see Notifications.
The CT-e has six transport modes, one for each way of carrying the cargo: Road, Air, Water, Rail, Pipeline and Multimodal (more than one mode under a single contract). Each mode has its own group of fields, sent in the parameters rodoviario, aereo, aquaviario, ferroviario, dutoviario and multimodal.
Fill in the fields that apply to your document. Some parameters have more details: click the parameter name to see them. The table below lists the fields for issuing a CT-e in the Standard and Simplified formats.
The Webmania CT-e API offers two ways to issue the document: Standard and Simplified. In Standard issuing, you send all the information of the document. In Simplified issuing, you reuse the information of an NF-e that was already issued. Send the XML of that NF-e in the nfe_xml parameter, as a string encoded in base64. The data reused from the NF-e depends on the fields used when the NF-e was issued, such as the sender, the recipient, the cargo value, the start and end locations of the service and the other information documented in the table below.
After the import, the content follows the rules of Standard issuing. Required fields that the XML does not fill in are still required. The examples below are partial samples, not a complete issuing request.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
ID | Optional | Optional | string | 1-15 | Purchase order number or processing ID Tracks issuing requests by order or processing ID. Learn more (in Portuguese) |
ambiente | Required | Required | integer | 1 | SEFAZ environment 1 - Production |
url_notificacao | Optional | Optional | string | - - - | Notification URL for every status update of the CT-e |
nfe_xml | Simplified issuing only | Required | string | - - - | XML of the NF-e to import, encoded in base64 |
modelo | Required | Required, modelo cte | string | - - - | Model of the document to issue; send cte |
modalidade | Required | Required | integer | 1 | Transport mode of the document 1 - Road |
natureza_operacao | Required | Required | string | 1-60 | Description of the nature of the transaction |
finalidade | Required | Required | string | 1 | Type of CT-e0 - Normal |
data_emissaoNEW | Optional | Optional | string | - - - | Issue date and time of the documentRecommended format: |
cte_referenciado | Required when finalidade is 1 or 3. | Required when finalidade is 1 or 3. | string | 44 | Access key of the CT-e that this document replaces or complements |
contribuicao_tomador | Required | Required | integer | 1 | ICMS (state sales tax) taxpayer type of the payer (tomador) of the service 1 - ICMS taxpayer |
indicador_tomador | Required | Required | integer | 1 | Which party is the payer (tomador) of the CT-e 0 - Sender (remetente) |
alteracao_tomador | Optional | Optional | boolean | 1 | Tells whether the payer changed in a replacement CT-e.The API can calculate it when it finds the referenced CT-e with the data needed to compare the payer. |
globalizadoNEW | Optional | In simplified issuing, the API sets false | boolean | 1 | Tells whether the CT-e is a consolidated (globalizado) CT-e. |
informacao_globalizadoNEW | Optional | Optional | string | 15-256 | Information about the consolidated CT-e. Fill in additional information, the law of the special regime, and so on. |
servico | Required | Required | object | - - - | Information about the service provided |
carga | Required | Required after the import; send the required fields that the NF-e does not provide | object | - - - | Information about the cargo being carried |
documentos_fiscais | Required, except when modalidade is 6 | Optional; the imported NF-e is used | array | - - - | Array with the information of the documents the cargo travels with |
local_inicio_prestacao | Required | Optional; the pickup location of the NF-e is used when present, otherwise the address of the issuer | object | - - - | Start location of the service |
local_termino_prestacao | Required | Optional; the delivery location of the NF-e is used when present, otherwise the address of the recipient | object | - - - | End location of the service |
remetente | Required | Optional; the sender is taken from the NF-e | object | - - - | Sender of the cargo |
destinatario | Required | Optional; the recipient is taken from the NF-e | object | - - - | Recipient of the cargo |
tomador | Required when indicador_tomador is 4 | Required when indicador_tomador is 4 | object | - - - | Payer of the service Required when the indicador_tomador parameter is 4 |
expedidor | Required when indicador_tomador is 1 | Required when indicador_tomador is 1; it can be taken from the pickup location of the NF-e | object | - - - | Shipper of the cargo |
recebedor | Required when indicador_tomador is 2 | Required when indicador_tomador is 2 | object | - - - | Receiver of the cargo |
entrega | Optional | Optional | object | - - - | Expected delivery date and time |
observacoes_contribuinte | Optional | Optional | array | - - - | Free-form additional notes of the taxpayer |
observacoes_fisco | Optional | Optional | array | - - - | Free-form additional notes for the tax authority |
detalhes_retirada | Optional | Optional | string | 1-160 | Additional information about the cargo pickup |
caracteristica_transporte | Optional | Optional | string | 1-15 | Additional feature of the transport. Examples: REENTREGA (redelivery), DEVOLUÇÃO (return) and REFATURAMENTO (rebilling) |
caracteristica_servico | Optional | Optional | string | 1-30 | Additional feature of the service. Examples: ENTREGA EXPRESSA (express delivery), LOGÍSTICA REVERSA (reverse logistics), CONVENCIONAL (standard) and EMERGENCIAL (emergency) |
observacoes_gerais | Optional | Optional | string | 1-2000 | Additional information of the document |
informacoes_adicionais_fisco | Optional | Optional | string or null | up to 2000 | Additional information for the tax authority |
inscricao_suframa | Optional | Optional | string | 8-9 | SUFRAMA registration of the issuer (SUFRAMA is the Manaus Free Trade Zone authority) |
pagamento_antecipado | Optional | Optional | object | - - - | Advance payment of the transport serviceWhen tipo=1, this CT-e is itself the advance payment. When tipo=3, send the access keys of the documents whose payment was made earlier. |
Send the details of the transport service in the servico object.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
valor_total | Required | Required | decimal | 13v2 | Total value of the service0.00 |
valor_recebido | Required | Required | decimal | 13v2 | Amount received for the service0.00 |
tipo | Optional | Optional | integer | 1 | Type of service provided. 0 - Normal (default) |
componentes | Optional | Optional | object | --- | Components of the service price Send an object where each key is the name of a price component and each value is the amount of that component |
Example fragment with the service values of the CT-e:
{
"servico": {
"valor_total": 12000,
"valor_recebido": 9500,
"componentes": {
"FRETE PESO": 8000
}
}
}Send the cargo details in the carga object. Its fields follow the rules in the table below.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
valor_total | Required, except when modalidade is 5 | Taken from the NF-e when available; required after the import, except in mode 5 (pipeline) | decimal | 13v2 | Total value of the cargo, from 0 to 9999999999999.99 |
produto_predominante | Required | Optional; the product with the largest volume on the NF-e is used | string | 1-60 | Description of the main product in the cargo |
valor_averbacao | Optional | Optional | decimal | 13v2 | Value of the cargo registered with the insurer (averbação) |
caracteristicas | Optional | Optional | string | 1-30 | Additional cargo feature Examples: Fria (cold), Granel (bulk) or Refrigerada (refrigerated) |
quantidades | Required | Taken from the gross weight or the number of packages on the NF-e when available; required after the import | array | 1-n | Quantities of the cargo |
fluxo | Required in the air mode | Required in the air mode | object | - - - | Planned cargo flow |
Example of the cargo on the CT-e:
{
"carga": {
"valor_total": 100,
"produto_predominante": "Chocolate",
"quantidades": [
{
"unidade_medida": "4",
"tipo_medida": "LITROS",
"quantidade": 2
}
]
}
}Send the quantities of the cargo in the quantidades array. Each item is an object.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
quantidade | Required | Taken from the NF-e when available; required after the import | decimal | 11v4 | Quantity of the cargo item, from 0 to 99999999999.9999. |
unidade_medida | Required | Taken from the NF-e when available; required after the import | string | 1 | Unit of measure of the cargo item.0 - M3 (cubic meters) |
tipo_medida | Required | The NF-e data is used when available. | string | 1-20 | Type of measure of the cargo item, in free text.Examples: PESO BRUTO (gross weight), PESO DECLARADO (declared weight), LITRAGEM (volume in liters), CAIXAS (boxes), etc. |
Example of the cargo quantities on the CT-e:
{
"carga": {
"quantidades": [
{
"unidade_medida": "4",
"tipo_medida": "LITROS",
"quantidade": 2
}
]
}
}Send the planned cargo flow in the carga.fluxo object.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
origem | Required in the air mode | Required in the air mode | string | 1-60 | Abbreviation or internal code of the origin branch, port, station or airport. |
passagens | Optional | Optional | array | 0-n | Array of strings with the abbreviation or internal code of each branch, port, station or airport the cargo passes through. Each string has 1 to 15 characters. |
destino | Required in the air mode | Required in the air mode | string | 1-60 | Abbreviation or internal code of the destination branch, port, station or airport |
rota | Optional | Optional | string | 1-10 | Delivery route code |
Send the start and end locations of the transport service in the local_inicio_prestacao and local_termino_prestacao objects. Their fields follow the rules below.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
cidade | Required when cod_ibge is not sent or when cod_ibge is 5300108 (DF) | Taken from the NF-e when available; the same rule applies after the import | string | - - - | City nameSend 'EXTERIOR' for transport to or from another country. |
uf | Required when cod_ibge is not sent | Optional; the address on the NF-e is used | string | 2 | State abbreviation (UF)Send 'EX' for transport to or from another country. |
cod_ibge | Required when cidade is not sent | Optional; the address on the NF-e is used | string | 7 | Official city code (IBGE)Send 9999999 for transport to or from another country. |
Example of the start and end locations of the service on the CT-e:
{
"local_inicio_prestacao": {
"cidade": "Curitiba",
"uf": "PR",
"cod_ibge": "4106902"
},
"local_termino_prestacao": {
"cidade": "Rio de Janeiro",
"uf": "RJ",
"cod_ibge": "3304557"
}
} The parties of the CT-e are the individuals or companies that play a role in the freight job. A party can be the sender, the recipient, the shipper, the receiver or the payer. Send them in the remetente, destinatario, expedidor, recebedor and tomador objects, in this order, following the rules below. The sender sends the cargo; it is usually the seller on the NF-e. The recipient is the party the cargo is addressed to. The shipper hands the cargo to the carrier when it is not the sender. The receiver takes the cargo from the carrier when it is not the recipient. The payer pays for the transport service.
nome_razao is required for the sender and the recipient, and for the payer when indicador_tomador = 4. For the shipper and the receiver, this field is optional. When you send it, also send endereco, numero and bairro. These three address fields are required for the sender, the recipient and the payer with indicador_tomador = 4. For a Brazilian party with nome_razao, send cep, cidade, uf and either cpf or cnpj, never both. In simplified issuing, the same rules apply to the data imported from the XML.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
cnpj | Required for a company | Required for a company | string | 14 | CNPJ, the 14-digit company ID (each branch has its own)Do not send for a foreign party |
cpf | Required for an individual | Required for an individual | string | 11 | CPF, the 11-digit individual taxpayer IDDo not send for a foreign party |
nome_razao | Required for remetente, destinatario and tomador with indicador_tomador = 4; optional for expedidor and recebedor | The same rules apply after the XML import | string | 2-60 | Name or company name |
nome_fantasia | Optional | Optional | string | 2-60 | Trade name of the company |
ie | Optional | Optional | string | 0-14 | IE (Inscrição Estadual), the state registration number of a company that pays ICMS |
email | Optional | Optional | string | - - - | Email address |
telefone | Optional | Optional | string | 6-14 | Phone number |
endereco | Required depending on the party role and on nome_razao, as described above | The same rules apply after the XML import | string | 2-255 | Street |
numero | Required depending on the party role and on nome_razao, as described above | The same rules apply after the XML import | string | 1-60 | Street number |
complemento | Optional | Optional | string | 1-60 | Address complement (suite, floor) |
bairro | Required depending on the party role and on nome_razao, as described above | The same rules apply after the XML import | string | 2-60 | District (neighborhood) |
cep | Required for a Brazilian party with nome_razao | Required for a Brazilian party with nome_razao after the import | string | 8-9 | Postal code (CEP)Do not send for a foreign party |
cidade | Required for a Brazilian party with nome_razao; the postal code (CEP) lookup may update the value | The same rules apply after the XML import | string | 2-255 | City nameDo not send for a foreign party |
uf | Required for a Brazilian party with nome_razao; the postal code (CEP) lookup may update the value | The same rules apply after the XML import | string | 2 | State abbreviation (UF)Do not send for a foreign party |
codigo_pais | Required for a foreign party | Required for a foreign party | string | 1-4 | Country code from the list of the Brazilian Central Bank (BACEN) Example: Brazil = 1058 |
pais | Required for a foreign party | Required for a foreign party | string | 2-60 | Name of the foreign country |
Example fragment with one party of the CT-e. It is not a complete request. Replace the CPF with the real data of the recipient before you use it:
{
"destinatario": {
"nome_razao": "Destinatário Carga",
"cpf": "00000000000",
"telefone": "47999999999",
"endereco": "Rua Naftali Reiss",
"numero": "415",
"complemento": "Residência",
"bairro": "Bacacheri",
"cep": "80035040",
"cidade": "Curitiba",
"uf": "PR"
}
} Example of a foreign party on the CT-e:
{
"destinatario": {
"nome_razao": "ACME S.A.",
"endereco": "Av. Libertador",
"numero": "1200",
"bairro": "Centro",
"codigo_pais": "639",
"pais": "Argentina"
}
}The optional entrega object holds the planned delivery of the CT-e in the data, data_inicial and data_final fields. Send data for a fixed date, or data_inicial and/or data_final for a period. Do not send data together with data_inicial or data_final. The fields are validated as dates; the formats below are input examples.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
data | Optional; do not send together with data_inicial or data_final | Optional; do not send together with data_inicial or data_final | string (date) | --- | Delivery date, for delivery on a fixed date, as a date or a date and timeY-m-d or Y-m-d H:i:s |
data_inicial | Optional; do not send together with data | Optional; do not send together with data | string (date) | --- | Start date of the delivery period, as a date or a date and time.Y-m-d or Y-m-d H:i:s |
data_final | Optional; do not send together with data | Optional; do not send together with data | string (date) | --- | End date of the delivery period, as a date or a date and timeY-m-d or Y-m-d H:i:s |
Example of a fixed delivery date on the CT-e:
{
"entrega": {
"data": "2023-10-27"
}
} Example of a delivery period on the CT-e:
{
"entrega": {
"data_inicial": "2024-02-02",
"data_final": "2024-03-03 15:14:25"
}
}The optional observacoes_contribuinte array accepts up to 10 note objects. Each object must have the required fields identificacao and descricao, following the rules below.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
identificacao | Required in each note | Required in each note | string | 1-20 | Field name for the taxpayer note |
descricao | Required in each note | Required in each note | string | 1-160 | Text of the taxpayer note for this field |
Example fragment with taxpayer notes on the CT-e. It is not a complete request:
{
"observacoes_contribuinte": [
{
"identificacao": "LEI DA TRANSPARENCIA",
"descricao": "O valor aproximado de tributos incidentes sobre o preço deste serviço é de R$ 152,00"
},
{
"identificacao": "ContatoEntrega",
"descricao": "João Pedro da Silva"
}
]
}The optional observacoes_fisco array accepts up to 10 note objects. Each object must have the required fields identificacao and descricao, following the rules below.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
identificacao | Required in each note | Required in each note | string | 1-20 | Field name for the note to the tax authority |
descricao | Required in each note | Required in each note | string | 1-60 | Text of the note to the tax authority for this field |
Example fragment with notes for the tax authority on the CT-e. It is not a complete request:
{
"observacoes_fisco": [
{
"identificacao": "RegimeEspecial",
"descricao": "123456"
}
]
}Send the tax documents that travel with the cargo in the documentos_fiscais array. Each element of the array is one tax document, as an object.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo | Required | string | 1 | Type of the linked document1 - NFe (electronic invoice) |
chave | Required for NF-e | string | 44 | Access key |
serie | Required for NF | string | 1-3 | Series of the document |
numero | Required for NF | string | 1-20 | Document number |
data_emissao | Required for NF | string (date) | --- | Issue date, as a date or a date and timeY-m-d or Y-m-d H:i:s |
modelo | Required for NF | string | 1 | Document model: 1 or 4 |
base_calculo | Required for NF | decimal | 13v2 | Tax base of the document |
base_calculo_st | Required for NF | decimal | 13v2 | Tax base for ICMS-ST (ICMS tax substitution) of the document |
icms | Required for NF | decimal | 13v2 | ICMS amount of the document |
icms_st | Required for NF | decimal | 13v2 | ICMS-ST (ICMS tax substitution) amount of the document |
valor_produtos | Required for NF | decimal | 13v2 | Value of the products on the NF |
cfop | Required for NF | string | 4-5 | CFOP (transaction code) |
valor_total | Required for NF | decimal | 13v2 | Total value of the document |
pin | Optional | string | 2-9 | SUFRAMA PIN (Manaus Free Trade Zone) |
previsao_entrega | Optional | string (date) | --- | Planned delivery date, as a date or a date and timeY-m-d or Y-m-d H:i:s |
peso | Optional | decimal | 12v3 | Weight of the items on the invoice |
numero_romaneio | Optional for NF (tipo = 2); do not send for the other types | string | 1-20 | Packing list number (romaneio) |
numero_pedido | Optional for NF (tipo = 2); do not send for the other types | string | 1-20 | Order number |
descricao | Optional | string | 1-100 | Document description, for types 3, 4, 5, 6 and 9 |
unidades_carga | Optional | array of objects | 0-n | Cargo units linked directly to the tax document |
unidades_transporte | Optional | array of objects | 0-n | Transport units of the goods |
Example fragment with NF-e tax documents. It is not a complete request. Replace the keys with the real documents:
{
"documentos_fiscais": [
{
"tipo": "1",
"chave": "00000000000000000000000000000000000000000000"
},
{
"tipo": "1",
"chave": "00000000000000000000000000000000000000000000"
},
{
"tipo": "1",
"chave": "00000000000000000000000000000000000000000000"
}
]
}Send the transport units in the unidades_transporte array of each documentos_fiscais object. Each element is one transport unit, such as a truck, a trailer, a ship, a barge, an aircraft or a rail car.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
tipo | Required | Required | string | 1 | Type of transport unit 1 - Road tractor |
identificacao | Required | Required | string | 1-20 | Transport unit ID Send the ID that matches the type of transport unit. For example, for a road tractor or trailer, send the license plate. |
lacres | Optional | Optional | array (string 1-20) | 0-n | Seals of the transport unit |
quantidade_rateada | Optional | Optional | decimal | 3v3 | Apportioned quantity (weight, volume) |
unidades_carga | Optional | Optional | array | 0-n | Cargo units (containers, ULD, other) |
Example fragment with one transport unit in a tax document. It is not a complete request. Replace the key and the IDs with the real data:
{
"documentos_fiscais": [
{
"tipo": "1",
"chave": "00000000000000000000000000000000000000000000",
"unidades_transporte": [
{
"tipo": "1",
"identificacao": "ABC1D23",
"lacres": ["00000000", "00000000"],
"unidades_carga": [
{
"tipo": "1",
"identificacao": "Container 00000"
}
]
}
]
}
]
}Send the cargo units in the unidades_carga array of each documentos_fiscais object, or in the unidades_carga array of one of its unidades_transporte. Each element is one cargo unit.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
tipo | Required | Required | string | 1 | Type of cargo unit 1 - Container |
identificacao | Required | Required | string | 1-20 | Cargo unit ID Send the ID of the cargo unit, for example the container number. |
lacres | Optional | Optional | array (string 1-20) | 0-n | Seals of the cargo unit |
quantidade_rateada | Optional | Optional | decimal | 3v3 | Apportioned quantity (weight, volume) |
Example fragment with one cargo unit in a tax document. It is not a complete request. Replace the key and the IDs with the real data:
{
"documentos_fiscais": [
{
"tipo": "1",
"chave": "00000000000000000000000000000000000000000000",
"unidades_carga": [
{
"tipo": "1",
"identificacao": "Container 00000",
"lacres": ["00000000", "00000000"]
}
]
}
]
}Link previous documents, the transport documents issued earlier for the same cargo, to the CT-e in the documentos_anteriores array.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
emissor | Required | object | --- | Issuer of the documents |
documentos | Required for each emissor sent | array | 1-n | IDs of the previous documents of this issuer |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
nome_razao | Required | string | 1-60 | Name or company name of the issuer |
cnpj | Required for a company | string | 14 | CNPJ (company ID)00.000.000/0000-00 |
cpf | Required for an individual | string | 11 | CPF number (individual taxpayer ID)000.000.000-00 |
ie | Required when uf is sent | string | 0-14 | State registration number (IE) |
uf | Required when ie is sent | string | 2 | State of the issuer's address |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
chave | Required for an electronic document | string | 44 | Access key of the document |
tipo | Required when chave is not sent (paper document) | decimal | --- | Document type7 - ATRE |
serie | Required for a paper document | string | 1-3 | Series of the document |
numero | Required for a paper document | string | 1-30 | Document number |
data_emissao | Required when chave is not sent (paper document) | string | --- | Issue date, as a date or a date and timeY-m-d or Y-m-d H:i:s |
JSON fragment with previous documents. Replace the example CNPJ and key with the real data. The fragment is not a complete issuing request.
{
"documentos_anteriores": [
{
"emissor": {
"cnpj": "00.000.000/0000-00",
"nome_razao": "Empresa Emissora"
},
"documentos": [
{
"chave": "00000000000000000000000000000000000000000000"
}
]
}
]
}When you transport new vehicles, send their details in the veiculos_novos array.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
chassi | Required | string | 17 | Chassis number of the vehicle |
cor | Required | string | 1-4 | Color code of the vehicle |
cor_descricao | Required | string | 1-40 | Color name or description of the vehicle |
marca_modelo | Required | string | 1-6 | Make/model of the vehicle |
valor_unitario | Required | decimal | 13v2 | Unit value of the vehicle |
valor_frete_unitario | Required | decimal | 13v2 | Freight value of the vehicle |
Send the billing details in the cobranca object.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
fatura | Optional | Optional | object | --- | Billing invoice (fatura) |
duplicatas | Optional | Optional | array | 0-n | Billing installments (duplicatas) |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
numero | Optional | Optional | string | 1-60 | Invoice number |
valor_original | Optional | Optional | decimal | 13v2 | Original value of the invoice |
valor_desconto | Optional | Optional | decimal | 13v2 | Discount amount of the invoice |
valor_liquido | Optional | Optional | decimal | 13v2 | Net value of the invoice |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
numero | Optional | Optional | string | 1-60 | Installment number |
data_vencimento | Optional | Optional | string | --- | Due dateY-m-d |
valor | Required in each installment sent | Required in each installment sent | decimal | 13v2 | Installment amount |
Send the advance payment in the pagamento_antecipado object, at the root of the request.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
tipo | Required when the group is used | Required when the group is used | integer | 1 | Type of advance payment1 - This CT-e is itself the advance payment (credit) |
chaves | Required when tipo=3. Not allowed when tipo=1. | Required when tipo=3. Not allowed when tipo=1. | array | 1-99 | Access keys of the CT-e (models 57 or 67) whose payment covers the current service in advanceEach key must have exactly 44 digits. Required when tipo=3 and not allowed when tipo=1. |
The API checks the structure and the check digit of each key. Each key must have the same CNPJ base (the first eight characters of the CNPJ) as the issuer of the CT-e. Duplicate keys are not accepted.
JSON fragment of an advance payment with tipo 3. The 44-digit key is an example: replace it with the real key of the advance payment document, with the same CNPJ base as the issuer. The fragment is not a complete issuing request.
{
"pagamento_antecipado": {
"tipo": 3,
"chaves": [
"13260706074104000127570010000001231210730009"
]
}
}Send the tax details in the impostos object.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
cfop | Required | Required | string | 4-5 | CFOP, the 4-digit code that says what kind of transaction this is. The first digit gives the place: 5 = inside the state, 6 = to another state, 7 = abroad |
classificacao_tributaria | Required | Required | string | 2 | CST of ICMS (tax status code): tells the tax authority how ICMS applies to this service00 - Normal ICMS taxation |
beneficio_fiscal | Optional | Optional | string | 1-10 | Tax benefit code of the state (UF) |
icms | Optional; the automatic rate is applied | Optional; the automatic rate is applied | object | --- | Values and rates of ICMS, the state tax on transport between cities or states. It is the tax base × the rate; each state sets its own rates |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
aliquota | Optional | Optional | decimal | 3v2 | ICMS rate |
percentual_reducao | Optional | Optional | decimal | 3v2 | Reduction percentage of the tax base |
bc_st_retido | Optional | Optional | decimal | 13v2 | Tax base of the ICMS-ST withheld. Under tax substitution, one company in the chain collects in advance the ICMS of the next steps |
aliquota_st_retido | Optional | Optional | decimal | 3v2 | Rate of the ICMS-ST (ICMS withheld by tax substitution) |
credito_outorgado | Optional | Optional | decimal | 13v2 | Amount of the granted tax credit (crédito outorgado) |
devido_origem | Optional | Optional | boolean | 1 | Flag for tax owed to the origin state |
partilha | Optional | Optional | object | - - - | Group for interstate services to a final consumer that is not an ICMS taxpayer |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
base_calculo | Optional; when missing, the calculated ICMS base is used | Optional; when missing, the calculated ICMS base is used | decimal | 13v2 | Tax base for the destination state |
aliquota_fcp_uf_destino | Required when partilha is sent | Required when partilha is sent | decimal | 3v2 | FCP (poverty fund surcharge, a small extra ICMS percentage some states charge) rate in the destination state |
aliquota_icms_uf_destino | Required when partilha is sent | Required when partilha is sent | decimal | 3v2 | ICMS rate in the destination state |
aliquota_icms_uf_origem | Required when partilha is sent | Required when partilha is sent | decimal | 3v2 | ICMS rate in the origin state |
aliquota_icms_interestadual | Required when partilha is sent | Required when partilha is sent | decimal | 3v2 | Interstate ICMS rate |
valor_icms_uf_remetente | Required | Required | decimal | 3v2 | Interstate ICMS rate |
The road mode covers cargo carried by truck. Its data goes in the rodoviario object. The table below lists the parameters you can send.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
rntrc | Required | Required | string | 8 | RNTRC, the carrier's number in the national register of road cargo carriers kept by ANTT (the national land transport agency) |
ordens_coleta | Optional | Optional | array | 0-10 | Pickup orders |
A pickup order is the order to collect the cargo. Send pickup orders in the ordens_coleta array, inside rodoviario. You can send up to 10 orders.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
numero | Required | Required | string | 1-6 | Pickup order number |
data_emissao | Required | Required | string | --- | Issue date, as a date or a date and timeY-m-d or Y-m-d H:i:s |
serie | Optional | Optional | string | 1-3 | Pickup order series |
emissor | Required | Required | object | - - - | Issuer of the pickup order |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
cnpj | Required | Required | string | 14 | CNPJ (company ID)00.000.000/0000-00 |
ie | Required | Required | string | 1-14 | State registration (IE) number |
uf | Required | Required | string | 2 | State (UF) of the issuer's address |
telefone | Optional | Optional | string | 6-14 | Issuer's phone number |
JSON fragment for the road mode. Replace the RNTRC, the CNPJ and the issuer data with real data. The fragment is not a complete issuing request.
{
"rodoviario": {
"rntrc": "00000000",
"ordens_coleta": [
{
"numero": "10",
"data_emissao": "2023-10-20",
"emissor": {
"cnpj": "00.000.000/0000-00",
"ie": "00000000000000",
"uf": "PR"
}
}
]
}
}The air mode covers cargo carried by airplane. Its data goes in the aereo object, required when modalidade is 2. In that case, previsao_entrega, tarifa, tarifa.classe and tarifa.valor are required. The table below lists the parameters.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
previsao_entrega | Required | Required | string | 10 | Expected delivery date Y-m-d |
numero_minuta | Optional | Optional | string | 9 | Minuta number (the air cargo dispatch form) |
numero_oca | Optional | Optional | string | 11 | Operational number of the air waybill (OCA) |
tarifa | Required | Required | object | - - - | Fare information |
natureza_carga | Optional | Optional | object | - - - | Cargo nature |
produtos_perigosos | Optional | Optional | array | 0-n | Information on products classified as dangerous goods |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
classe | Required | Required | string | 1 | Fare classM - Minimum fare |
valor | Required | Required | decimal | 13v2 | Fare amount |
codigo | Optional | Optional | string | 1-4 | Fare code |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
dimensoes | Optional | Optional | string | 5-14 | Dimensions Format: 1234X1234X1234 (cm) |
informacoes_manuseio | Optional | Optional | array(string) | 0-n | Handling information 1 - shipper's certificate for shipping a live animal |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
numero_onu | Required | Required | string | 4 | UN number of the dangerous good |
descricao_volumes | Required | Required | string | 1-20 | Total number of packages that contain dangerous goods, sent as text |
quantidade_total | Required | Required | decimal | 11v4 | Quantity of the dangerous item |
unidade_medida | Required for each dangerous good sent | Required for each dangerous good sent | string | 1 | Unit of measure of the item1 - KG |
Sample fragment for the air mode, not a complete request. Replace the date and the values with the data of your operation.
{
"aereo": {
"previsao_entrega": "2023-11-02",
"tarifa": {
"classe": "M",
"codigo": "AAAA",
"valor": 1000
}
}
}The water mode covers cargo carried by ship or barge, on inland waterways or along the coast. Its data goes in the aquaviario object, required when modalidade is 3. In that case, valor_prestacao, adicional_frete, identificacao_navio and irin_navio are required. The table below lists the parameters.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
irin_navio | Required | Required | string | 1-10 | IRIN of the ship (its international radio identification) |
identificacao_navio | Required | Required | string | 1-60 | Ship identification |
valor_prestacao | Required | Required | decimal | 13v2 | Service amount |
adicional_frete | Required | Required | decimal | 13v2 | Additional freight amount |
numero_viagem | Optional | Optional | string | 1-10 | Numeric code of the voyage |
direcao | Optional | Optional | string | 1 | Direction to the destination N - North |
tipo_navegacao | Optional | Optional | string | 1 | Navigation type 0 - Inland waterways |
balsas | Optional | Optional | array(string 1-60) | 0-3 | Barge identification |
containers | Optional | Optional | array | 0-n | Identification of the containers carried |
Send the containers used to carry the cargo in the containers array.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
identificacao | Required | Required | string | 1-20 | Container ID |
lacres | Optional | Optional | array (string 1-20) | 0-3 | Container seal numbers |
documentos | Optional | Optional | array | 0-n | Documents of the goods carried in the container |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
chave | Required for an electronic document | Required for an electronic document | string | 44 | Access key of the document |
serie | Required when the access key is not sent | Required when the access key is not sent | string | 1-3 | Issuing series of the document |
numero | Required when the access key is not sent | Required when the access key is not sent | string | 1-20 | Document number |
medida_rateada | Optional | Optional | decimal | 2v3 | Apportioned unit of measure |
Sample fragment for the water mode, not a complete request. Replace the values and IDs with the data of your operation.
{
"aquaviario": {
"valor_prestacao": 1000,
"adicional_frete": 0,
"identificacao_navio": "AABBBCCC",
"irin_navio": "0000000000",
"containers": [
{
"identificacao": "AAAAA"
}
]
}
}The rail mode covers cargo carried by train. Its data goes in the ferroviario object, required when modalidade is 4. When you send the object, tipo_trafego, fluxo, responsavel_faturamento, responsavel_emissao and valor_frete are required. The table below lists the parameters.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
tipo_trafego | Required | Required | string | 1 | Type of traffic0 - Own |
fluxo | Required | Required | string | 1-10 | Rail flowAn ID number of the contract signed with the customer |
responsavel_faturamento | Required | Required | string | 1 | Railway responsible for billing1 - Origin railway |
responsavel_emissao | Required | Required | string | 1 | Railway responsible for issuing1 - Origin railway |
valor_frete | Required | Required | decimal | 13v2 | Freight amount |
cte_origem | Optional | Optional | string | 44 | Access key of the CT-e issued by the origin railway |
ferrovias | Optional | Optional | array | 0-n | Identification of the railways the cargo passes through |
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
cnpj | Required | Required | string | 14 | CNPJ (company ID)00.000.000/0000-00 |
nome_razao | Required | Required | string | 2-60 | Name or company name |
ie | Optional | Optional | string | up to 14 | State registration (IE) number |
endereco | Required | Required | string | 2-255 | Street of the railway's address |
cidade | Required | Required | string | 2-60 | City of the railway |
uf | Optional | Optional | string | 2 | State (UF) of the railway's address |
numero | Optional | Optional | string | 1-60 | Street number of the railway's address |
complemento | Optional | Optional | string | 1-60 | Address complement of the railway (suite, unit) |
bairro | Optional | Optional | string | 2-60 | District of the railway's address |
cep | Optional | Optional | string | 8-9 | Postal code (CEP) of the railway's address |
Sample fragment for the rail mode, not a complete request. Replace the values, the CNPJ and the registration data with the real data of your operation.
{
"ferroviario": {
"tipo_trafego": "1",
"fluxo": "000000",
"responsavel_faturamento": "1",
"responsavel_emissao": "1",
"valor_frete": 1000,
"ferrovias": [
{
"cnpj": "00.000.000/0000-00",
"nome_razao": "Ferrovia Passagem",
"endereco": "Rua Principal",
"cidade": "Curitiba",
"uf": "PR"
}
]
}
}The pipeline mode covers products moved through pipelines, such as fuel or gas. Its data goes in the dutoviario object, required when modalidade is 5. When you send the object, the start and end dates are required. The tariff amount is optional. The table below lists the parameters.
| Parameter | Standard | Simplified | Type | Size | Description |
|---|---|---|---|---|---|
data_inicio_prestacao | Required | Required | string | 10-20 | Start date of the transport serviceY-m-d or Y-m-d H:i:s |
data_termino_prestacao | Required | Required | string | 10-20 | End date of the transport serviceY-m-d or Y-m-d H:i:s |
valor_tarifa | Optional | Optional | decimal | 9v6 | Tariff amount |
Sample fragment for the pipeline mode, not a complete request. Replace the dates and the amount with the data of your operation.
{
"dutoviario": {
"data_inicio_prestacao": "2023-10-30",
"data_termino_prestacao": "2023-11-20",
"valor_tarifa": 100.5121
}
}The multimodal mode covers one transport contract that uses two or more modes, for example truck and ship, under one multimodal transport operator. Its data goes in the multimodal object, required when modalidade is 6. When you send the object, cotm and negociavel are required. seguro is an optional object. The table below lists the parameters.
| Parameter | Standard | Type | Size | Description |
|---|---|---|---|---|
cotm | Required | string | 1-20 | Certificate number of the multimodal transport operator (COTM) |
negociavel | Required | boolean | 1 | Negotiable indicator: whether the document is negotiable |
seguro | Optional | object | - - - | Insurance information |
| Parameter | Standard | Type | Size | Description |
|---|---|---|---|---|
cnpj_seguradora | Required | string | 14 | CNPJ (company ID)00.000.000/0000-00 |
nome_razao_seguradora | Required | string | 1-30 | Name or company name |
numero_apolice | Required | string | 1-20 | Policy number |
numero_averbacao | Required | string | 1-20 | Shipment registration number under the policy (averbação) |
Sample fragment for the multimodal mode, not a complete issuing request. Replace the CNPJ and the insurance contract data with valid data of your operation.
{
"multimodal": {
"cotm": "0000000000",
"negociavel": false,
"seguro": {
"cnpj_seguradora": "00.000.000/0000-00",
"nome_razao_seguradora": "Seguradora",
"numero_apolice": "000000000",
"numero_averbacao": "00000000"
}
}
} The CT-e OS (Conhecimento de Transporte Eletrônico para Outros Serviços) is the bill for passenger, valuables and excess baggage transport. It is issued in the road mode. It uses the same endpoint as the CT-e, with modelo = cte_os, servico.tipo 6, 7 or 8, and the tomador object always filled in. That object holds the payer (the tomador, in Brazilian law): the individual or company that receives the transport service. Not sure which document you need? See CT-e or CT-e OS?.
To issue a CT-e OS, send a POST request to /2/cte/emissao.
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ambiente": 1,
"modelo": "cte_os",
"modalidade": 1,
...
}' \
https://api.webmania.com.br/2/cte/emissao Illustrative structure of a CT-e OS, not a request validated for issuing. Replace the IDs, the date, the registration data, the taxes and the transaction details with valid values. Also check the rules of the road mode.
{
"ambiente": 2,
"finalidade": "0",
"natureza_operacao": "Prestação de serviço de transporte - interestadual",
"modalidade": "1",
"modelo": "cte_os",
"data_emissao": "2023-10-27 09:21:22",
"local_inicio_prestacao": {
"cidade": "Curitiba",
"uf": "PR"
},
"local_termino_prestacao": {
"cidade": "São Paulo",
"uf": "SP"
},
"contribuicao_tomador": "9",
"indicador_tomador": "0",
"tomador": {
"nome_razao": "Tomador do Serviço",
"cpf": "00000000000",
"telefone": "47999999999",
"endereco": "Rua Exemplo",
"numero": "415",
"bairro": "Bacacheri",
"cep": "80035040",
"cidade": "Curitiba",
"uf": "PR"
},
"impostos": {
"cfop": "0000",
"classificacao_tributaria": "00"
},
"remetente": {
"nome_razao": "Remetente Carga",
"cnpj": "00000000000000",
"nome_fantasia": "Rementente",
"telefone": "11999999999",
"endereco": "Rua Exemplo",
"numero": "321",
"complemento": "Edifício",
"bairro": "Jardim",
"cep": "82400000",
"cidade": "Curitiba",
"uf": "PR"
},
"destinatario": {
"nome_razao": "Destinatario Carga",
"cnpj": "00000000000000",
"telefone": "11999999999",
"endereco": "Rua Exemplo",
"numero": "123",
"bairro": "Jardim",
"cidade": "São Paulo",
"cep": "01153000",
"uf": "SP"
},
"servico": {
"tipo": 6,
"descricao": "Transporte de pessoas",
"valor_total": 100,
"valor_recebido": 100
},
"carga": {
"valor_total": 100,
"produto_predominante": "Chocolate",
"quantidades": [
{
"unidade_medida": "1",
"tipo_medida": "LITROS",
"quantidade": 2
}
]
},
"documentos_fiscais": [
{
"tipo": "1",
"chave": "00000000000000000000000000000000000000000000"
}
],
"rodoviario": {
"rntrc": "12345678"
}
} Example of an HTTP 200 response, with the fields uuid, chave, serie, cte, status, motivo, modelo, epec, xml, dacte and log, described in Notification fields. log is an object or an array, not a JSON string. Check the status in the response body: HTTP 200 does not mean that SEFAZ authorized the document.
{
"uuid": "00000000-0000-0000-0000-000000000000", // Unique ID
"chave": "00000000000000000000000000000000000000000000", // Access key at SEFAZ
"serie": 1, // CT-e OS series
"cte": 123, // CT-e OS number
"status": "aprovado", // aprovado, reprovado, cancelado, denegado, processando or contingencia
"motivo": "Autorizado o uso do CT-e", // Reason for the status
"modelo": "cte_os",
"epec": false, // Whether the document was issued in EPEC
"xml": "https://api.webmania.com.br/xmlcte/[chave]",
"dacte": "https://api.webmania.com.br/dacte/[chave]",
"log": {} // Example object; it can be an empty array
} The final result is sent by POST to the url_notificacao. See Notifications.
The CT-e OS documents the transport of passengers, valuables or baggage. The subsections below explain how to issue a CT-e OS in road mode.
Fill in the fields according to the purpose of your document. Some parameters have more details: click the parameter name to see them. The table below lists the fields needed to issue a CT-e OS.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
ambiente | Required | integer | 1 | SEFAZ environment 1 - Production |
url_notificacao | Optional | string | - - - | Notification URL for every status update of the CT-e |
modelo | Required, model cte_os | string | - - - | Document model. Send cte_os |
natureza_operacao | Required | string | 1-60 | Description of the nature of the transaction |
modalidade | Required | integer | 1 | Transport mode of the document 1 - Road |
finalidade | Required, no default value | string | 1 | Type of CT-e0 - Normal |
data_emissaoNEW | Optional | string or null | - - - | Issue date and time of the document. Accepts null.Recommended format: Y-m-d H:i:s. |
contribuicao_tomador | Required | integer | 1 | Taxpayer type of the payer in the transport service 1 - ICMS taxpayer |
indicador_tomador | Required | integer | 1 | Indicator validated by the API: 0, 1, 2, 3 or 4. In the CT-e OS, the payer data is always read from the tomador object, whatever this indicator says. |
servico | Required | object | - - - | Details of the service provided |
carga | Required | object | - - - | Details of the cargo being transported |
documentos_fiscais | Required | array | - - - | Identification of the transported documents |
local_inicio_prestacao | Required | object | - - - | Start location of the service |
local_termino_prestacao | Required | object | - - - | End location of the service |
percurso | Optional | array | 1-25 | Codes of the states (UF) the vehicle passes through, in order from origin to destination, without repeating the start and end states. SEFAZ requires it when the start state and the end state do not share a border (rejection 753 – Percurso inválido, "invalid route"). |
tomador | Required | object | - - - | Payer of the service |
rodoviario | Optional. The TAF or state transport registration (Registro Estadual) the trip requires must come from the request or from the company settings | object | - - - | Road mode details. For mode 1, the TAF (charter authorization, for interstate trips) or the state transport registration (for trips inside one state) comes from the request or from the company settings. See the fields of this mode. |
observacoes_contribuinte | Optional | array | - - - | Free-form additional notes from the taxpayer |
observacoes_fisco | Optional | array | - - - | Free-form additional notes for the tax authority |
detalhes_retirada | Optional | string | 1-160 | Additional details about the cargo pickup |
caracteristica_transporte | Optional | string | 1-15 | Additional feature of the transport. Examples: REENTREGA (redelivery), DEVOLUÇÃO (return) and REFATURAMENTO (rebilling) |
caracteristica_servico | Optional | string | 1-30 | Additional feature of the service. Examples: ENTREGA EXPRESSA (express delivery), LOGÍSTICA REVERSA (reverse logistics), CONVENCIONAL (standard) and EMERGENCIAL (emergency) |
observacoes_gerais | Optional | string | 1-2000 | Additional information of the document |
informacoes_adicionais_fisco | Optional | string or null | 0-2000 | Additional information for the tax authority |
Send the details of the service provided as an object in the servico parameter.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
valor_total | Required | numeric | 13v2 | Total value of the service0.00 |
valor_recebido | Required | numeric | 13v2 | Amount received for the service0.00 |
tipo | Required | integer | 1 | Type of service provided. 6 - Passenger transport |
descricao | Required | string | 1-30 | Description of the service |
componentes | Optional | object | --- | Components of the service value Send an object where each key is the component name and its value is the amount of that component |
Illustrative fragment of the service in a CT-e OS, not a complete issuing request. Numbers use a decimal point and no thousands separator.
{
"servico": {
"tipo": 6,
"descricao": "Transporte de pessoas",
"valor_total": 12000,
"valor_recebido": 9.500,
"componentes": {
"FRETE PESO": 8000
}
}
}Send the details of the transported cargo in the carga object, with the transported quantities and, optionally, the seguro (insurance) object. The API validation also requires valor_total (except in mode 5) and produto_predominante, although the CT-e OS XML uses the service description and the sum of the quantities.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
quantidades | Required | array | 1-n | Quantities of the transported cargo |
seguro | Optional | object | - - - | Insurance and insurer details |
Illustrative fragment of the quantities for a CT-e OS. It is not a complete request and does not replace the other cargo fields.
{
"carga": {
"quantidades": [
{
"quantidade": 20
}
]
}
}Send the quantities of the loaded items in the quantidades array. Each item is an object.
| Parameter | Standard | CT-e OS | Simplified | Type | Size | Description |
|---|---|---|---|---|---|---|
quantidade | Required | Required | Taken from the NF-e when available. | numeric | 11v4 | Quantity of the cargo item, from 0 to 99999999999.9999. In the CT-e OS, the item quantities are added up to make the total quantity of the service. |
unidade_medida | Required | Not used in the CT-e OS | Taken from the NF-e when available. | string | 1 | Unit of measure of the cargo item.0 - M3 (cubic meters) |
tipo_medida | Required | Not used in the CT-e OS | Taken from the NF-e when available. | string | 1-20 | Type of measure of the cargo item.Examples: PESO BRUTO (gross weight), PESO DECLARADO (declared weight), LITRAGEM (volume in liters), CAIXAS (boxes), etc. |
Send the insurance and insurer details of the cargo in the seguro object.
| Parameter | CT-e OS | Type | Size | Description |
|---|---|---|---|---|
responsavel | Required when you send carga.seguro | string | 1 | Party responsible for the insurance 4 - Issuer of the CT-e |
nome_razao_seguradora | Optional | string | 1-30 | Name or company name of the insurer |
numero_apolice | Optional | string | 1-20 | Insurance policy number |
Send the start and end locations of the transport service in the local_inicio_prestacao and local_termino_prestacao objects, following the field rules below.
List the states (UF) in between in percurso, in order, without repeating the start and end states. When the start and end states do not share a border, SEFAZ requires the route; without it, the document is rejected with code 753.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
cidade | Required when cod_ibge is not sent or when cod_ibge is 5300108 (DF) | string | - - - | City nameSend 'EXTERIOR' for transactions abroad. |
uf | Required when cod_ibge is not sent | string | 2 | State code (UF)Send 'EX' for transactions abroad. |
cod_ibge | Required when cidade is not sent | string | 7 | Official city code (IBGE)Send 9999999 for transactions abroad. |
Illustrative fragment of the service locations and the route for a CT-e OS, not a complete issuing request.
{
"local_inicio_prestacao": {
"cidade": "Cascavel",
"uf": "PR",
"cod_ibge": "4104808"
},
"local_termino_prestacao": {
"cidade": "Gravataí",
"uf": "RS",
"cod_ibge": "4309209"
},
"percurso": ["SC"]
}The payer of the CT-e OS (the tomador, in Brazilian law) is the individual or company that receives the transport service. Send the payer in the tomador object, following the rules below.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
cnpj | Required for a company | string | 14 | CNPJ (company ID) |
cpf | Required for an individual | string | 11 | CPF number (individual taxpayer ID) |
nome_razao | Required | string | 2-60 | Name or company name |
nome_fantasia | Optional | string | 2-60 | Trade name of the company |
ie | Required for a payer with a CNPJ and contribuicao_tomador=1 | string | 0-14 | State registration number (IE) |
email | Optional | string | - - - | Email address |
telefone | Optional | string | 6-14 | Phone number |
endereco | Required | string | 2-255 | Street of the address |
numero | Required | string | 1-60 | Street number of the address |
complemento | Optional | string | 1-60 | Address complement (suite, floor) |
bairro | Required | string | 2-60 | District (neighborhood) of the address |
cep | Required for a Brazilian address | string | 8-9 | Postal code (CEP) of the address |
cidade | Required for a Brazilian payer. It can be filled in from the CEP lookup when available | string | 2-255 | City name |
uf | Required for a Brazilian payer. It can be filled in from the CEP lookup when available | string | 2 | State code (UF) |
codigo_pais | Optional | string | 1-4 | Country code from the Central Bank (BACEN) list Example: Brazil = 1058 |
Illustrative fragment of the payer of a CT-e OS, not a complete issuing request. Replace the CPF and the registration data with valid information.
{
"tomador": {
"nome_razao": "Tomador do Serviço",
"cpf": "00000000000",
"telefone": "47999999999",
"endereco": "Rua Naftali Reiss",
"numero": "415",
"complemento": "tal",
"bairro": "Bacacheri",
"cep": "80035040",
"cidade": "Curitiba",
"uf": "PR"
}
}Send the tax documents in the documentos_fiscais array. Each element of the array is one tax document, as an object.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
chave | Required for a BP-e | string | 44 | Access key of the BP-e (electronic passenger ticket) |
data_emissao | Required when there is no access key | string | 10-20 | Issue date in the format Y-m-d |
numero | Required when there is no access key | string | 1-20 | Document number |
serie | Optional | string | 1-3 | Series of the document |
subserie | Optional | string | 1-3 | Sub-series of the document |
valor_total | Optional | numeric | 13v2 | Total value of the document |
Illustrative fragment of tax documents, not a complete issuing request. The keys made of zeros are placeholders: replace them with valid 44-character access keys. This fragment does not prove tax authorization.
{
"documentos_fiscais": [
{
"chave": "00000000000000000000000000000000000000000000"
},
{
"numero": "12345",
"chave": "00000000000000000000000000000000000000000000"
}
]
}Send the billing details in the cobranca object.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
fatura | Optional | object | --- | Billing invoice (fatura) |
duplicatas | Optional | array | 1-n | Billing installments (duplicatas) |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
numero | Optional | string | 1-60 | Invoice number |
valor_original | Optional | numeric | 13v2 | Original amount of the invoice |
valor_desconto | Optional | numeric | 13v2 | Discount amount of the invoice |
valor_liquido | Optional | numeric | 13v2 | Net amount of the invoice |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
numero | Optional | string | 1-60 | Installment number |
data_vencimento | Optional | string | --- | Valid due date. Recommended format: Y-m-d |
valor | Required in each installment sent | numeric | 13v2 | Installment amount |
Send the tax details in the impostos object.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
cfop | Required | string | 4-5 | CFOP, the transaction code (Código Fiscal de Operações e de Prestações) |
classificacao_tributaria | Required | string | 2 | Tax status code (CST)00 - Standard ICMS taxation |
beneficio_fiscal | Optional | string | 1-10 | Tax benefit code in the state (UF) |
icms | Optional. The automatic rate is applied | object | --- | ICMS amounts and rates |
pis | Optional | numeric | 13v2 | PIS amount |
cofins | Optional | numeric | 13v2 | COFINS amount |
ir | Optional | numeric | 13v2 | IR amount (income tax) |
inss | Optional | numeric | 13v2 | INSS amount (social security) |
csll | Optional | numeric | 13v2 | CSLL amount (social contribution on net profit) |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
aliquota | Optional | numeric | 3v2 | ICMS rate |
percentual_reducao | Optional | numeric | 3v2 | Reduction percentage of the tax base |
bc_st_retido | Optional | numeric | 13v2 | Tax base with tax substitution (ICMS-ST withheld) |
aliquota_st_retido | Optional | numeric | 3v2 | Rate with tax substitution (ICMS-ST withheld) |
credito_outorgado | Optional | numeric | 13v2 | Granted tax credit amount (crédito outorgado) |
devido_origem | Optional | boolean | 1 | Indicates that the tax is due in the origin state |
partilha | Optional | object | - - - | Group to send for interstate services to a final consumer that is not an ICMS taxpayer |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
base_calculo | Optional. When omitted, the ICMS tax base is used | numeric | 13v2 | Tax base for the destination state |
aliquota_fcp_uf_destino | Required when partilha is sent | numeric | 3v2 | FCP rate (poverty fund surcharge) in the destination state |
aliquota_icms_uf_destino | Required when partilha is sent | numeric | 3v2 | ICMS rate in the destination state |
aliquota_icms_uf_origem | Required when partilha is sent | numeric | 3v2 | ICMS rate in the origin state |
aliquota_icms_interestadual | Required when partilha is sent | numeric | 3v2 | Interstate ICMS rate |
valor_icms_uf_remetente | Required | numeric | 3v2 | Interstate ICMS rate |
Send the road mode details in the rodoviario object. The TAF (charter authorization) is required for an interstate trip, and the state transport registration for a trip inside one state. Send the matching field in the object or keep it in the company settings. The value sent in the object takes priority. The table below lists the parameters you can send.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo_fretamento | Required for passenger transport (servico.tipo = 6). | string | 1 | Charter type1 - Occasional |
data_viagem | Required for an occasional charter (tipo_fretamento = 1). | string | --- | Valid trip date. Recommended formats: Y-m-d or Y-m-d H:i:s |
taf_cte_os | Required for an interstate trip when it is not set in the company settings | string | 12 | TAF (Termo de Autorização de Fretamento, the charter authorization) for the road CT-e OSDigits only |
registro_estadual_cte_os | Required for a trip inside one state when it is not set in the company settings | string | 25 | State transport registration number (Registro Estadual) for the road CT-e OSDigits only |
veiculo | Optional | object | - - - | Transport vehicle |
Send the transport vehicle of the CT-e OS in the rodoviario.veiculo object.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
placa | Required when veiculo is sent | string | 7 | License plate of the vehicle |
renavam | Optional | string | 9-11 | RENAVAM number (national vehicle registry) |
uf_licenciamento | Optional | string | 2 | State where the vehicle is licensed |
proprietario | Required when the vehicle does not belong to the company issuing the CT-e. | object | - - - | Owner of the vehicle |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
nome_razao | Required | string | 2-60 | Name or company name of the owner |
cnpj | Required for a company | string | 14 | CNPJ (company ID)00.000.000/0000-00 |
cpf | Required for an individual | string | 11 | CPF number (individual taxpayer ID)000.000.000-00 |
ie | Required when proprietario is sent | string | 1-14 | State registration number (IE) |
uf | Required when proprietario is sent | string | 2 | State of the owner's address |
taf | Required when proprietario is sent | string | 12 | Charter authorization (Termo de Autorização de Fretamento) |
registro_estadual | Required | string | 2-25 | State transport registration number (Registro Estadual) of the owner |
tipo | Required when proprietario is sent | string | 1 | Type of owner or holder0 - TAC Agregado (self-employed driver under contract) |
Illustrative fragment of the road mode, not a complete issuing request. Replace the trip date and the registrations with real data of the transaction.
{
"rodoviario": {
"tipo_fretamento": "1",
"data_viagem": "2023-12-10",
"taf_cte_os": "123456789012",
"registro_estadual_cte_os": "1234567890123456789012345",
"veiculo": {
"placa": "ABC0000"
}
}
}Send the taxpayer notes of the CT-e OS in the observacoes_contribuinte array, with up to 10 objects. Each object must have the string fields identificacao and descricao, following the rules below.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
identificacao | Required in each note sent | string | 1-20 | Field name of the taxpayer note |
descricao | Required in each note sent | string | 1-160 | Text of the taxpayer note for this field |
Illustrative fragment of the taxpayer notes in a CT-e OS, not a complete issuing request. The texts and values must reflect the real transaction:
{
"observacoes_contribuinte": [
{
"identificacao": "LEI DA TRANSPARENCIA",
"descricao": "O valor aproximado de tributos incidentes sobre o preço deste serviço é de R$ 152,00"
},
{
"identificacao": "ContatoEntrega",
"descricao": "João Pedro da Silva"
}
]
}Send the notes for the tax authority in the observacoes_fisco array, with at most 10 objects. Each object must have the text fields identificacao and descricao, both required when the note is sent.
| Parameter | Standard | Type | Size | Description |
|---|---|---|---|---|
identificacao | string | 1-20 | Field name for the note to the tax authority. Required in each object sent. | |
descricao | string | 1-60 | Text of the note to the tax authority for this field. Required in each object sent. |
Illustrative fragment of a CT-e OS request. Replace the texts with the data of the transaction and add the other required issuing fields.
{
"observacoes_fisco": [
{
"identificacao": "RegimeEspecial",
"descricao": "123456"
}
]
} From 2026, the new taxes of the Brazilian tax reform start to roll out gradually. This section shows the timeline. The subsections show how to send each group when you issue a CT-e or a CT-e OS.
Complementary Law 214/2025 (Lei Complementar 214/2025) created three new taxes. They will gradually replace the current taxes:
| Tax | What it is |
|---|---|
| IBS | State and city goods and services tax (Imposto sobre Bens e Serviços), a value-added tax shared by states and cities. It replaces ICMS and ISS gradually. |
| CBS | Federal goods and services tax (Contribuição Social sobre Bens e Serviços), the new federal value-added tax. It replaces PIS and COFINS. |
| IS | Selective tax (Imposto Seletivo), on goods harmful to health or the environment, such as tobacco and alcoholic drinks. It starts in 2027. |
| Environment | Available from | Required from |
|---|---|---|
| Sandbox (test environment) | July 7, 2025 | To be defined |
| Production | October 20, 2025 | January 1, 2026 |
The move to the new taxes is gradual, until 2033. Simplified timeline of the rates:
| Year | IBS | CBS | Current Taxes |
|---|---|---|---|
| 2026 | 0.1% state | 0.90% | No changes |
| 2027 | 0.05% state and 0.05% city | 8.80% | PIS/COFINS end. The IPI rate drops to 0%, except for products with incentives in the Manaus Free Trade Zone. |
| 2029-2032 | Rates set by the Federal Senate | Gradual reduction of ICMS and ISS | |
| 2033 | Transition complete | ICMS and ISS end | |
To send IBS/CBS on a CT-e or CT-e OS, add the ibs_cbs object inside impostos. The API processes this group when you send it in the sandbox or, in production, from January 1, 2026. When processing is active, situacao_tributaria and classificacao_tributaria are required. They must match the document model.
The table below lists the parameters you can send inside the object:
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
situacao_tributaria | string | 3 | CST (tax status code) of IBS and CBS. Together with the cClassTrib, it says how IBS and CBS apply. See the list of CST (tax status) and cClassTrib (tax classification) codes, in Portuguese. | |
classificacao_tributaria | string | 6 | cClassTrib (reform tax classification code) of IBS and CBS: standard rate, reduced rate, exemption and so on. See the list of CST (tax status) and cClassTrib (tax classification) codes, in Portuguese. | |
situacao_tributaria_regular | string | 3 | CST (tax status code) of IBS and CBS under the regular regime. See the list of CST (tax status) and cClassTrib (tax classification) codes, in Portuguese. Required for transactions that must be taxed under the regular regime. | |
classificacao_tributaria_regular | string | 6 | cClassTrib (reform tax classification code) of IBS and CBS under the regular regime. See the list of CST (tax status) and cClassTrib (tax classification) codes, in Portuguese. Required for transactions that must be taxed under the regular regime. | |
ibs_estadual | object | - | State IBS tax details. Include the conditional fields that the CST requires. | |
ibs_municipal | object | - | City IBS tax details. Include the conditional fields that the CST requires. | |
cbs | object | - | CBS tax details | |
credito_presumido | array | - | Presumed credit details for IBS and CBS |
Sample fragment of the IBS/CBS group. Choose the codes that fit the transaction and the document model, and include the other required fields of the issuing request. This fragment is not a complete request.
{
"impostos": {
"ibs_cbs": {
"situacao_tributaria": "000",
"classificacao_tributaria": "000001",
"ibs_estadual": {},
"ibs_municipal": {},
"cbs": {}
}
}
} In one sentence: on the CT-e and CT-e OS of companies in the Simples Nacional (small business regime: several taxes in one monthly payment), and of companies in the standard regime (outside Simples Nacional) with a pending request to join the Simples Nacional, the document now shows the company's IBS/CBS regime and the IBS/CBS calculated with the Simples Nacional rates.
| What applies | Sandbox | Production |
|---|---|---|
| New fields, regime rules and Simples Nacional calculation | Since October 26, 2026 | Documents with an issue date from December 14, 2026 (Brasília time) |
| Zero CBS for companies above the revenue sublimit without the regular regime | Documents with an issue date from January 1, 2027 | |
| If your company is… | What to do |
|---|---|
| Simples Nacional, above the sublimit or not | Send impostos.ibs_cbs with the CST and the cClassTrib and, if you want, the Simples Nacional rates. If the company chose the regular IBS/CBS regime, select this option in the company settings. |
| Standard regime, with a pending request to join the Simples Nacional | In the company settings, select the pending option and choose the intended regime. Then send impostos.ibs_cbs as above. |
| Standard regime, with no pending request | Nothing changes. |
| MEI (individual micro-entrepreneur) | Nothing. The API no longer sends IBS/CBS on the CT-e of an MEI. |
The API reads the company's tax regime and its IBS/CBS regime options from the company settings. It then decides on its own how IBS and CBS go into the document. You do not send the regime when you issue. The regular IBS/CBS regime is the choice of a Simples Nacional company to pay IBS and CBS under the general rules. A pending option is the situation of a standard-regime company that asked to join the Simples Nacional and is waiting for the decision.
| If your company is… | IBS/CBS under the general rules (state IBS, city IBS and CBS) | IBS/CBS calculated under the Simples Nacional |
|---|---|---|
| Simples Nacional, without the regular regime | No | IBS and CBS |
| Simples Nacional above the sublimit, without the regular regime | Yes. In 2026, CBS follows the usual calculation. From January 1, 2027, the API sets the CBS rate to zero, even if you send cbs.aliquota. | CBS only |
| Simples Nacional, above the sublimit or not, with the regular regime | Yes | No |
| Standard regime with a pending option for the Simples Nacional, without the regular regime | Yes | IBS and CBS |
| Standard regime with a pending option for the Simples Nacional, above the sublimit, without the regular regime | Yes | CBS only |
| Standard regime with a pending option, with the regular regime | Yes | No |
| Standard regime, with no pending request | Yes | No |
| MEI | No IBS/CBS on the document | |
The general IBS/CBS rules follow the other tax reform sections. The choice of the regular regime takes effect from January 1, 2027. The API sends the regime based on the company settings.
The API calculates the Simples IBS/CBS only when the document includes impostos.ibs_cbs. In this case, situacao_tributaria and classificacao_tributaria are required, even if you send only the Simples rates. Without impostos.ibs_cbs, the document has no IBS/CBS.
| Parameter | CT-e/CT-e OS | Type | Size | Description |
|---|---|---|---|---|
impostos.ibs_cbs.aliquota_ibs_sn | string | 3v4 | IBS rate under the Simples Nacional, in %, for the document.From 0 to 100, with up to four decimal places. E.g.: "1.2345"Used only when the company calculates IBS under the Simples (see How it works). | |
impostos.ibs_cbs.aliquota_cbs_sn | string | 3v4 | CBS rate under the Simples Nacional, in %, for the document.From 0 to 100, with up to four decimal places. E.g.: "0.9000" |
A rate that is omitted, null or blank counts as 0.00. A zero you send is kept. A rate in the wrong format rejects the issuing request with the message [impostos] O campo aliquota_ibs_sn deve estar entre 0 e 100, com até 4 casas decimais. (the field must be between 0 and 100, with up to 4 decimal places), or the same message for aliquota_cbs_sn.
Federal Government purchases in 2027 and 2028. When impostos.ibs_cbs.compra_governamental.ente is 1 (Federal Government) and the document is issued in 2027 or 2028, in São Paulo time, the API adds aliquota_ibs_sn and aliquota_cbs_sn to get the Simples Nacional CBS rate. Each rate that is omitted, null or blank counts as zero. If the document includes Simples IBS, its rate and its amount are set to zero. If the sum is above 100%, the issuing request is rejected. See Government purchases.
Simples Nacional company without the regular regime:
{
"impostos": {
"ibs_cbs": {
"situacao_tributaria": "000",
"classificacao_tributaria": "000001",
"aliquota_ibs_sn": "0.1000",
"aliquota_cbs_sn": "0.9000"
}
}
} For the state IBS tax details, add the ibs_estadual object inside impostos.ibs_cbs.
The table below lists the parameters you can send inside the object:
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
valor_devolvido | string | 13v2 | Amount of tax refunded | |
aliquota_diferimento | number or numeric string | - | Deferral percentage of the state IBS. Required when the CST requires deferral. The API formats it with 4 decimal places. |
Example of the State IBS group:
"ibs_estadual": {
"valor_devolvido": "10.00" // Amount of tax refunded
} For the city IBS tax details, add the ibs_municipal object inside impostos.ibs_cbs.
The table below lists the parameters you can send inside the object:
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
valor_devolvido | string | 13v2 | Amount of tax refunded0.00 | |
aliquota_diferimento | number or numeric string | - | Deferral percentage of the city IBS. Required when the CST requires deferral. The API formats it with 4 decimal places. |
Example of the City IBS group:
"ibs_municipal": {
"valor_devolvido": "10.00" // Amount of tax refunded
} For the CBS details, add the cbs object inside the ibs_cbs field.
The table below lists the parameters you can send inside the object:
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
valor_devolvido | string | 13v2 | Amount of tax refunded0.00 | |
aliquota_diferimento | number or numeric string | - | Deferral percentage of the CBS. Required when the CST requires deferral. The API formats it with 4 decimal places. | |
alc_zfm_cbs | object | - | Zero rate details for the Manaus Free Trade Zone / Free Trade Areas (ZFM/ALC) |
Example of the CBS group:
"cbs": {
"valor_devolvido": "10.00" // Amount of tax refunded
} To declare zero-rate transactions in the Manaus Free Trade Zone (ZFM) or in Free Trade Areas (ALC), add the alc_zfm_cbs object inside impostos.ibs_cbs.cbs. The aliquota_efetiva_referencia is required in this group. If you do not send valor_efetivo_referencia, the API calculates it: the tax base actually used for IBS/CBS, multiplied by the reference rate and divided by 100. When you send this object, also send inscricao_suframa at the root of the request. This is the registration with SUFRAMA, the Manaus Free Trade Zone authority. The API does not take it automatically from the issuer's settings.
The table below lists the parameters you can send inside the object:
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
aliquota_efetiva_referencia | number or numeric string | 3v4 | Effective reference rate, from 0 to 999.9999. Required when you send alc_zfm_cbs. The API formats it with 4 decimal places. Without valor_efetivo_referencia, the API calculates the reference amount from the effective IBS/CBS base. | |
valor_efetivo_referencia | number or numeric string | 13v2 | Taxable reference amount, from 0 to 9999999999999.99. If omitted, the API calculates it. If sent, it replaces the calculated amount. It must equal the effective base multiplied by the reference rate and divided by 100. It is still subject to the validations of the transaction. |
The API considers the cities of the ZFM (Manaus, Rio Preto da Eva and Itacoatiara) and of the ALCs (Tabatinga; Guajará-Mirim; Boa Vista/Bonfim; Macapá/Santana; Brasileia/Epitaciolândia/Cruzeiro do Sul). On the CT-e, the start and end of the service and the issuer must be in the ZFM or in the same ALC. A payer (tomador) that is a company must also be in the same area. On the CT-e OS, the check covers the issuer and, when it is a company, the payer. It does not require the start and end cities of the service in this combination.
Sample fragment of impostos.ibs_cbs.cbs with a fictitious reference rate. Replace the percentage with the one that applies to the transaction, send inscricao_suframa at the root, and include the other required fields of the issuing request.
{
"alc_zfm_cbs": {
"aliquota_efetiva_referencia": "8.8000"
}
} The presumed credit lets you use tax credits in specific situations. To use it, add the credito_presumido array inside the ibs_cbs field.
The table below lists the parameters you can send inside the array:
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
classificacao | string | 1-2 | Presumed credit classification codeSee the classification table below | |
aliquota_ibs | string | 2v4 | Presumed credit percentage for IBS | |
aliquota_cbs | string | 2v4 | Presumed credit percentage for CBS |
| Code | Description | Applies to |
|---|---|---|
3 | Purchase of materials for recycling | IBS and CBS |
4 | Used movable goods for resale | IBS and CBS |
5 | Automotive regime - Art. 310 | CBS |
6 | Automotive regime - Art. 311 | CBS |
7 | Manaus Free Trade Zone - Art. 444 | IBS |
10 | Manaus Free Trade Zone - Art. 450 | CBS |
11 | Free Trade Area - Art. 462 | IBS |
13 | Free Trade Area (Industry) - Art. 467 | CBS |
Example of the presumed credit:
"credito_presumido": {
"classificacao": "5", // Classification code
"aliquota_ibs": "0.10", // IBS percentage
"aliquota_cbs": "0.05" // CBS percentage
} gCompraGov group. It applies to transactions with government bodies: the Federal Government, states, cities, the Federal District, public agencies (autarquias) and public consortiums.To report a government purchase, add the compra_governamental object inside impostos.ibs_cbs. This group requires situacao_tributaria equal to 200 and classificacao_tributaria equal to 200050. The fields marked as required apply when you send the group.
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
ente | integer | 1 | Type of government body that hires the service. 1 - Federal Government (União) | |
aliquota_reducao | number or numeric string | - | Rate reduction percentage applied to the government body. The API formats it with 4 decimal places. For example, 50.0000 means a 50% reduction, and 0.5000 means 0.5%. | |
tipo_operacao | integer | 1 | Type of transaction with the government body. 1 - Supply with later payment | |
referencias_dfe | array (string 44) | 0-99 | Access keys of earlier electronic tax documents (DFe) referenced. Accepts both the numeric format (44 digits) and the alphanumeric format of the tax reform (RTC) [0-9]{6}[A-Z0-9]{12}[0-9]{26}. Required when tipo_operacao is 2 or 3; not allowed when it is 1 or 4. |
Sample fragment of a government purchase: ente 2 (State), 50% reduction and tipo_operacao 3 (supply with payment already made). Replace the zero key with a real key of the transaction, and include the other required fields of the issuing request.
{
"impostos": {
"ibs_cbs": {
"situacao_tributaria": "200",
"classificacao_tributaria": "200050",
"compra_governamental": {
"ente": 2,
"aliquota_reducao": "50.0000",
"tipo_operacao": 3,
"referencias_dfe": [
"00000000000000000000000000000000000000000000"
]
}
}
}
} pgtoVinc) and through later events (110300, Payment Link, and 110301, Payment Link Cancellation). The fields below apply to both the CT-e and the CT-e OS.To report payments that are already linked when you issue the CT-e, send the optional pagamentos_vinculados array with 1 to 99 entries. Each entry is one payment transaction linked to the tax document. The fields below are required when you send the array:
| Parameter | CT-e | Type | Size | Description |
|---|---|---|---|---|
n_pag | integer | 1-3 | Sequence number of the payment in the CT-e (1 to 990). Must be unique in the array. | |
id_transacao | string | 2-35 | Unique ID of the payment transaction, created by the payment service provider (PSP) or acquirer. Must be unique in the array. | |
tp_meio_pagamento | string | 2 | Payment method code from the official SEFAZ table (RTC). See the full table below. | |
cnpj_recebedor | string | 14 | CNPJ (company ID) of the party that receives the payment, in the alphanumeric RTC format ([A-Z0-9]{12}[0-9]{2}), with valid check digits. The first 12 characters can be letters or digits; the last 2 are check digits. | |
cnpj_base_psp | string | 8 | Base CNPJ (root) of the PSP, the payment service provider, in the alphanumeric RTC format ([A-Z0-9]{8}). |
Official table of payment methods (RTC):
| Code | Description |
|---|---|
01 | Cash |
02 | Check |
03 | Credit card |
04 | Debit card |
05 | Store credit (crédito loja) |
10 | Food voucher |
11 | Meal voucher |
12 | Gift voucher |
13 | Fuel voucher |
14 | Trade bill (duplicata mercantil) |
15 | Bank payment slip (boleto) |
16 | Bank deposit |
17 | Instant payment (PIX), dynamic |
18 | Bank transfer / Digital wallet |
19 | Loyalty program / Cashback / Virtual credit |
20 | Instant payment (PIX), static |
21 | In-store credit (crédito em loja) |
22 | Electronic payment not reported — system failure |
23 | Instant payment (PIX) — scheduled |
24 | Employee credit |
90 | No payment |
91 | Drawback transactions or special customs regimes |
99 | Other |
Example when you issue the CT-e:
"pagamentos_vinculados": [
{
"n_pag": 1,
"id_transacao": "TX-2026-0001",
"tp_meio_pagamento": "17", // Dynamic PIX
"cnpj_recebedor": "12ABC34501DE35",
"cnpj_base_psp": "12ABC345"
}
] 110300, Link a Payment, or cancel it with the event 110301, Cancel a Payment Link.The XML and the PDF of each document are at the URLs returned in the response, in the lookup and in the notification. For security, Webmania restricts access to these files.
The tax document is protected with a password. It opens only after you confirm the CPF/CNPJ (tax ID) of the document recipient, or with one of the access methods below: Access credentials, Token, Issuing IP or Webmania® Panel.
Ways to access the files:
| Authentication | Access allowed | Password required? | Description |
|---|---|---|---|
Access credentials | ✅ | No | Send the company's access credentials in the request HEADER to access every tax document issued by the company. Authorization: Bearer YOUR_ACCESS_TOKEN |
Token | ✅ | No | Send the encrypted token in the URL to open the tax document for 24 hours without a password. Ideal for sharing a link.?token=[TOKEN]The token is not available for tax documents without a recipient. |
Issuing IP | ✅ | No | When you issue an invoice, the IP address of the computer or server is permanently registered as authorized. That IP can access every tax document issued by the companies it has access to. IPs authorized automatically |
Webmania® Panel | ✅ | No | When you log in to the Webmania® Panel, you can access every tax document issued by the companies of your account. Access lasts while you are logged in to the Webmania® Panel.Access while you are logged in |
No authentication | ❌ | Yes | When the URL is opened publicly, without authentication, the tax documents are protected with a password. To open them, enter the CPF/CNPJ of the document recipient (numbers only, no punctuation).PDF = password-protected PDF fileAccess without authentication is not available for tax documents without a recipient. |
To download the files to your server, use the Access credentials. To give your customer a link without a password, use the Token.
With the company's access credentials in the request header, you can download every tax document issued by the company.
To download a file, send a GET request to the URL of the XML or the PDF, with the credentials in the header. Example with the PDF:
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api.webmania.com.br/dacte/00000000000000000000000000000000000000000000The response is the file itself, as application/pdf or text/xml.
The token opens the XML and the PDF without a password for 24 hours, so you can share the link with your customer safely.
To share the file, generate the token encrypted with AES-256-CBC and send it in the token parameter of the file URL:
https://api.webmania.com.br/dacte/00000000000000000000000000000000000000000000?token=[TOKEN]The step-by-step guide to generate the token, with functions in PHP, Python, Java, C# and Ruby, is on the Webmania GitHub (in Portuguese): https://github.com/webmaniabr/DFeToken.
The lookup returns the current status of a CT-e or CT-e OS of the authenticated company. It works even while the document is processando or contingencia. Use the notifications to follow your documents day to day. Use the lookup to check one document when you need to.
To look up a CT-e, send a GET request to /2/cte/consulta/{identifier}. Replace {identifier} with the uuid (36 characters) or the chave (access key, 44 characters) of the CT-e.
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
https://api.webmania.com.br/2/cte/consulta/00000000000000000000000000000000000000000000 The response has the same fields as the notification, described in Notification fields:
cte, not in numero;modelo identifies the document: cte or cte_os;epec tells whether the EPEC event was issued (false when it was not);xml_cancelamento is present only when the status is cancelado;log is structured (object or array), not a JSON string.Example of an HTTP 200 response:
{
"uuid": "00000000-0000-0000-0000-000000000000", // Unique ID
"chave": "00000000000000000000000000000000000000000000", // Access key at SEFAZ
"status": "aprovado", // aprovado, reprovado, denegado, cancelado, processando or contingencia
"motivo": "Autorizado o uso do CT-e", // Reason for the status
"serie": 1, // CT-e series
"cte": 123, // CT-e number
"modelo": "cte", // cte or cte_os
"epec": false, // Whether the EPEC event was issued
"xml": "https://api.webmania.com.br/xmlcte/[chave]",
"dacte": "https://api.webmania.com.br/dacte/[chave]",
"log": {} // Sample content; check the actual SEFAZ response
} The cancellation registers an event at SEFAZ that voids an authorized CT-e or CT-e OS, for example when the transport service does not take place. Only a document with status aprovado can be canceled.
To cancel a CT-e, send a PUT request to /2/cte/cancelar. Send the uuid or the chave of the CT-e and the justificativa (reason) for the cancellation.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
uuid | chave | Required | string | 36 | 44 | UUID or access key of the CT-e |
justificativa | Required | string | 15-255 | Reason for the cancellation |
curl -X PUT \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chave": "00000000000000000000000000000000000000000000",
"justificativa": "Cancelado por motivos administrativos."
}' \
https://api.webmania.com.br/2/cte/cancelar The response has status, motivo, xml, xml_cancelamento and log:
| Situation | Response | What to do |
|---|---|---|
| Cancellation approved by SEFAZ | status = cancelado | Store the xml_cancelamento. Webmania also sends the cancelado notification. |
| Cancellation not approved | status = reprovado | The CT-e stays authorized. Read the motivo before you try again. |
Example of an HTTP 200 response for an approved cancellation:
{
"status": "cancelado", // cancelado or reprovado
"motivo": "Evento registrado e vinculado a CT-e", // Text returned by SEFAZ
"xml": "https://api.webmania.com.br/xmlcte/[chave]",
"xml_cancelamento": "https://api.webmania.com.br/xmlcte/[chave]/cancelamento",
"log": {} // Sample content; check the actual SEFAZ response
} The delivery confirmation registers the proof of delivery of the cargo at SEFAZ. It includes the image of the proof of delivery and the details of the person who received the cargo. It applies to an authorized CT-e; the CT-e OS does not have this event.
To confirm the delivery, send a POST request to /2/cte/entrega with the uuid or the chave of the CT-e and the parameters below.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
uuid | chave | Required | string | 36 | 44 | UUID or access key of the CT-e |
comprovante | Required | string | - - - | Image of the proof of delivery, encoded in base64 |
nome_recebedor | Required when documento_recebedor is sent; if both are omitted, the recipient is used | string | 2-60 | Name of the person or company that received the delivery |
documento_recebedor | Required when nome_recebedor is sent; if both are omitted, the recipient is used | string | 2-20 | ID document number of the person or company that received the delivery |
notas_fiscais | The NF-e linked to the CT-e are used | array (string 44) | 0-2000 | Invoices of the goods that were delivered |
data_hora | Optional; the current date and time are used | string | 19 | Date and time of the delivery Y-m-d H:i:s |
informacoes | Optional | string | 1-2000 | Additional information about the delivery |
longitude | Required when latitude is sent; if both are omitted, 0.000000 is used | string | - - - | Longitude of the delivery location, in decimal format |
latitude | Required when longitude is sent; if both are omitted, 0.000000 is used | string | - - - | Latitude of the delivery location, in decimal format |
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chave": "00000000000000000000000000000000000000000000",
"latitude": "2.123456",
"longitude": "2.123456",
"comprovante": "data:image/png;base64,...ElFTkSuQmCC"
}' \
https://api.webmania.com.br/2/cte/entrega Example of an HTTP 200 response for a registered delivery confirmation:
{
"status": "aprovado",
"motivo": "Aprovada a Confirmação de Entrega",
"xml": "https://api.webmania.com.br/xmlcte/00000000000000000000000000000000000000000000",
"log": {...}
} This event voids a delivery confirmation that was already registered. You identify the confirmation by the sequence number or the protocol number of the event. The CT-e stays authorized.
To cancel a delivery confirmation, send a PUT request to /2/cte/entrega/cancelar. Send the uuid or the chave of the CT-e and the sequencia or the protocolo of the confirmation.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
uuid | chave | Required | string | 36 | 44 | UUID or access key of the CT-e |
sequencia | protocolo | Required | string | - - - | Sequence number or protocol number of the delivery confirmation event |
curl -X PUT \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chave": "00000000000000000000000000000000000000000000",
"sequencia": "1"
}' \
https://api.webmania.com.br/2/cte/entrega/cancelar Example of an HTTP 200 response for a registered delivery confirmation cancellation:
{
"status": "cancelado",
"motivo": "Cancelamento de comprovante de entrega aprovado",
"xml": "https://api.webmania.com.br/xmlcte/00000000000000000000000000000000000000000000",
"log": {...}
} The correction letter (CC-e, Carta de Correção Eletrônica) is the event that fixes some information of an authorized CT-e or CT-e OS without canceling it. Each change gives the XML group, the XML field and the new value.
To issue a correction letter, send a POST request to /2/cte/correcao with the uuid or the chave of the CT-e and the alteracoes (changes).
What can the correction letter not fix?
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
uuid | chave | Required | string | 36 | 44 | UUID or access key of the CT-e |
alteracoes | Required | array | 1-n | Changes that the CC-e will carry. |
ambiente | Required when the original document was not issued through Webmania | integer | 1 | Environment in which the CT-e was issued1 - Production |
sequencia | Optional — calculated automatically when omitted | integer | 1-2 | Sequence number of the event, from 1 to 20. When omitted, the API takes the sequence of the last authorized CC-e for that access key and company and adds 1. |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
grupo | Required | string | 1-20 | XML group to changeExamples: rem, enderReme, dest, enderDest |
campo | Required | string | 1-20 | XML field to changeExamples: xFant, fone, xCpl, email |
valor | Required | string | 1-500 | Corrected value |
item | Required when the group is a list | integer | 1-2 (value from 1 to 99) | When the group of the field is a list, send the index of the list item to change |
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chave": "00000000000000000000000000000000000000000000",
"alteracoes": [
{
"grupo": "rem",
"campo": "xFant",
"valor": "Nome fantasia"
}
]
}' \
https://api.webmania.com.br/2/cte/correcao Example of an HTTP 200 response for a registered correction letter. The xml and the dacce (printable summary of the correction letter) are the files of the CC-e itself:
{
"uuid": "00000000-0000-0000-0000-000000000000",
"chave": "00000000000000000000000000000000000000000000",
"evento": 1,
"status": "aprovado",
"motivo": "Evento registrado e vinculado a CT-e",
"xml": "https://api.webmania.com.br/xmlcce/00000000-0000-0000-0000-000000000000",
"dacce": "https://api.webmania.com.br/dacce/00000000-0000-0000-0000-000000000000",
"log": {...}
} The event 110300 (Split Payment) registers at SEFAZ that a payment transaction is linked to a CT-e that is already authorized. Use it when the payment happens after the CT-e is issued. If the payment already exists when you issue the CT-e, send it in the pagamentos_vinculados group instead.
To link a payment, send a POST request to /2/cte/evento with the uuid or the chave of the CT-e and the pagamento object.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
uuid | chave | Required | string | 36 | 44 | UUID or access key of the authorized CT-e. |
protocolo | Optional — read automatically from the CT-e when omitted | string | 15 | Authorization protocol number of the CT-e (15 digits). |
sequencia | Optional — calculated automatically | integer | 1-3 | Sequence number of the event (1 to 999). If omitted, it is calculated from the events accepted before. |
pagamento | Required | object | — | Data of the payment transaction. Same structure as one item of pagamentos_vinculados (fields n_pag, id_transacao, tp_meio_pagamento, cnpj_recebedor, cnpj_base_psp). |
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chave": "00000000000000000000000000000000000000000000",
"protocolo": "135250000000001",
"pagamento": {
"n_pag": 1,
"id_transacao": "TX-2026-0001",
"tp_meio_pagamento": "17",
"cnpj_recebedor": "12ABC34501DE35",
"cnpj_base_psp": "12ABC345"
}
}' \
https://api.webmania.com.br/2/cte/evento Example of an HTTP 200 response for a registered payment link. Store the protocolo_evento: it identifies the link when you cancel it.
{
"status": "sucesso",
"evento": "110300",
"codigo": "135", // cStat 135 = event registered
"motivo": "Evento registrado e vinculado a CT-e",
"uuid": "00000000-0000-0000-0000-000000000000",
"chave": "00000000000000000000000000000000000000000000",
"protocolo_evento": "135250000000010", // Protocol of this event — used later to cancel it
"protocolo_cte": "135250000000001",
"data_evento": "2026-05-12T10:00:00-03:00",
"n_seq_evento": 1,
"pagamento": {}, // Object with the normalized payment data; sample content
"log": {} // SEFAZ response object; sample content
} The event 110301 (Split Payment) cancels a payment link event (110300) that is already registered. The CT-e stays authorized: only the payment link is undone.
To cancel a payment link, send a PUT request to /2/cte/evento/cancelar. Send the uuid or the chave of the CT-e and the protocolo_vinculacao or the sequencia_vinculacao of the 110300 event.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
uuid | chave | Required | string | 36 | 44 | UUID or access key of the CT-e. |
protocolo | Optional — read from the CT-e | string | 15 | Authorization protocol number of the CT-e. |
protocolo_vinculacao | sequencia_vinculacao | One of the two is required | string | integer | 15 | 1-3 | Identifies which 110300 event you are canceling. Send protocolo_vinculacao (protocol of the event) OR sequencia_vinculacao (sequence number of the registered event). |
sequencia | Optional — calculated automatically | integer | 1-3 | Sequence number of this cancellation event (1 to 999). |
curl -X PUT \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chave": "00000000000000000000000000000000000000000000",
"protocolo_vinculacao": "135250000000010"
}' \
https://api.webmania.com.br/2/cte/evento/cancelar Example of an HTTP 200 response for a registered payment link cancellation:
{
"status": "sucesso",
"evento": "110301",
"codigo": "135",
"motivo": "Evento registrado e vinculado a CT-e",
"uuid": "00000000-0000-0000-0000-000000000000",
"chave": "00000000000000000000000000000000000000000000",
"protocolo_evento": "135250000000011", // Protocol of this cancellation
"protocolo_cte": "135250000000001",
"protocolo_vinculacao": "135250000000010", // Echo of the canceled 110300 event
"data_evento": "2026-05-12T11:30:00-03:00",
"n_seq_evento": 1,
"log": {} // SEFAZ response object; sample content
} This lookup returns the history of the payment events (110300 and 110301) of a CT-e in eventos_pagamento, with the count in total_eventos. The CT-e lookup returns the document data without these events.
To look up the payment events, send a GET request to /2/cte/consulta/evento/{identifier}. Replace {identifier} with the uuid or the chave of the CT-e.
| Parameter (URL) | Required | Type | Size | Description |
|---|---|---|---|---|
{identifier} | Required | string | 36 | 44 | UUID of the CT-e (36 characters, case-insensitive) or access key (44 characters; both the legacy numeric format and the alphanumeric RTC format [0-9]{6}[A-Z0-9]{12}[0-9]{26} are accepted). |
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api.webmania.com.br/2/cte/consulta/evento/00000000000000000000000000000000000000000000 Example of an HTTP 200 response, partial and for illustration only. pagamento is an object when it was sent in the payment link event, and it can be null in the other events. The protocol, code and reason values depend on the response to each event.
{
"uuid": "00000000-0000-0000-0000-000000000000",
"chave": "00000000000000000000000000000000000000000000",
"total_eventos": 2,
"eventos_pagamento": [
{
"evento": "110300",
"codigo": "135",
"motivo": "Evento registrado e vinculado a CT-e",
"protocolo_evento": "135250000000010",
"data_evento": "2026-05-12T10:00:00-03:00",
"n_seq_evento": 1,
"pagamento": {}
},
{
"evento": "110301",
"codigo": "135",
"motivo": "Evento registrado e vinculado a CT-e",
"protocolo_evento": "135250000000011",
"protocolo_vinculacao": "135250000000010",
"data_evento": "2026-05-12T11:30:00-03:00",
"n_seq_evento": 1
}
]
} Webmania® uses the SEFAZ contingency environment automatically. When the state's SEFAZ (state tax authority) is offline, the CT-e is sent, in the same request, to the SVC (SVC-RS or SVC-SP), the SEFAZ backup authorization servers. Your application does not need to do anything.
If neither SEFAZ nor the SVC responds, or if SEFAZ has not given the result yet, Webmania completes the CT-e on its own:
| Situation | Status | What Webmania does |
|---|---|---|
| SEFAZ received the CT-e but has not answered yet | processando | Checks SEFAZ automatically until it gets the result. |
| SEFAZ and the SVC are unavailable | contingencia | Keeps the CT-e in a queue and sends it again when the connection comes back. Before sending it again, it checks SEFAZ so the same CT-e is not issued twice. |
processando and contingencia statuses are not notified and do not prove authorization. The url_notificacao receives the final result; until then, follow the CT-e through the lookup, without issuing it again.The final result, aprovado or reprovado, arrives in the notification and is also available in the lookup. Until then, do not issue the same CT-e again.
EPEC (Evento Prévio de Emissão em Contingência, a prior contingency issuing event) is not used for new documents. When SEFAZ and the SVC are unavailable, the CT-e goes to the contingency queue described above.
The epec field is still in the response and tells whether the document was issued in EPEC. CT-e issued in EPEC in the past are still reconciled automatically.
The Webmania® API runs on Amazon AWS, the global leader in cloud computing, in the us-east-1 region (US East), with a point of presence in sa-east-1 (São Paulo). The entry point is anycast and highly available: from anywhere in the world, your request goes to the server closest to you.
The same entry IPs serve the whole world. Your request goes to the server closest to you, with no setup on your side.
us-east-1 (US East) and sa-east-1 (São Paulo). Keep your infrastructure close to one of them for a shorter response time.
Fixed IPs for inbound and outbound traffic: allow them in your firewall and check the source of the notifications you receive.
13.248.145.9076.223.17.24034.196.69.3844.219.142.86The Webmania® API limits the number of requests per second to keep every integration stable and fast. Each limit is counted per second, separately for each HTTP method and each endpoint.
Reading: lookups and lists.
Creating: issuing and other submissions. See the specific limits below.
Changing and removing resources.
Some endpoints have a lower limit, which applies instead of the method's limit:
| Request | Limit | Reason |
|---|---|---|
| Issuing in the sandbox (homologação) | 1 request per second | Test environment for your integration. |
Need a higher request volume? Contact us and we will review it.
A request over the limit is refused with HTTP 429 (Too Many Requests) before it is processed. Nothing is issued, changed or canceled, and you can safely resend the same request.
| Header | Example | Description |
|---|---|---|
Retry-After | 1 | Seconds to wait before you resend the request. If the response does not include this header, wait 1 second. |
Example of an HTTP 429 response. The API sends the message in Portuguese; it means “Request limit reached. Try again in a few seconds.”:
{
"error": "Limite de requisições atingido. Tente novamente em alguns segundos."
}
429, not by the text of the error field: the message can change from one endpoint to another.Retry-After header, or 1 second if the header is missing.Receive the API results at your notification URL instead of polling in a loop. When a result arrives, update your database and download the PDF and the XML.
Spread your requests through a queue that respects the per-second limit of each method, instead of sending everything at once.
The endpoints require valid access credentials in the request header. Sending them incorrectly is treated as misuse of the API.
By default, the firewall blocks servers in regions with a high rate of attacks or a poor reputation. If a GET to https://webmania.com.br/api/ or https://api.webmania.com.br returns 403 Forbidden by mistake, contact us and we will allow your IP.
The notes of this version are in the Portuguese changelog.
Changed sections: observacoes-contribuinte-fisco, reforma-tributaria-credito-presumido
CT-e and CT-e OS have a new section, IBS/CBS — Simples Nacional: what changes for each type of company, the tax regime set in the company record, the Simples rates and the dates per environment.
Changed section: reforma-tributaria-simples-nacional
The contingency section now has a flowchart from the request to the final result, with SVC and the contingency queue. EPEC is no longer used for new documents.
Changed sections: contingencia, epec
The documentation is now LLM-ready: copy the page or each section as Markdown, a section index and llms.txt.