Home / Knowledge Centre / e-Invoice API, JSON & XML Basics
Knowledge Centre · Technical

e-Invoice API, JSON & XML Basics

Definition: The MyInvois API is the technical interface LHDN provides for submitting e-Invoices as structured data — in JSON or XML format — rather than as a PDF or image. Software providers like TxBilling connect to this API so business owners don't need to touch it directly.

You don't need to be technical to run a compliant business, but a plain-English understanding of what's happening "under the hood" helps demystify why e-Invoice feels more involved than just emailing a PDF.

Why not just submit a PDF?

A PDF is essentially a picture of text — a computer can't reliably extract the invoice amount, buyer's TIN, or item codes from it without error-prone processing. JSON and XML are structured formats: every piece of data has a clearly labelled field (e.g. "totalAmount": 150.00), so LHDN's MyInvois system can validate it automatically, at scale, in near real-time.

JSON vs XML — do I need to know the difference?

Not really, unless you're a developer. Both are ways of structuring the same underlying invoice data; MyInvois supports both formats for submissions. If you're using software like TxBilling, this is entirely handled for you — you fill in a normal-looking invoice form, and the software converts and submits it correctly behind the scenes.

What "the API" actually does

  1. Your billing software packages your invoice data into the correct structured format.
  2. It authenticates with LHDN's MyInvois API (see our related guide on digital signatures).
  3. It submits the data for validation.
  4. LHDN's system validates the fields (correct TIN format, valid amounts, etc.) and returns a validated e-Invoice with a unique identifier and QR code, or an error if something's wrong.
  5. Your software receives that response and shows you the validated e-Invoice, ready to send to your customer.

When this matters directly to you

FAQ

Why is an e-Invoice submitted as JSON or XML instead of a PDF?

JSON and XML are structured formats computers can validate automatically. A PDF is just an image of text, which doesn't support automated, real-time validation of individual fields like amounts and TIN.

Do I need to understand JSON/XML to use e-Invoice?

No — not if you use compliant software or the MyInvois Portal. It becomes relevant mainly if you're building a custom, direct integration.

Can TxBilling connect to my own systems via API?

Yes — TxBilling offers a REST API and middleware for POS/ERP integrations, alongside its own e-Invoice submission to LHDN MyInvois.

Related reading

WhatsApp Book Demo