Developer Documentation
Build powerful integrations with our comprehensive API. Connect your POS, ERP, or third-party system to automate invoice submission, manage credentials, and streamline financial compliance.
Introduction
- Validating integration tokens
- Receiving invoice header + items
- Preventing duplicate submissions
- Auto-calculating invoice totals
- Storing invoice & items into the MySyncTax database
For more information, visit mysynctax.com.
Authentication
All integration requests must contain two parameters inside the JSON body:
- mysynctax_key
- mysynctax_secret
These identify the integration and must match the credentials assigned to your company.
Requests without both fields will be rejected with 401 Unauthorized.
JSON Structure
Header-Level Fields
- invoice_no – The external invoice number.
- issue_date – Date of invoice (YYYY-MM-DD HH:MM:SS).
- sale_id_integrate – ID of the transaction in your system.
- total_amount – Total invoice amount BEFORE item breakdown (amount_before).
- payment_note_term – CASH / TRANSFER / CHEQUE / etc.
Item-Level Fields
- item_id – ID of each item in the invoice.
- sorting_id – Item sorting or line order.
- invoiced_quantity – Quantity purchased.
- unit_price – Unit price.
- price_discount – Discount per unit.
- total – Total price for this item (quantity × price).
- item_description – Item name or description.
Normal Invoice with Receipt QR
This API generates a normal invoice together with a receipt QR code. If the customer does not scan the QR code, the transaction will be automatically treated as a consolidated invoice in accordance with LHDN MyInvois rules.
{
"mysynctax_key": "F3kW8nP1zS0aL9tQ4vB7uR6yJ2cX5mT8gH1eK3oN",
"mysynctax_secret": "K8pR3sL1vF9gQ2wE6nC4bT7jH0mD5yU1aX8zV3kS4tN9fG2qM7rY0uJ5hP",
"invoice_no": "INV-9002029",
"sale_id_integrate": 9002029,
"total_amount": 210.00,
"payment_note_term": "CASH",
"items": [
{
"item_id": 12,
"sorting_id": 1,
"invoiced_quantity": 2,
"unit_price": 60.00,
"item_description": "Premium Nasi Ayam Set",
"total": 120.00,
"price_discount": 0
},
{
"item_id": 13,
"sorting_id": 2,
"invoiced_quantity": 1,
"unit_price": 90.00,
"item_description": "Iced Coffee Latte",
"total": 90.00,
"price_discount": 0
}
]
}
Send Data
Submit data using the following endpoint:
POST https://mysynctax.com/v5/public/api/myinvois
Key Notes
- Duplicate JSON payloads (same hashed content) are rejected with 409.
- All amounts must be numerical.
- Date formats must use YYYY-MM-DD HH:MM:SS.
Response Examples
Success
{
"status": "ok",
"mysynctax_uuid": "generated-unique-id"
"qr_url": "https://mysynctax.com/v5/public/redirect/9QqIe39"
}
Duplicate
{
"status": "duplicate_ignored",
"mysynctax_uuid": "existing-unique-id"
}
Unauthorized
{
"status": "unauthorized",
"message": "Invalid mysynctax_key or mysynctax_secret"
}
Error Codes
| HTTP Code | Description |
|---|---|
| 400 | Invalid or malformed JSON |
| 401 | API key or secret missing/invalid |
| 409 | Duplicate invoice submission |
| 500 | Server processing error |
ERP - Invoice (With Customer)
POST https://mysynctax.com/v5/public/api/myinvois/invoice
This API is intended for ERP / Accounting systems that manage customer master data and require direct submission to LHDN.
Request Example
{
"mysynctax_key": "XXX",
"mysynctax_secret": "XXXX",
"isAutoToLHDN":1,
"invoice_no": "INV-322",
"sale_id_integrate": 3312,
"payment_note_term": "CASH",
"customer": {
"tin_no": "IG25461820000",
"registration_name": "ABC Trading Sdn Bhd",
"identification_no": "930105045119",
"identification_type": "NRIC",
"sst_registration": "SST123456",
"phone": "0123456789",
"email": "finance@abctrading.com",
"address_line_1": "No 10, Jalan Teknologi",
"address_line_2": "Taman Teknologi",
"address_line_3": "Seksyen 7",
"city_name": "Shah Alam",
"postal_zone": "40000",
"state_code": "10",
"country_code": "MYS"
},
"items": [
{
"item_id": 101,
"sorting_id": 1,
"item_description": "USB Keyboard",
"invoiced_quantity": 2,
"unit_price": 30.00,
"total_before_tax": 60.00,
"price_discount":5,
"tax_amount": 3.60
},
{
"item_id": 102,
"sorting_id": 2,
"item_description": "USB Mouse",
"invoiced_quantity": 1,
"unit_price": 40.00,
"total_before_tax": 40.00,
"price_discount":5,
"tax_amount": 2.40
}
]
}
Response Example
{
"status": "ok",
"invoice_id": 410,
"mysynctax_uuid": "a461cd55016ece31242098e2bxxxxxx3",
"customer_status": "updated",
"qr_lhdn": "https://mysynctax.com/v5/public/qr_link/a461cd55016ece31242098e2bxxxxxx3",
"customer_id": 90,
"result": {
"headers": {},
"original": {
"submissionUid": "X7T2BQBCW6A55280PYxxxxxx",
"acceptedDocuments": [
{
"uuid": "1DB9HRPJ1F1VJZ34PYsssss",
"invoiceCodeNumber": "INV-567-3455"
}
],
"rejectedDocuments": []
},
"exception": null
}
}Credit Note / Debit Note / Refund
POST https://mysynctax.com/v5/public/api/myinvois/note
Used to submit adjustments for invoices that have already been submitted to LHDN.
Request Example
{
"mysynctax_key": "XXX",
"mysynctax_secret": "XXXXX",
"note_type": "refund",//credit,debit,refund
"mysynctax_uuid": "bfc2c97e589ceb9fe9cb4b603bb740d011cb3d53",
"sale_id_integrate": 5643,
"items": [
{
"item_id": 102,
"qty": 1,
"price": 50.00,
"discount": 0.00,
"tax": 3.00,//Tax Amount not percent
"description": "Item rosak / dipulangkan"
}
]
}Response Example
{
"status": "success",
"note_type": "refund",
"invoice_id": 409,
"mysynctax_uuid": "f8259315-45bf-41ba-bd6d-ae9abb93ac32",
"qr_lhdn": "https://mysynctax.com/v5/public/qr_link/9QJTTE3H66GCHRHB4A3PVJDK10",
"message": "Refund Note submitted successfully",
"result": {
"headers": {},
"original": {
"submissionUid": "5PBX6XF31R26SH0J3A3PVJDK10",
"acceptedDocuments": [
{
"uuid": "9QJTTE3H66GCHRHB4A3PVJDK10",
"invoiceCodeNumber": "REFUND-NOTE-20251229001155"
}
],
"rejectedDocuments": []
},
"exception": null
}
}
Error Codes
| HTTP Code | Description |
|---|---|
| 400 | Invalid or malformed JSON |
| 401 | API key or secret missing/invalid |
| 404 | Invoice UUID not found |
| 409 | Duplicate submission |
| 422 | Item mismatch |
| 500 | Server processing error |
Self-Billed Invoice
Self-Billed Invoice is used when the supplier does not issue an e-Invoice and the buyer generates the invoice on behalf of the supplier, as required by LHDN MyInvois.
Request Example
{
{
"mysynctax_key": "XXXX",
"mysynctax_secret": "XXXX",
"isAutoToLHDN": 1,
"invoice_no": "INV-567-8612",
"sale_id_integrate": 8612,
"payment_note_term": "CASH",
"supplier": {
"tin_no": "IG20868489010",
"registration_name": "IMPORT SDN BHD",
"identification_no": "202503158017",
"identification_type": "BRN",
"sst_registration": "SST123456",
"phone": "0123456789",
"email": "finance@abctrading.com",
"address_line_1": "No 10, Jalan Teknologi",
"address_line_2": "Taman Teknologi",
"address_line_3": "Seksyen 7",
"city_name": "Shah Alam",
"postal_zone": "40000",
"state_code": "10",
"country_code": "MYS"
},
"items": [
{
"item_id": 101,
"sorting_id": 1,
"item_description": "USB Keyboard",
"invoiced_quantity": 2,
"unit_price": 30.00,
"total_before_tax": 60.00,
"tax_amount": 3.60,
"price_discount":5
},
{
"item_id": 102,
"sorting_id": 2,
"item_description": "USB Mouse",
"invoiced_quantity": 1,
"unit_price": 40.00,
"total_before_tax": 40.00,
"tax_amount": 2.40,
"price_discount":5
}
]
}
}
Response Example
{
"status": "ok",
"invoice_id": 406,
"mysynctax_uuid": "173a8b67d01a40b2c2e0dd11efcc6wxxxxx",
"customer_status": "existing",
"qr_lhdn": "https://mysynctax.com/v5/public/qr_link/JGT0YJCDKZ5R23JMX89Fxxxxxx",
"customer_id": 90,
"result": {
"headers": {},
"original": {
"submissionUid": "6RTRCJFS0EKWTRGTwxxxxxx",
"acceptedDocuments": [
{
"uuid": "JGT0YJCDKZ5R23JMXxxxxx",
"invoiceCodeNumber": "INV-567-123"
}
],
"rejectedDocuments": []
},
"exception": null
}
}
Self-Billed Credit / Debit / Refund
This API is used to submit Credit, Debit, or Refund Notes for Self-Billed Invoices that have already been submitted to LHDN.
Request Example
{
"mysynctax_key": "XXXX",
"mysynctax_secret": "XXXX",
"note_type": "refund",//credit/debit/refund
"mysynctax_uuid": "943e75230addb63b7fde84c4b2b9ce8a532ca07a",
"sale_id_integrate": 456,
"items": [
{
"item_id": 102,
"qty": 1,
"price": 50.00,
"discount": 0.00,
"tax": 3.00,//Tax Amount not percent
"description": "Item rosak / dipulangkan"
}
]
}Response Example
{
"status": "ok",
"invoice_id": 404,
"note_type": "refund",
"mysynctax_uuid": "57f15d7c-b432-4c69-bd66-cadxxxxxx",
"qr_lhdn": "https://mysynctax.com/v5/public/qr_link/xaasxxxxxx",
"result": {
"headers": {},
"original": {
"submissionUid": "X6BEP9R6MN4xxxxxx",
"acceptedDocuments": [
{
"uuid": "F440ZCK2EXZBxxxxx",
"invoiceCodeNumber": "REFUND-NOTE-20251229000704"
}
],
"rejectedDocuments": []
},
"exception": null
}
}
Add New Customer
This API is used to create or update customer master data in MySyncTax. It supports bulk customer submission and is commonly used by ERP or POS systems before invoice or self-billed submission.
Request Example
{
"mysynctax_key": "XXXX",
"mysynctax_secret": "XXXXX",
"customers": [
{
"tin_no": "EI00000000010",
"registration_name": "AHMAD1 BIN ALI",
"identification_type": "NRIC",
"identification_no": "900101105555",
"sst_registration": null,
"phone": "0134455667",
"email": "ahmad.ali@gmail.com",
"city_name": "Kota Bharu",
"postal_zone": "15000",
"state_code": "03",//Follow below state_code from LHDN
"country_code": "MYS",
"address_line_1": "Lot 123, Kampung Pantai",
"address_line_2": "Mukim Badang",
"address_line_3": "Kelantan"
}
]
}LHDN State Code Reference
Use the following state_code values when submitting customer or supplier address information to MySyncTax. These codes follow the official LHDN lookup.
| State Name | State Code |
|---|---|
| Johor | 01 |
| Kedah | 02 |
| Kelantan | 03 |
| Melaka | 04 |
| Negeri Sembilan | 05 |
| Pahang | 06 |
| Pulau Pinang | 07 |
| Perak | 08 |
| Perlis | 09 |
| Selangor | 10 |
| Terengganu | 11 |
| Sabah | 12 |
| Sarawak | 13 |
| Wilayah Persekutuan Kuala Lumpur | 14 |
| Wilayah Persekutuan Labuan | 15 |
| Wilayah Persekutuan Putrajaya | 16 |
| Not Applicable | 17 |
Response Example
{
"status": "ok",
"message": "Customers processed successfully",
"results": [
{
"tin_no": "EI00000000010",
"status": "created",
"id_customer": 93
}
]
}Add / Update Supplier
This API is used to create or update supplier master data in MySyncTax. It is commonly required for Self-Billed Invoice and ERP-based invoice submissions.
Request Example
{
"mysynctax_key": "XXXX",
"mysynctax_secret": "XXXX",
"supplier": [
{
"tin_no": "EI00000000010",
"registration_name": "AHMAD1 BIN ALI",
"identification_type": "NRIC",
"identification_no": "900101105555",
"sst_registration": null,
"phone": "0134455667",
"email": "ahmad.ali@gmail.com",
"city_name": "Kota Bharu",
"postal_zone": "15000",
"state_code": "03",
"country_code": "MYS",
"address_line_1": "Lot 123, Kampung Pantai",
"address_line_2": "Mukim Badang",
"address_line_3": "Kelantan"
}
]
}Response Example
{
"status": "ok",
"message": "Supplier processed successfully",
"results": [
{
"tin_no": "EI00000000010",
"status": "updated",
"id_customer": 93
}
]
}Language Samples
JavaScript (jQuery)
$.ajax({
url: "https://mysynctax.com/v5/public/api/myinvois",
type: "POST",
contentType: "application/json",
data: JSON.stringify(payload),
success: function(res){
console.log(res);
}
});
PHP (cURL)
$ch = curl_init("https://mysynctax.com/v5/public/api/myinvois");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
.NET C#
using(var client = new HttpClient()) {
var json = JsonConvert.SerializeObject(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://mysynctax.com/v5/public/api/myinvois", content);
var result = await response.Content.ReadAsStringAsync();
}
VB.NET
Dim client As New HttpClient()
Dim json = JsonConvert.SerializeObject(payload)
Dim content = New StringContent(json, Encoding.UTF8, "application/json")
Dim response = Await client.PostAsync("https://mysynctax.com/v5/public/api/myinvois", content)
Dim result = Await response.Content.ReadAsStringAsync()
Python
import requests
r = requests.post("https://mysynctax.com/v5/public/api/myinvois", json=payload)
print(r.json())
Java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://mysynctax.com/v5/public/api/myinvois"))
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.header("Content-Type", "application/json")
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Node.js
const axios = require("axios");
axios.post("https://mysynctax.com/v5/public/api/myinvois", payload)
.then(res => console.log(res.data));