Skip to main content

validate

The Invoice API provides two key functionalities:

  • Validate API: Performs LHDN's validation on the invoice data. It checks for compliance and correctness based on the LHDN (Lembaga Hasil Dalam Negeri Malaysia) regulations, ensuring that all necessary fields and values are accurate.

  • Unify API: After validation, this API submits the invoice data to LHDN. It validates and ensures the invoice is prepared for submission to the LHDN system.

Endpoint

  • Base URL: malaysia-sandbox.complyance.io
  • Validate API: /validate

Headers

HeaderTypeDescriptionExample
x-api-keystringAPI Key for authentication1aN3AQ8ZsggJ0UABAHXVB
invoiceMethodstringThe method of invoicing (e.g., non-peppol)non-peppol
Content-TypestringDefines that the body is in JSON formatapplication/json

Request Body

The request body for the Validate API should be structured as follows:

{
"fileName": "Untitled spreadsheet (24).xlsx",
"branchName": "Futurer Branch",
"invoiceDataList": [
{
"documentType": "INV",
"documentId": "jsjfsfjkf",
"originalEInvoiceReferenceNumber": "",
"originalEInvoiceReferenceUUID": "",
"documentIssueDate": "2024-08-01",
"documentIssueTime": "02:30:00Z",
"currency": "MYR",
"currencyExchangeRate": "EUR",
"invoiceFrequency": "MONTHLY",
"invoiceStartDate": "2024-07-21",
"invoiceEndDate": "2024-07-26",
"supplierId": "1",
"sellerTinNumber": "C21540299050",
"sellerRegistrationIdType": "BRN",
"sellerRegistrationId": "BRN: 202001234567",
"supplierSstRegistrationNumber": "A01-2345-67891012",
"supplierTourismTaxRegistrationNumber": "123-4567-89012345",
"buyerId": "1",
"buyerTinNumber": "C21540299050",
"buyerRegistrationIdType": "BRN",
"buyerRegistrationId": "BRN: 202001234567",
"buyerSstRegistrationNumber": "",
"shippingRecipientName": "Greenz Sdn. Bhd.",
"shippingRecipientTin": "C948329382",
"shippingRecipientRegistrationType": "BRN",
"shippingRecipientRegistrationNumber": "BRN:24235236432",
"totalExcludingTax": "1000",
"detailsOfTaxExemption": "Goods acquired with SST exemption under Sales Tax Act 2018. Reference No: (C01-2345-67890123)",
"amountExemptedFromTax": "",
"taxTotal": "60",
"documentTotal": "1060",
"prePaymentAmount": "0",
"totalPayableAmount": "1060",
"roundingAmount": "0",
"paymentMeans": "1",
"suppliersBankAccountNumber": "1.23457E+12",
"paymentTerms": "1",
"prePaymentDate": "2000-01-01",
"prePaymentTime": "0.5",
"prePaymentReferenceNumber": "E12345678912",
"billReferenceNumber": "E12345678912",
"referenceNumberOfCustomsFormNo19": "E12345678912",
"incoterms": "CIF",
"freeTradeAgreementFta": "ASEAN-Australia-New Zealand FTA (AANZFTA)",
"authorisationNumberForCertifiedExporter": "CPT-CCN-W-211111-KL-000002",
"referenceNumberOfCustomsFormNo2": "E12345678912",
"shipmentId": "",
"detailsOfOtherCharges": "true\n\n100.00\n\nService charge",
"customFields": {},
"usedTaxTypes": [],
"sellerAddress": {
"addressLine1": "Lot 66",
"addressLine2": "Bangunan Merdeka",
"addressLine3": "Persiaran Jaya",
"postalCode": "50480",
"city": "Kuala Lumpur",
"state": "Johor",
"country": "MYS"
},
"buyerAddress": {
"addressLine1": "Lot 66",
"addressLine2": "Bangunan Merdeka",
"addressLine3": "Persiaran Jaya",
"postalCode": "50480",
"city": "Kuala Lumpur",
"state": "Johor",
"country": "MYS"
},
"shippingRecipientAddress": {
"addressLine1": "Lot 66",
"addressLine2": "Bangunan Merdeka",
"addressLine3": "Persiaran Jaya",
"postalCode": "50480",
"city": "Kuala Lumpur",
"state": "Johor",
"country": "MYL"
},
"supplierDetails": {
"organizationName": "AMS Setia Jaya Sdn. Bhd.",
"email": "general.ams@supplier.com",
"industryCode": "1111",
"industryDescription": "Growing of maize",
"phoneNumber": "\n+60-123456789"
},
"buyerDetails": {
"organizationName": "Full Formal Buyer Name BHD.",
"email": "name@buyer.com",
"phoneNumber": "\n+60-123456789"
},
"documentLineItems": [
{
"lineItemId": "1",
"commodityClassificationCode": "1",
"lineItemProductTariffCode": "9800.00.0010",
"lineItemCountryOfOrigin": "GBR",
"description": "Laptop Peripherals",
"unitPrice": "100",
"lineItemMeasurement": "Kg",
"quantity": "10",
"lineItemSubtotal": "1000",
"lineItemDiscountRate": "0",
"lineItemDiscountAmount": "0",
"lineItemChargeRate": "0",
"lineItemChargeAmount": "0",
"lineTotalExcludingTax": "1000",
"taxType": "1",
"taxPercentage": "6",
"totalTax": "60",
"taxCode": "Goods acquired with SST exemption under Sales Tax Act 2018. Reference No: (C01-2345-67890123)",
"lineItemAmountExemptedFromTax": "",
"lineItemTotal": "1060"
}
],
"invoiceMethod": "non-peppol"
}
]
}

Request Body Fields

FieldTypeDescriptionExample
fileNamestringThe name of the file to be validated."Untitled spreadsheet (24).xlsx"
branchNamestringThe branch responsible for the invoice."Futurer Branch"
invoiceDataListarrayList of invoice data objects.See individual fields below.
documentTypestringType of the document (e.g., INV for Invoice)."INV"
documentIdstringUnique identifier for the document."jsjfsfjkf"
documentIssueDatestringDate when the document was issued in YYYY-MM-DD format."2024-08-01"
documentIssueTimestringTime when the document was issued in HH:MM:SSZ format."02:30:00Z"
currencystringCurrency code for the invoice."MYR"
invoiceFrequencystringInvoice frequency (e.g., MONTHLY, WEEKLY)."MONTHLY"
invoiceStartDatestringStart date of the invoice period in YYYY-MM-DD format."2024-07-21"
invoiceEndDatestringEnd date of the invoice period in YYYY-MM-DD format."2024-07-26"
supplierIdstringUnique identifier for the supplier."1"
sellerTinNumberstringTax Identification Number for the seller."C21540299050"
buyerIdstringUnique identifier for the buyer."1"
buyerTinNumberstringTax Identification Number
"C21540299050"for the buyer.
totalExcludingTaxstringTotal amount excluding tax."1000"
taxTotalstringTotal tax amount for the invoice."60"
documentTotalstringTotal invoice amount including tax."1060"
totalPayableAmountstringThe total amount payable."1060"
documentLineItemsarrayList of line items in the invoice (details provided below).See individual line items below.
lineItemIdstringUnique identifier for the line item."1"
lineItemSubtotalstringSubtotal for the line item."1000"
totalTaxstringTotal tax for the line item."60"
lineItemTotalstringTotal amount for the line item, including tax."1060"
invoiceMethodstringThe invoicing method (e.g., non-peppol)."non-peppol"

Sample Response Body

Success Response (HTTP 200 OK)

{
"status": "success",
"message": "Invoice data validated successfully.",
"validationResults": [
{
"documentId": "jsjfsfjkf",
"validationStatus": "Valid",
"validationMessages": []
}
]
}

Validation Error Response (HTTP 400 Bad Request)

{
"status": "error",
"message": "Validation failed. Please review the errors.",
"validationResults": [
{
"documentId": "jsjfsfjkf",
"validationStatus": "Invalid",
"validationMessages": [
{
"field": "documentIssueDate",
"message": "Document issue date cannot be in the future."
},
{
"field": "sellerTinNumber",
"message": "Seller Tin Number is invalid."
}
]
}
]
}

Server Error Response (HTTP 500 Internal Server Error)

{
"status": "error",
"message": "Internal server error. Please try again later."
}

Response Fields:

  • status: Indicates the status of the API call (e.g., "success", "error").
  • message: A human-readable message providing further information about the result.
  • validationResults (optional): An array containing the validation details for each document in the request.
    • documentId: The unique identifier for the document that was validated.
    • validationStatus: Indicates whether the document is valid or invalid.
    • validationMessages (optional): A list of validation error messages, specifying the fields and the corresponding issues if any.

Responses

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