CT-e Integration with SEFAZ: How It Works and What We Learned in Production
By Ana da Forcoder6 min read

The CT-e (Electronic Transport Document) is the tax document for transportation services. Every carrier charging freight between municipalities issues a CT-e, and each one goes through SEFAZ before it is valid. For anyone developing or hiring a transportation system, integrating CT-e issuance is the first and often most demanding step.
Forcoder has been issuing CT-e in production since July 2026 in LogFrota, the TMS we built. In this article, we explain how CT-e integration with SEFAZ works, pitfalls we've encountered, and what your company should expect from any integration provider.
What CT-e Integration Is and Who Needs It
Integrating CT-e means having the system assemble the knowledge XML, sign it with the carrier's A1 certificate, transmit it to the authorizing SEFAZ, receive the protocol, and store everything, so the operator doesn't have to re-enter freight details into a separate issuer.
It's suited for carriers with their own systems, logistics software companies wanting to issue within their products, shippers with their own fleets, and operators who currently enter data twice. The benefits are clear: the CT-e is generated directly from cargo data, the goods invoice is imported via XML, and the billing title is created simultaneously.
How CT-e Issuance Works Technically
- Cargo data. Shipper, recipient, payer, goods invoices, values, freight components, and taxes.
- Pre-numbering validations. Registry, CFOP, payer, and ICMS rules are validated before reserving a number.
- XML creation and signing. The layout 4.00 XML is built and signed with the branch's A1 certificate.
- Transmission and protocol. SEFAZ authorizes or rejects; the authorized XML and protocol are stored.
- DACTE and next steps. The DACTE is generated in PDF, insurance is notified, and the billing title is created.
In LogFrota, we use open source libraries from the NFePHP project for communication, plus our own layer for transportation rules and error handling.
Pitfalls We've Learned to Avoid
Numbering That Can't Be Reversed
The CT-e number is reserved before transmission. If any internal validation fails after reserving, that range creates a gap that needs to be invalidated. That's why all possible local checks are performed before a number is reserved.
Communication Failures Are Not Rejections
If SEFAZ doesn't respond, the CT-e is held and automatically resent. If SEFAZ returns a rejection code, the error is in what was sent, and resending won't solve it. Distinguishing between these scenarios avoids pointless retries and reduces unnecessary truck downtime.
Contingency Changed in 2026
NT 2026.004 eliminated EPEC and the security form from CT-e and introduced offline contingency. When the authorizing SEFAZ is down, the first attempt is SVC, which authorizes on the spot; if that also fails, the operator can issue in offline contingency mode. The DACTE will show the proper banner, and the system transmits the same XML when SEFAZ comes back online. This is a user-confirmed, never automatic, decision.
Correction Letter Has Limits
The correction letter (CC-e) can adjust certain CT-e fields, but regulations prohibit changing values that impact taxes, replacing the shipper, recipient, or payer, or altering the issue date. We've created a ready-made list of common transport fields that can be updated, implemented legal restrictions, and generate the correction PDF for sending to clients.
Homologation Looks Like Production
In homologation, the CT-e has no fiscal value. It's a single switch per company, the new environment starts off in homologation, and test PDFs get a watermark. No one confuses a test with a real CT-e.
What Comes with the CT-e
The CT-e rarely travels alone. On the same trip, you'll find the SEFAZ certificate and contingency, the MDF-e accompanying the vehicle, CIOT when there's a freelance carrier, the toll voucher, and insurance notification. In LogFrota, goods invoices can be imported automatically via SEFAZ document distribution, and shippers can send cargo by file, triggering automatic CT-e issuance.
There's also consolidated CT-e, subcontracting, and forwarding, each with specific payer and prior document rules the system must understand. For a broader overview, see our article on integrations for carriers and TMS.
Tax Reform and the CT-e
IBS and CBS are coming to the CT-e through new groups. LogFrota already runs the official Receita calculator in its own environment for computing and cross-checking IBS/CBS on the CT-e, both for normal and simplified tax regimes. Integrations developed today must account for this change.
How Forcoder Manages a CT-e Project
Before writing any code, we analyze the carrier's actual operation: which CT-e types it issues (normal, supplementary, replacement), who typically pays, which states are served and how ICMS is handled in each, whether there's forwarding or subcontracting, and how goods invoice data arrives. This mapping defines the checks needed before reserving a document number.
Then comes the non-coding stage: getting an A1 certificate for each issuing branch, registering with the authorizing SEFAZ, and ensuring the branch records are complete, with address and state registration correct. Many early rejections stem from registration errors, not technical ones.
In homologation, we issue using real operational data rather than generic examples, ensuring rejections happen in testing, not on loading day. When going live, we monitor the first CT-es alongside the client's team, and every new rejection is cataloged and turned into code rules and on-screen explanations.
CT-e Integration Checklist
- Direct SEFAZ issuance in production, not just in test
- A1 certificate per branch, with validity checks
- All validations before document numbering
- SVC and offline contingency per NT 2026.004
- Correction letter with legal checks and PDF
- On-screen explanations for rejections
- DACTE in PDF, including batch generation
- Integration with insurance, MDF-e, and billing
Why Choose Forcoder for CT-e Integration
You only learn tax integration with real rejections, new technical notes, and SEFAZ outages on shipping day. Forcoder has dealt with all of this in LogFrota and brings that experience to your system, whether it's a full TMS or just a CT-e module inside your product.
Check out Forcoder's services, contact us, or reach out via WhatsApp to discuss CT-e integration for your company.
Frequently Asked Questions
Do I need an A1 certificate to issue CT-e through the system?
Yes. The CT-e is signed with the issuing company's digital certificate. We support A1, which can be used on the server without a physical device.
What if SEFAZ is offline?
The system will attempt SVC, which authorizes immediately. If that fails too, the operator can issue in offline contingency mode and the system will transmit the CT-e later.
Can I issue a CT-e using the NF-e XML?
Yes. In LogFrota, the goods invoice XML fills in the CT-e, including when imported from the shipper’s file.
Can Forcoder integrate CT-e in an existing system I have?
Yes. Issuance can be a module within your system or a separate service called via API.







