Malaysia v2: Document Details API
Get a document's status and validation results from LHDN by its document UUID in the Malaysia API v2 (legacy): endpoint, headers, request, responses and code examples.
The Document Details API gets the status of an e-invoice from the government (LHDN).
Endpoint
| Environment | Host |
|---|---|
| Sandbox | https://malaysia-sandbox.complyance.io |
| Production | https://malaysia-prod.complyance.io |
Get document detailshttp
POST https://malaysia-sandbox.complyance.io/getDocumentDetailsFromLHDN
POST https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDNHeaders
| Header | Type | Description | Example | Conditionality |
|---|---|---|---|---|
x-api-key | string | API key for authentication | your-api-key | Mandatory |
invoiceMethod | string | The invoicing method, such as non-peppol | non-peppol | Optional |
Content-Type | string | Says the body is JSON | application/json | Optional |
Code examples
These examples show the endpoint and headers. Send the request body as JSON.
bash
curl --location 'https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN' \
--header 'x-api-key: your-api-key' \
--header 'Content-Type: application/json'javascript
const headers = {
'x-api-key': 'your-api-key',
'Content-Type': 'application/json'
};
fetch('https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN', {
method: 'POST',
headers: headers
})
.then(function(response) {
return response.json();
}).then(function(body) {
console.log(body);
});ruby
require 'rest-client'
headers = {
'x-api-key' => 'your-api-key',
'Content-Type' => 'application/json'
}
response = RestClient.post 'https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN', {}, headers
puts response.bodypython
import requests
headers = {
'x-api-key': 'your-api-key',
'Content-Type': 'application/json'
}
response = requests.post('https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN', headers=headers)
print(response.json())php
<?php
$headers = [
'x-api-key' => 'your-api-key',
'Content-Type' => 'application/json'
];
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN', [
'headers' => $headers
]);
echo $response->getBody()->getContents();
?>java
URL url = new URL("https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("x-api-key", "your-api-key");
con.setRequestProperty("Content-Type", "application/json");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());go
package main
import (
"net/http"
)
func main() {
headers := map[string][]string{
"x-api-key": []string{"your-api-key"},
"Content-Type": []string{"application/json"},
}
req, err := http.NewRequest("POST", "https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN", nil)
if err != nil {
// Handle error
}
for key, values := range headers {
for _, value := range values {
req.Header.Add(key, value)
}
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
// Handle error
}
defer resp.Body.Close()
}Request body
Request bodyjson
{
"documentUuid": "ABCDEFGHJK0123456789ABCD10"
}| Field | Type | Description |
|---|---|---|
documentUuid | string | Unique identifier received from the government as an acknowledgement |
Response
Success response
HTTP status 200 OK. The encodedQrCode value is shortened here.
Response for a valid documentjson
{
"uuid": "ABCDEFGHJK0123456789ABCD10",
"submissionUid": "KMNPQRSTVW0123456789ABCD10",
"longId": "EXAMPLELONGID0123456789ABCDEFGHJK1732168044",
"typeName": "Invoice",
"typeVersionName": "Version 1",
"issuerTin": "C20000000000",
"issuerName": "Acme Trading Sdn Bhd",
"receiverId": "C30000000000",
"receiverName": "Example Buyer Sdn Bhd",
"dateTimeReceived": "2024-11-21T05:47:24Z",
"dateTimeValidated": "2024-11-21T05:47:25Z",
"totalExcludingTax": 1000.0,
"totalDiscount": 0.0,
"totalNetAmount": 0.0,
"totalPayableAmount": 1000.0,
"status": "Valid",
"createdByUserId": "C20000000000:00000000-0000-0000-0000-000000000000",
"documentStatusReason": null,
"cancelDateTime": null,
"rejectRequestDateTime": null,
"validationResults": {
"status": "Valid",
"validationSteps": [
{
"status": "Valid",
"error": null,
"name": "Step03-Duplicated Submission Validator"
},
{
"status": "Valid",
"error": null,
"name": "Step04-Code Field Validator"
},
{
"status": "Valid",
"error": null,
"name": "Step05-Taxpayer Profile Validator"
},
{
"status": "Valid",
"error": null,
"name": "Step06-Document References Validator"
},
{
"status": "Valid",
"error": null,
"name": "Step07-Document Currency Validator"
}
]
},
"internalId": "INV-2024-0142",
"dateTimeIssued": "2024-11-19T02:30:00Z",
"encodedQrCode": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AQAAAACgl2eQ…"
}Response for an invalid document
Response for an invalid documentjson
{
"uuid": "QRSTVWXYZA0123456789ABCD10",
"submissionUid": "BCDEFGHJKM0123456789ABCD10",
"longId": "",
"typeName": "Invoice",
"typeVersionName": "Version 1",
"issuerTin": "C20000000000",
"issuerName": "Acme Trading Sdn Bhd",
"receiverId": "C30000000000",
"receiverName": "Example Buyer Sdn Bhd",
"dateTimeReceived": 1733491386000,
"dateTimeValidated": 1733491386000,
"totalExcludingTax": 1000,
"totalDiscount": 0,
"totalNetAmount": 0,
"totalPayableAmount": 1060,
"status": "Invalid",
"createdByUserId": "C20000000000:00000000-0000-0000-0000-000000000000",
"documentStatusReason": null,
"cancelDateTime": null,
"rejectRequestDateTime": null,
"validationResults": {
"status": "Invalid",
"validationSteps": [
{
"status": "Valid",
"error": null,
"name": "Step03-Duplicated Submission Validator"
},
{
"status": "Invalid",
"error": {
"propertyName": null,
"propertyPath": null,
"errorCode": "Error04",
"error": "Step04-Invalid Code Field Validator",
"errorMs": "Step04-Pengesah Medan Kod Tidak Sah",
"innerError": [
{
"propertyName": "cbc:IndustryClassificationCode",
"propertyPath": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cbc:IndustryClassificationCode",
"errorCode": "CV302",
"error": "ItemCode 1111 does not exist in CodeType MSIC Codes",
"errorMs": "Kod Item 1111 tidak wujud dalam Jenis Kod MSIC Codes",
"innerError": null
}
]
},
"name": "Step04-Code Field Validator"
},
{
"status": "Valid",
"error": null,
"name": "Step05-Taxpayer Profile Validator"
},
{
"status": "Valid",
"error": null,
"name": "Step06-Document References Validator"
},
{
"status": "Valid",
"error": null,
"name": "Step07-Document Currency Validator"
}
]
},
"internalId": "INV-2024-0143",
"dateTimeIssued": 1733279400000
}Response fields
- status: the status of the document, such as
ValidorInvalid. - validationResults: the result of each LHDN validation step. For an invalid document,
errorgives the error code and message in English (error) and Malay (errorMs), andinnerErrornames the field that failed.
Status codes
| Status code | Description |
|---|---|
200 OK | Invoice data validated successfully. |
400 Bad Request | Invalid or malformed request. |
500 Internal Server Error | An error occurred on the server. |