Trusted e-Invoicing Software in Malaysia | LHDN Compliant e-Invoicing Provider – Advintek

MyInvois API Guide Documentation for Malaysian Businesses

MyInvois API Guide

The MyInvois API Guide is the essential technical reference for Malaysian businesses and developers building automated e-Invoicing integrations with LHDN’s MyInvois platform. Understanding the MyInvois API its authentication model, endpoint structure, request and response formats, error handling patterns, and compliance requirements is the foundation of any successful automated invoice submission implementation. This MyInvois API Guide covers the key technical concepts, practical integration steps, and common development challenges that businesses and their implementation partners encounter when connecting ERP and accounting systems to LHDN’s structured invoice validation infrastructure. The Advintek Malaysia portal provides certified MyInvois API Guide-aligned integration services for businesses across all ERP environments. 

What Is MyInvois API and How It Works 

The API as LHDN’s Programmatic Gateway 

The MyInvois API is LHDN’s programmatic interface for submitting, validating, and managing structured e-Invoices without requiring human interaction with the web-based MyInvois portal for each transaction. As this MyInvois API Guide explains, the API exposes a set of RESTful endpoints that accept structured invoice data in JSON format, validate it against LHDN’s mandatory schema requirements, and return validation responses all in near-real-time, enabling accounting software and ERP platforms to integrate structured invoice submission directly into their standard transaction processing workflows. 

OAuth 2.0 Authentication Model 

The MyInvois API uses OAuth 2.0 for authentication, requiring businesses to obtain an access token before any API call can be made. As documented in this MyInvois API Guide, the authentication flow involves exchanging your client credentials client ID and client secret issued during MyInvois registration for a time-limited access token that must be included in every subsequent API request. Access tokens expire and must be refreshed automatically by the integration to prevent submission interruptions during live operation. 

Key Features of MyInvois API Documentation 

Invoice Submission Endpoints 

The MyInvois API Guide covers the primary invoice submission endpoint, which accepts structured invoice payloads in LHDN’s required JSON schema. The submission endpoint validates each invoice against LHDN’s mandatory field requirements and business rules, returning a validation response that indicates whether the invoice has been accepted, is pending further validation, or has been rejected with specific error codes identifying which fields failed validation. Understanding this endpoint’s behaviour including its rate limits, payload size constraints, and batch submission capabilities is essential for any successful MyInvois integration. 

Document Management and Retrieval 

Beyond submission, the MyInvois API exposes endpoints for retrieving previously submitted invoice status, downloading accepted invoice documents with LHDN’s validation stamp, and managing cancellations and corrections for invoices requiring amendment after initial submission. Cloud accounting platforms such as Xero Accounting Software Malaysia with certified MyInvois integration use these retrieval endpoints to maintain a synchronised invoice status library within the accounting platform, giving finance teams compliance status visibility without requiring manual portal access. 

Sandbox Testing Environment 

As this MyInvois API Guide emphasises, LHDN provides a dedicated sandbox environment with separate API credentials that allows businesses and developers to test their integrations against realistic validation logic without submitting to the production MyInvois system. The sandbox mirrors the production API’s behaviour for all standard invoice types and validation rules, making it the essential pre-go-live testing environment for any MyInvois integration. 

Step-by-Step API Integration Process 

Step 1 — Obtain API Credentials 

Before any API integration work can begin, businesses must complete MyInvois portal registration and obtain their API credentials client ID and client secret from LHDN’s API credential management interface. Both sandbox and production credentials must be obtained separately, as covered in this MyInvois API Guide, since the sandbox and production environments use independent authentication systems. 

Step 2 — Implement Authentication 

Build the OAuth 2.0 token exchange and refresh logic before writing any invoice submission code. The authentication layer is the foundation on which all API functionality depends a poorly implemented authentication system that fails to refresh tokens automatically will cause submission interruptions in live operation that are difficult to diagnose and resolve quickly under compliance deadline pressure. 

Step 3 — Map Your Invoice Schema 

Map every field in your existing accounting or ERP invoice format to the corresponding field in LHDN’s required JSON schema. As this MyInvois API Guide notes, this mapping exercise frequently surfaces fields that your current invoices collect in different formats than LHDN requires, as well as mandatory LHDN fields that your current invoicing workflow does not currently capture both of which must be addressed before any live submission can succeed. Businesses on platforms such as Gen10 Accounting Software Malaysia should confirm field-level mapping with their vendor’s integration team for the most accurate data transformation specification. 

Step 4 — Build Submission Logic and Error Handling 

Implement the invoice submission call with robust error handling that captures LHDN’s structured error responses, logs rejection codes with invoice-level detail, and triggers finance team notifications for rejected submissions requiring manual correction and resubmission. As this MyInvois API Guide details, LHDN’s error response schema includes specific field-level error codes that identify exactly which mandatory field failed validation enabling targeted correction rather than full invoice reconstruction. 

Step 5 — Test in Sandbox and Go Live 

Test every invoice type your business generates in the sandbox environment before switching to the production endpoint. Cover standard sales invoices, credit notes, debit notes, self-billed invoices, and consolidated submissions. ERP platforms such as Infor SunSystem ERP Malaysia provide integration test utilities that allow sandbox testing from within the ERP interface without requiring separate API development tooling. 

Authentication and Security Requirements 

Credential Storage and Rotation 

As this Malaysia E-Invoicing Software 2026 developer guide makes clear, API credentials must be stored securely using environment variables or secrets management systems, never hardcoded in source code or configuration files accessible to unauthorized parties. LHDN recommends periodic credential rotation as a security best practice, and the integration must support credential updates without requiring system downtime or manual intervention during the credential transition.

Data Security in Transit 

All API communication with MyInvois occurs over HTTPS with TLS encryption. The MyInvois developer guide confirms that plain HTTP connections to the API endpoint are rejected, and integrations must implement proper TLS certificate validation rather than disabling certificate verification a common shortcut in development environments that creates unacceptable security risk in production deployments. 

Common API Errors and Troubleshooting 

Authentication Failures 

The most common API error in early-stage MyInvois integrations is authentication failure, typically caused by expired access tokens not being refreshed correctly, incorrect client credentials, or credential scoping issues where sandbox credentials are used against the production endpoint or vice versa. The Nigeria Advintek MyInvois developer guide recommends implementing detailed authentication error logging from day one so that token refresh failures can be identified and resolved before they cause extended submission interruptions.

Schema Validation Failures 

Schema validation failures where the invoice payload is correctly formatted JSON but contains invalid field values, missing mandatory fields, or arithmetic inconsistencies — are the second most common category of API error. LHDN’s error response includes field-level error codes for each validation failure, and this MyInvois developer guide recommends building an error parser that translates LHDN’s technical error codes into finance-team-readable correction instructions, reducing the time between rejection notification and successful resubmission. 

Rate Limiting and Timeout Handling 

The MyInvois API enforces rate limits on submission frequency and has defined timeout thresholds for API responses. Integrations that send bulk submissions without rate-limiting logic will encounter throttling responses that interrupt the submission queue. Building exponential backoff retry logic for timeout and rate-limit responses, as recommended under UAE E-Invoicing Compliance Rules, ensures the integration recovers automatically from these transient conditions without manual intervention.

Best Practices for Successful MyInvois Integration 

  • Implement automated token refresh at least five minutes before token expiry never wait for an authentication failure before refreshing 
  • Log every API call, response, and error with invoice-level detail to enable efficient troubleshooting of production incidents 
  • Test all invoice types and edge cases in sandbox before switching to production the sandbox mirrors production validation logic accurately 
  • Build rate limit handling with exponential backoff retry logic to manage transient throttling without manual intervention 
  • Subscribe to LHDN’s official API update communications and monitor for schema version changes that require integration updates 

Conclusion 

This MyInvois developer guide provides the technical and compliance foundation for any successful LHDN e-Invoicing API integration. Businesses and developers who follow the integration process it covers from credential setup through schema mapping, sandbox testing, and production deployment consistently achieve compliant, automated invoice submission with rejection rates near zero in live operation. For businesses selecting a platform, Advintek’s Malaysia e-Invoicing Software 2026 covers the leading certified platform options that include pre-built MyInvois API integration, reducing custom development requirements and accelerating go-live timelines for businesses on supported accounting platforms. 

Frequently Asked Questions 

Q1. Where can I find the official MyInvois API documentation? 

LHDN publishes the official MyInvois API documentation on the MyInvois developer portal always reference the current version. 

Q2. What authentication method does the MyInvois API use? 

The MyInvois API uses OAuth 2.0 with client credentials for authentication, issuing time-limited access tokens for each session. 

Q3. Is the sandbox environment identical to the production MyInvois API? 

The sandbox mirrors production validation logic for standard invoice types and is the required pre-go-live testing environment. 

Q4. What format does the MyInvois API require for invoice submissions? 

LHDN’s MyInvois API accepts structured invoice payloads in JSON format conforming to LHDN’s published e-Invoice schema. 

Q5. What should I do when the MyInvois API returns a validation error? 

Parse LHDN’s field-level error codes, correct the specific failing fields in the invoice, and resubmit the corrected document. 

Source by:

Image by Gemini