Import Malaysia E-Invoice
Import a Malaysia e-invoice document into a Staple Queue in JSON format. Staple will create a document (docId) and submit it to LHDN MyInvois asynchronously.
This endpoint supports all MyInvois document types, including self-billed types.
Endpoint
POST /v2/einvoice/malaysia/queue/{queueId}
Request Headers
Content-Type: application/json
Accept: application/json
Path Parameter
Supported Document Types (docType)
docType determines the business scenario. Allowed values:
Request Payload (JSON)
A single endpoint supports all docType values above.
Top-level Fields
Sample Payload (Invoice)
Paste this into Postman Body.
Reference Rules (VERY IMPORTANT)
Some document types must reference an earlier document.
Supplier-issued adjustments (reference original invoice)
When docType is one of:
-
credit_note -
debit_note -
refund_note
reference.originalInvoiceCodeNumber is required and must point to the original invoice docNumber / code number used by your integration.
Buyer-issued (self-billed) adjustments (reference original self_billed_invoice)
When docType is one of:
-
self_billed_credit_note -
self_billed_debit_note -
self_billed_refund_note
reference.originalInvoiceCodeNumber is required and must point to the original self_billed_invoice docNumber / code number used by your integration.
Reference Object
Example:
Party Objects (supplier, buyer)
Address Object (recommended fields): line1, city, stateCode, postcode, country
Contact Object (recommended fields): telephone
Self-billed documents: Buyer is the issuer in business terms, but this API keeps
supplierandbuyerfields consistent. Staple validates and maps parties according todocType.
Line Items (lines[])
Totals (totals)
Tax
Tax is represented at line-level under lines[].taxes.
Tax Object (taxes[])
Allowed Values for taxes[].type
Do not use ambiguous values like
SST. ChooseSALES_TAXorSERVICE_TAXexplicitly.
Amount Conventions (Recommended)
To keep adjustments unambiguous:
-
credit_note: use negative amounts forlines[].amountExclTax,lines[].taxes[].amount, and totals. -
refund_note: use negative amounts when reducing original invoice value and confirming money returned to Buyer. -
debit_note: use positive amounts (additional charges).
Staple will validate totals consistency.
Response (Success)
The response confirms the document was queued in Staple. Use
docIdandtrackingUrlto check ongoing status.
Example
Response Field Notes
-
requestId: Request trace ID. -
queueId: Queue used for import. -
docId: Staple document ID created in the queue. -
docType: Imported document type. -
docNumber: Imported document number. -
message: Human-readable processing message. -
trackingUrl: Internal status endpoint for this document. -
myInvois.submissionId: MyInvois submission batch ID. -
myInvois.uuid: MyInvois document UUID.
myInvoisis present only when Staple already has MyInvois submission details available at response time.
If processing later fails, or MyInvois details are not ready yet, the response may still returndocIdwithoutmyInvois.
In that case, check the actual processing result via:
GET/v2/einvoice/malaysia/status/{docId}
Error / Status Handling
This endpoint is asynchronous.
A successful import request can still return a normal queued response first, while the actual Malaysia e-invoice processing succeeds or fails later.
Important behavior
-
Do not assume failures will come back as HTTP errors from the import endpoint.
-
If processing fails after the document is queued, the response may simply not include
myInvois. -
When
myInvoisis missing, usedocIdto call the status endpoint and inspect the real outcome.
Example follow-up check
GET /v2/einvoice/malaysia/status/242069
Use this endpoint to check whether the document was submitted, validated, rejected, or failed during later processing.
Practical rule
-
Import response has
docId+myInvois→ MyInvois submission details are already available. -
Import response has
docIdbut nomyInvois→ do not treat it as HTTP failure; call/v2/einvoice/malaysia/status/{docId}.