
Malaysia E-Invoice Technical Requirements: API, Format & Validation Rules
Tax & Compliance Series
This guide is part of a comprehensive series. Explore all 202 topics:
MyInvois Technical Architecture
The MyInvois system is built on modern API standards, making it accessible for both enterprise ERP systems and smaller invoicing tools. LHDN provides two integration paths: direct API and the MyInvois portal.
The MyInvois system is built on modern API standards, making it accessible for both enterprise ERP systems and smaller invoicing tools. LHDN provides two integration paths: direct API and the MyInvois portal.
API Integration Overview
Authentication
MyInvois uses OAuth 2.0 for API authentication:
- Register your application on the MyInvois developer portal
- Obtain your client ID and client secret
- Request an access token using client credentials grant
- Include the bearer token in all subsequent API calls
Access tokens expire after a set period — your system must handle token refresh automatically.
Key API Endpoints
- Submit Document — POST to submit a new e-invoice for validation
- Get Document Status — GET to check if a submitted invoice has been validated
- Cancel Document — request cancellation within the allowed window
- Search Documents — query your submitted documents
- Get Document Details — retrieve the full validated document with QR code
Supported Formats
MyInvois accepts e-invoices in two formats:
- XML — based on UBL 2.1 / Peppol BIS Billing 3.0
- JSON — a JSON representation of the same data structure
Both formats require the same mandatory fields. Choose based on your system's capabilities — most modern APIs prefer JSON.
Document Types
MyInvois supports several document types:
MyInvois supports several document types:
| Type Code | Document | Use Case |
|---|---|---|
| 01 | Invoice | Standard sales invoice |
| 02 | Credit Note | Adjust/reduce a previous invoice |
| 03 | Debit Note | Adjust/increase a previous invoice |
| 04 | Refund Note | Full refund of a previous invoice |
| 11 | Self-Billed Invoice | Buyer-issued invoice |
| 12 | Self-Billed Credit Note | Adjustment to self-billed invoice |
Validation Rules
LHDN validates each submitted document against a comprehensive ruleset:
LHDN validates each submitted document against a comprehensive ruleset:
- TIN validation — both supplier and buyer TINs must exist in LHDN's database
- Business registration validation — registration numbers cross-checked
- MSIC code validation — must be a valid Malaysia Standard Industrial Classification code
- Mathematical accuracy — line totals must add up correctly; tax calculations verified
- Mandatory field completeness — all required fields must be present and non-empty
- Date validation — invoice date cannot be in the future
- Duplicate detection — same invoice number from same supplier triggers rejection
The 72-Hour Buyer Acceptance Window
A unique feature of MyInvois is the buyer acceptance workflow:
A unique feature of MyInvois is the buyer acceptance workflow:
- Supplier submits and LHDN validates the e-invoice
- Buyer is notified of the new e-invoice
- Buyer has 72 hours to accept or reject
- If no action is taken within 72 hours, the e-invoice is auto-accepted
- If rejected, the supplier must issue a new corrected e-invoice
Your system should handle rejection notifications and streamline the correction process.
Error Handling
Common API error responses and how to handle them:
Common API error responses and how to handle them:
- 400 Bad Request — invalid document format or missing fields. Parse the error details to identify which field failed validation.
- 401 Unauthorized — expired or invalid access token. Refresh and retry.
- 409 Conflict — duplicate document. Check your invoice numbering.
- 422 Unprocessable Entity — validation rules failed. Review the specific rule violations in the response.
- 429 Too Many Requests — rate limited. Implement exponential backoff.
Sandbox Environment
LHDN provides a sandbox at preprod-api. myinvois.
LHDN provides a sandbox at preprod-api.myinvois.hasil.gov.my for testing. Use it to:
- Validate your XML/JSON document structure
- Test the full submission and validation flow
- Verify error handling in your system
- Train your team on the new workflow
For businesses not yet ready for API integration, Invoicemonk generates MyInvois-ready invoices with all mandatory fields. Get started →
More in this series (202 articles)
From this series
Stay audit-ready and compliant with tax regulations across different regions.
Related Topics
Digital Marketing, SEO Specialist, Content Creator & Product Professional
Olayinka is a digital marketer, content creator, growth and SEO specialist with 10+ years helping businesses in Nigeria, the UK, the US, Australia, and Dubai achieve their goals online.




