guide hub·① access·② configure·③ submit·④ check·⑤ self-billed·invoice maker
e-Invois · LHDN Malaysia · journey ① · once ever

Get access

From zero to working API keys for your company about 20 minutes on the LHDN sandbox portal. Progress is saved in this browser.

This journey0 / 7 completed

FastPath- Prompt this to Claude

Works in Claude Code (myinvois skill) or any MCP client running mcp-myinvois. Copy, paste, done or do it manually with the steps below.

Use the my-einvois-access-skill. I'm new to Malaysia e-invoicing get me MyInvois sandbox API access for my company, step by step. Open the portal pages for me as we go, and save my keys to ~/.myinvois.env when we're done.
01prepare

What you need before starting

  • Your TIN (Tax Identification Number) e.g. C1234567890 for a company. Don't know it? Check MyTax, or e-Daftar.
  • A MyTax account as the company's director or appointed representative. If the company is new to MyTax, the director must register a digital certificate first (guided on the login page).
  • Node.js ≥ 18 on this machine for the CLI you'll verify with. Check: node --version
Sandbox is a full copy of production with fake data nothing you submit there is a real tax document. Always start here.
02login

Log in to the sandbox MyTax

The sandbox has its own portal note the preprod- prefix:

https://preprod-mytax.hasil.gov.my
preprod-mytax.hasil.gov.my
MyTax Log Masuk / Login
Identification Card No. 
881212-14-5555
Hantar / Submit
1
click after filling ID

Log in with your personal ID, then verify with your digital certificate password.

First time in the sandbox? Your production MyTax account does not carry over automatically if login fails, use “First Time Login” on the same page to activate your sandbox account with the same ID.
03role

Switch to the company role, open MyInvois

You land on the MyTax dashboard as an individual. To act for the company, pick its role first, then open the MyInvois portal.

preprod-mytax.hasil.gov.my Dashboard
Directors of the Company EXAMPLE SDN BHD 
1
pick company role
ezHasil ServicesMyInvois
2
opens the portal
e-DaftarProfile

MyInvois opens in a new tab at preprod.myinvois.hasil.gov.my

04register

Taxpayer profile → Register ERP

Inside the MyInvois portal, open your Taxpayer Profile (top-right avatar → View Taxpayer Profile). The ERP registration lives there.

preprod.myinvois.hasil.gov.my Taxpayer Profile
DocumentsReportingProfile
CompanyEXAMPLE SDN BHD
TINC1234567890
Registered ERPs0
+ Register ERP
1
this issues your keys

“ERP” just means any system that talks to the API your CLI counts. Name it something you'll recognise, e.g. yourcompany-cli. Pick the longest client-secret expiry offered.

Register under the right taxpayer! The keys belong to whoever's profile you're in. If you skip the role switch in step 03 and register from your personal profile, company invoices will fail with authenticated TIN and documents TIN is not matching and you'll have to re-register under the company role.
05keys

Copy the Client ID and Client Secret

After registering, the portal shows your credentials once:

preprod.myinvois.hasil.gov.my ERP registered ✓
yourcompany-cli credentials
Client IDa1b2c3d4-e5f6-…
Client Secret9f8e7d6c5b4a3210ffee
1
copy both now
The secret is shown only this once. If you lose it, you don't recover it you register a new ERP and get a new pair. Sandbox and production pairs are completely separate.
06configure

Generate your ~/.myinvois.env

Credential file builder

Everything here stays in this page no network calls, nothing stored. View source to verify.

07verify

Prove the connection works

From the einvoice repo folder:

node skills/myinvois/scripts/myinvois.mjs token

Expected: { "env": "sandbox", "token": "eyJhbGciOi…(cached)" }

Then validate your own company's TIN against its BRN this exercises a real business API:

node skills/myinvois/scripts/myinvois.mjs validate-tin C1234567890 BRN 201901234567

Expected: "valid": true

Seeing invalid_client? Wrong environment (sandbox keys against prod or vice-versa) or a typo in the secret. Re-check step 06.