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

EnvironmentHost
Sandboxhttps://malaysia-sandbox.complyance.io
Productionhttps://malaysia-prod.complyance.io
Get document detailshttp
POST https://malaysia-sandbox.complyance.io/getDocumentDetailsFromLHDN
POST https://malaysia-prod.complyance.io/getDocumentDetailsFromLHDN

Headers

HeaderTypeDescriptionExampleConditionality
x-api-keystringAPI key for authenticationyour-api-keyMandatory
invoiceMethodstringThe invoicing method, such as non-peppolnon-peppolOptional
Content-TypestringSays the body is JSONapplication/jsonOptional

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'

Request body

Request bodyjson
{
    "documentUuid": "ABCDEFGHJK0123456789ABCD10"
}
FieldTypeDescription
documentUuidstringUnique 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 Valid or Invalid.
  • validationResults: the result of each LHDN validation step. For an invalid document, error gives the error code and message in English (error) and Malay (errorMs), and innerError names the field that failed.

Status codes

Status codeDescription
200 OKInvoice data validated successfully.
400 Bad RequestInvalid or malformed request.
500 Internal Server ErrorAn error occurred on the server.