Your system creates the order, someone re-types the invoice: integrating e-Fatura in Türkiye
Short answer: there are three ways to connect your software to Türkiye's e-invoicing system, and for most companies the right one is the third. The Revenue Administration portal is free, but someone types each invoice by hand. Direct integration means running a messaging node that holds a 24/7 connection to the tax authority from your own servers. A private integrator runs that node for you, and you only write the part on your side. Either way, producing XML is not the hard part. The hard parts are deciding which business event creates an invoice, checking whether the buyer is registered for e-Fatura, settling who assigns the document number, designing cancellation and credit-note flows, and reconciling counts every day. No integrator does any of that for you.
Three methods, and the difference is responsibility rather than price
The Revenue Administration (Gelir İdaresi Başkanlığı, GİB) defines three methods, and two of them have confusingly similar names.
The e-Fatura Portal is a free web application. GİB describes it as being for users who lack sufficient infrastructure to use the application through integration. Invoices are either keyed in on screen or prepared in your own system and uploaded to the portal account. Fine for a company issuing a few invoices a month, useless for one issuing fifty a day.
Integration, usually called direct integration, is described by GİB as being for taxpayers who can integrate their own IT system with the Administration's system and maintain an uninterrupted 24/7 connection. That is not a description of obtaining an API key. It is a description of building and operating software that speaks the Administration's data transfer protocol end to end.
The third method is the private integrator (özel entegratör): you send and receive invoices through the system of a company that holds a special integration permit. GİB publishes the list of permitted companies per document type, so who you may work with is public information. One thing to keep in mind: e-Fatura, e-Arşiv, e-İrsaliye (despatch advice) and e-SMM are separate applications. Being live on e-Fatura does not cover the others. Each one means a separate registration and a separate piece of work.
What you take on with direct integration
The integration guide defines three roles: the Sender Unit (Gönderici Birim), the Centre (Merkez) and the Mailbox (Posta Kutusu). The Centre is the tax authority's side. Go direct and you implement the other two. You become the party that builds, signs, envelopes and transmits outgoing invoices, and also the party that receives incoming invoices, validates their signatures and produces responses.
The guide attaches concrete obligations to those roles: logging at every step, disaster recovery mechanisms, business continuity, and a system that is available at all times. The connection is registered against a static IP, and that IP is expected to be in Türkiye's range. Group companies sharing one IP, or a system administered from abroad, are handled as separate applications.
The process starts well before any code. The financial seal (mali mühür) and credentials come from TÜBİTAK KamuSM. Then you file an IT System (BİS) Report and a Test Definition Form, GİB issues test accounts, you work through the published test plan, and after passing it you submit a Live Definition Form to move to production. None of these steps is difficult on its own. What is difficult is keeping that infrastructure healthy for years, tracking every guide revision, and having nobody to call on a Monday morning when system responses stop arriving. Direct integration makes sense for high-volume companies with a real IT department. It rarely makes sense for a fifty-person manufacturer.
Who gets an e-Fatura is the result of a lookup
The core rule of the system is that e-invoices only travel between registered users. If the counterparty is not registered, you cannot send them an e-Fatura; you issue an e-Arşiv invoice instead, which goes to buyers who are not registered in the e-Fatura system, including consumers. GİB publishes the registered-user list and a separate guide covering how to consume it.
Two mistakes come out of this in practice. The first is downloading the list once and forgetting it. Companies join the system continuously, so a customer you invoiced through e-Arşiv last month may be a registered e-Fatura user this month, and the invoice you just issued went out the wrong way. Refresh the list daily, and check again by tax number at the moment the invoice is created rather than at the moment the customer record was saved.
The second mistake is the alias. A recipient can have more than one mailbox alias, and an invoice sent to the wrong one looks successful on your side while never reaching the buyer's books.
Where you run the check matters too. Showing a salesperson "this customer is a registered e-Fatura user" while they are still on the customer screen is cheaper than reissuing forty invoices at month end. If the tax number field in your data model is free text that happily accepts a leading space and a trailing period, the problem started before the integration did.
The document number is not your order number
An e-Fatura document number is sixteen characters: a three-letter series, a four-digit year and a nine-digit sequence, so something like ABC2026000000001. Each series advances without gaps. Your internal invoice ID is a different thing, and trying to make the two identical costs you later.
Decide early who assigns the number, you or the integrator. Both work, but only one party can own it. If both generate numbers you end up with either gaps or collisions, and both land on your accountant's desk. When the integrator assigns it, write the returned document number and the document UUID (ETTN) back into your own records. That mapping table is the only way to answer "what happened to this invoice" six months from now.
A sent envelope is not a delivered invoice
The protocol is asynchronous. An invoice is prepared as XML against the UBL-TR schema, signed with at least the XAdES-BES standard or approved with a financial seal, compressed, and placed inside another XML document called the envelope (ZARF). Envelope types differ by document: invoices travel as SENDERENVELOPE, application responses as POSTBOXENVELOPE, system responses as SYSTEMENVELOPE.
When you send an envelope, a system response comes back, and only that response settles the outcome. The Centre runs XSD and Schematron checks, verifies sender and recipient addresses and checks that a signature or seal is present, but it does not validate the signature itself. Validation is the job of the sender unit and the mailbox, which means it is a step you have to write.
The software consequence is clear enough: sending an invoice is not an HTTP call, it is a state machine. Prepared, signed, sent, awaiting system response, accepted, rejected, cancelled. Every one of those states should be visible in your database. Put the sending step on a queue and make retries idempotent. Sending the same invoice twice is the most expensive kind of duplicate record problem, because fixing it runs through the cancellation process described next.
Basic or commercial: the eight-day window
Choosing the scenario is a business decision, but your software carries the consequence. In the commercial invoice scenario the buyer returns an application response: accept, reject or return. The guide defines an eight-day window for it. The mailbox has to send the response within eight days and block any later attempt, while the sending side must refuse responses arriving after eight days and, where several responses arrive for one invoice, process only the first.
The basic invoice scenario has no rejection mechanism inside the system. Cancellations and objections run through the separate notification process and guide that GİB publishes for them. Which is to say your software cannot have a delete button on an issued invoice.
In product terms: a cancellation is not a deletion, it produces another document or a notification. If you do not design what happens when sales says "let's pull that invoice back", the work falls to a spreadsheet maintained by accounting, and six months later nobody can reconcile the two lists.
The rendering is not the invoice
The XML has to carry an XSLT that defines how the document is displayed. The guide sets a clear precedence rule here: where the XSLT rendering and the invoice XML differ, the information in the XML prevails.
Teams break this rule often. They design the invoice as a PDF first, then try to make the XML match it. The correct order is the reverse: the document rendering is derived from the XML. An amount that differs between the printout the customer received and the XML the tax authority holds is the kind of error that takes months to surface and requires retroactive correction once it does.
Most errors start on the ERP side
Once you are live, most of the errors you see come from your own data rather than from the connection. Rejected documents usually trace back to the same handful of causes: a missing or malformed tax number, an undefined unit code, line totals that disagree with the document total at the kuruş level, a VAT rate that does not match the calculated amount, or a blank code on a withholding or exemption case.
If you invoice in foreign currency, exchange rates and rounding rules are a topic of their own. Hold amounts as floating point numbers and the error eventually reaches the XML as a rounding difference, and it always surfaces at the same moment: month end, on your largest customer's invoice.
This is why planning the work as a standalone "e-invoicing project" misleads people. Half of it is making sure the data is collected correctly before any invoice exists. Validate mandatory fields when the customer record is created, not when the invoice is issued. That work pays for itself with or without the integration.
Test environment, parallel run, daily reconciliation
GİB operates a test environment, and private integrators run their own. Work through the scenarios there before a real invoice exists: basic and commercial invoices, credit notes, cancellations, foreign currency, different VAT rates, long legal names, addresses with Turkish characters, and the case where the buyer is not a registered e-Fatura user.
When you go live, run in parallel for a week. Put four numbers side by side every day: how many invoices were created, how many were sent, how many received a positive system response, and how many matched an accounting entry. When the numbers disagree the cause is usually a definition, with one count measuring created invoices and another measuring delivered ones. Keep those four numbers after go-live as well. Without daily reconciliation you do not know the integration works, you only know it has not raised an error.
If you have to switch providers
There are plenty of private integrators, and switching is possible. What makes switching easy is putting the integration behind one interface from the start. If the integrator's library is scattered across forty places in your codebase, a move takes a month; behind a single adapter, a few days.
Keep three things on your own side: the signed XML itself, the mapping between document numbers and UUIDs, and the logs of what you sent and what came back. The retention obligation is yours, and GİB publishes a separate archiving guide for it. The financial seal is also issued in your company's name, not the integrator's. Whose name the accounts and certificates are in is the single most argued point when a contract ends.
The integrator is a third-party service like any other. Decide in advance whether invoices queue during an outage, what the user sees, and at which point you fall back to paper, and design that path before you need it. Designing it on the day of the outage costs more than the outage.
Where to start this week
Answer three questions in writing. How many invoices do you issue per month, how many of those go to buyers who are not registered e-Fatura users, and who creates the invoice on which screen. The first number decides the method, the second sizes the e-Arşiv side, the third tells you which module the integration attaches to.
Then measure one thing in your customer records: what share of tax number fields are populated and correctly formatted. Anything below one hundred percent is work to be done before the integration, not after. Registration thresholds are revised each year by communiqué, so confirm with your accountant which date brings you into scope, and we can plan the technical side around that calendar.
Need help with this topic?