The MyInvois API lets your ERP or billing system send e-invoices straight to LHDN. Your system signs in with a client ID and secret, submits UBL 2.1 documents in XML or JSON (signed with a digital certificate in version 1.1), and then checks back, because validation happens after submission. Plan for LHDN's limits of 100 documents and 5 MB per submission, the 72-hour cancellation and rejection windows, and per-endpoint rate limits.
Malaysian businesses can send e-invoices to LHDN in three ways: by hand through the MyInvois Portal, through the MyInvois API, or through a Peppol service provider. The portal works for a handful of invoices a month. Once invoices come out of an ERP, a billing system or an online store, typing them into a portal stops working, and you need the API or a provider.
This guide is about the API: what your system has to do, and the limits that shape the design. Everything here comes from LHDN's MyInvois SDK documentation, which is the place to check before you build.
The API uses OAuth 2.0 with the client credentials flow. Your system sends its client ID and client secret to the identity service's token endpoint and gets back an access token that is valid for 60 minutes. Cache the token and refresh it before it expires, rather than signing in for every call: the sign-in endpoint is limited to 12 requests a minute.
You create the client ID and secret yourself in the MyInvois Portal, under the option to register an ERP system. The sandbox and production environments have separate credentials, and the taxpayer's TIN on each invoice must match the TIN the credentials belong to. A 403 error when signing in to the sandbox usually means production credentials are being used there.
| Environment | Portal | API and identity service |
|---|---|---|
| Sandbox (pre-production) | preprod.myinvois.hasil.gov.my | preprod-api.myinvois.hasil.gov.my |
| Production | myinvois.hasil.gov.my | api.myinvois.hasil.gov.my |
Documents follow the UBL 2.1 standard and can be sent as XML or JSON. Each one goes into the submission base64-encoded, with its SHA-256 hash and your own invoice number. The supported types are invoice, credit note, debit note and refund note, plus self-billed versions of all four for cases where the buyer issues the invoice, such as purchases from individuals or foreign suppliers.
Each document type has versions. Version 1.1 requires a digital signature. Version 1.0 has the same structure without signature validation; LHDN still accepts it for now but says it will be retired, so build on 1.1. Versions 1.2 and 1.3 exist only for LHDN's voluntary disclosure programme, which runs until 31 December 2027.
Version 1.1 documents are signed with an organisation certificate: an X.509 certificate from a certificate authority licensed in Malaysia by the MCMC. The certificate carries your TIN and business registration number, and must allow non-repudiation and document signing.
The signature is an enveloped XAdES signature using RSA with SHA-256, with exactly one signature per document. Store the certificate's private key in a key vault or hardware module, not in the application's config, and track the certificate's expiry date: an expired certificate stops every invoice.
Your system sends documents in batches to the submit endpoint. LHDN sets three limits on each submission:
| Limit | Value |
|---|---|
| Documents per submission | 100 |
| Size of one submission | 5 MB |
| Size of one document | 300 KB |
A successful call returns HTTP 202, not 200, because validation isn't finished yet. The response holds a submission ID, a list of accepted documents with the unique ID LHDN assigned to each, and a list of documents rejected straight away with the reason. Store LHDN's document ID against your own invoice number: every later call uses it.
Sending the same submission again within 10 minutes returns a duplicate error with a Retry-After header. That protects you from double invoicing on retries, but only if your retry logic respects the header instead of rebuilding the batch.
LHDN validates documents after accepting the submission. Your system checks the submission's status until processing finishes, waiting longer for larger batches. Each document ends up as valid or invalid; the full set of statuses is submitted, valid, invalid and cancelled.
Only a valid document is a real e-invoice. Once it is valid, LHDN returns a long ID, which you combine with the document ID and the portal address to make the validation link. That link goes on the invoice as a QR code, so the buyer can check it on LHDN's portal.
The issuer can cancel a valid document within 72 hours of it being validated, with a reason. The buyer can ask to reject it within the same 72-hour window, and can do so only once. A rejection request doesn't cancel the invoice: it stays valid until the issuer cancels it. For self-billed documents, the buyer is the issuer, so the buyer cancels.
After 72 hours, mistakes are fixed with a credit, debit or refund note that references the original document's ID. Build that into your billing system's correction flow from the start.
Limits are per client ID, per minute. Going over returns HTTP 429 with a Retry-After header, and the sandbox has lower limits than production. The ones that shape most designs:
| Endpoint | Requests per minute |
|---|---|
| Sign in | 12 |
| Submit documents | 100 |
| Get submission (status) | 300 |
| Get document | 60 |
| Cancel document | 12 |
| Reject document | 12 |
| Search documents | 12 |
With 100 documents per submission and 100 submissions a minute, raw throughput is rarely the problem. Sign-in, cancellation and search are where systems hit the limits, usually because of a missing token cache or a reconciliation job that searches document by document.
It is LHDN's API for submitting e-invoices directly from an ERP or billing system. Systems sign in with a client ID and secret, submit UBL 2.1 documents in XML or JSON, and check their validation status.
Up to 100 documents per submission, with a maximum of 5 MB per submission and 300 KB per document.
Version 1.1 documents do, using an organisation certificate from a certificate authority licensed by the MCMC. Version 1.0 has no signature validation and is still accepted for now, but LHDN says it will be deprecated.
The issuer can cancel within 72 hours of the document being validated. After that, corrections are made with a credit, debit or refund note.
Talk to the engineers who do this work every week. Replies within one working day.