Malaysia XML schema and technical format requirements
    Tax & Compliance

    Malaysia E-Invoice Technical Requirements: API, Format & Validation Rules

    •Updated: •
    11 min read

    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:

    1. Register your application on the MyInvois developer portal
    2. Obtain your client ID and client secret
    3. Request an access token using client credentials grant
    4. 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 CodeDocumentUse Case
    01InvoiceStandard sales invoice
    02Credit NoteAdjust/reduce a previous invoice
    03Debit NoteAdjust/increase a previous invoice
    04Refund NoteFull refund of a previous invoice
    11Self-Billed InvoiceBuyer-issued invoice
    12Self-Billed Credit NoteAdjustment 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:

    1. Supplier submits and LHDN validates the e-invoice
    2. Buyer is notified of the new e-invoice
    3. Buyer has 72 hours to accept or reject
    4. If no action is taken within 72 hours, the e-invoice is auto-accepted
    5. 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 →

    Tags:
    MyInvois
    Malaysia
    API
    technical
    e-invoicing
    LHDN
    OO
    Olayinka Olayokun

    Digital Marketing, SEO Specialist, Content Creator & Product Professional

    CIM Certified
    MBA in Digital Marketing and Business Transformation

    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.

    More from Tax & Compliance