Malaysia: request and response examples

Send a Malaysian e-invoice in GETS and read the validation response. Start with a sandbox API key and a Malaysian company's onboarded source.

Save the request

Save this body as malaysia-invoice.json. It is an ordinary business-to-business e-invoice for LHDN MyInvois with one service line charged at 8% service tax. An ordinary B2B invoice takes no modifier, so documentType.modifiers stays empty.

malaysia-invoice.jsonjson
{
  "country": "MY",
  "environment": "sandbox",
  "purpose": "invoicing",
  "source": "acme-erp:1.0.0",
  "documentType": {
    "base": "tax_invoice",
    "modifiers": []
  },
  "payload": {
    "header": {
      "documentType": { "base": "tax_invoice" },
      "documentNumber": "MY-2026-00217",
      "issueDate": "2026-10-01",
      "issueTime": "09:30:00Z",
      "currency": "MYR"
    },
    "parties": {
      "seller": {
        "name": "Selangor Tech Sdn Bhd",
        "address": {
          "addressLine1": "Level 8, 12 Jalan Contoh",
          "city": "Kuala Lumpur",
          "postalCode": "50450",
          "country": "MY",
          "extensions": { "my_countrySubentityCode": "14" }
        },
        "contact": {
          "name": "Accounts Receivable",
          "email": "billing@example.com",
          "phone": "+60312345678"
        },
        "taxIds": [{ "type": "TIN", "value": "C20880050010" }],
        "registrationNumbers": [{ "type": "BRN", "value": "202001234567" }],
        "industryClassification": {
          "code": "62010",
          "description": "Computer programming activities"
        }
      },
      "buyer": {
        "name": "Petaling Retail Sdn Bhd",
        "address": {
          "addressLine1": "No 5, Jalan Sampel 3",
          "city": "Petaling Jaya",
          "postalCode": "46050",
          "country": "MY",
          "extensions": { "my_countrySubentityCode": "10" }
        },
        "contact": { "phone": "+60378765432" },
        "taxIds": [{ "type": "TIN", "value": "C20880050004" }],
        "registrationNumbers": [{ "type": "BRN", "value": "201901012345" }]
      }
    },
    "lineItems": [
      {
        "id": "1",
        "name": "Software support",
        "description": "Monthly software support, September 2026",
        "quantity": 10,
        "unitCode": "HUR",
        "price": { "amount": 150 },
        "lineTaxableValue": 1500,
        "taxCategory": "02",
        "taxRate": 8,
        "taxAmount": 120,
        "lineTotal": 1620,
        "extensions": {
          "my_itemPriceExtension": 1500,
          "my_commodityClassificationClass": "022"
        }
      }
    ],
    "taxTotals": [{
      "taxAmount": 120,
      "taxSubtotals": [{
        "taxableAmount": 1500,
        "taxAmount": 120,
        "taxCategory": "02",
        "percent": 8
      }]
    }],
    "totals": {
      "totalLineTaxableAmount": 1500,
      "totalAmountExcludingTax": 1500,
      "totalTaxAmount": 120,
      "totalAmountIncludingTax": 1620,
      "amountDue": 1620
    }
  }
}

Replace source with the Malaysian company’s own name:version, and use an unused documentNumber. Keep environment: "sandbox" with a sandbox key. These values are specific to Malaysia:

  • Issue date and time. Set issueDate and issueTime to when you issue the invoice, with the time in UTC as HH:mm:ssZ. LHDN does not accept a document issued more than 72 hours before it is submitted, and neither value can be in the future.
  • Identifiers. Both parties need a TIN (tax identification number) in taxIds and a BRN (business registration number) in registrationNumbers. The seller and buyer TINs must differ.
  • Phone numbers. Both parties need a phone number: digits only, with one optional leading +, 8 to 20 characters long.
  • State code. address.extensions.my_countrySubentityCode is the LHDN state code, such as 14 for Kuala Lumpur and 10 for Selangor.
  • Seller activity. industryClassification holds the seller’s MSIC code and its business activity description.
  • Lines. taxCategory is an LHDN tax type, such as 02 for service tax. my_commodityClassificationClass is the LHDN classification code for the item, and my_itemPriceExtension is the line amount before tax. Send exactly one entry in taxTotals.

Read the Malaysia field reference for other document types and conditional fields.

Send the request

Submit a Malaysian invoice in sandboxbash
curl --request POST 'https://prod.gets.complyance.io/api/v3/unify' \
  --header "Authorization: Bearer ${COMPLYANCE_API_KEY}" \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'new-api: true' \
  --data @malaysia-invoice.json

Read the response

HTTP 200 means the invoice passed validation and was stored. This illustrative response includes a short Base64-encoded XML fragment to show the shape; the actual Base64XML contains the generated invoice, not this fragment.

Validated invoice — HTTP 200json
{
  "documentId": "01K6EXAMPLE00000000000217",
  "documentNumber": "MY-2026-00217",
  "message": "Your invoice was validated and is ready for submission.",
  "Base64XML": "PEludm9pY2U+PElEPk1ZLTIwMjYtMDAyMTc8L0lEPjwvSW52b2ljZT4="
}

If the request returns HTTP 422, inspect every entry in errors. This sample shows the response for a request sent without the buyer’s TIN; the messages in your response can differ.

Missing buyer TIN — HTTP 422json
{
  "documentId": "01K6EXAMPLE00000000000218",
  "documentNumber": "MY-2026-00217",
  "message": "Your invoice could not be validated. Review the errors and try again.",
  "validationStage": "gets",
  "errors": [{
    "code": "MY-PARTY-001",
    "getsPath": "parties.buyer.taxIds",
    "payloadPath": "parties.buyer.taxIds",
    "message": "MY: Buyer TIN is mandatory.",
    "severity": "error",
    "ruleSet": "my:tax_invoice"
  }]
}

Correct the field named by getsPath, then send the request again. The Malaysia validation rules explain the checks LHDN applies after submission. For 404, confirm your source name and version; for 403, check that the key’s environment matches environment. See Unify errors for other statuses. A 200 is not a delivery receipt: follow the document by documentId to check whether LHDN accepted it.

Last updated