Malaysia Postcode & MyKad API
Postcode lookup, address checks and IC number parsing for Malaysian checkout, onboarding and e-Invoice forms.
Fill the town and state from a postcode, check customer addresses before shipping, and read the date of birth, gender and place of birth from a MyKad number during sign-up. State codes match the LHDN e-Invoice state codes.
Endpoints
| Path | Returns |
|---|---|
GET /postcode/{postcode} | Town(s), state and state code for a 5-digit postcode |
GET /postcode/search?q=shah alam&state=10 | Towns with their postcodes, or postcodes starting with the given digits |
GET /states | All 16 states and federal territories with codes, town counts and postcode ranges |
GET /states/{state} | Every town in a state with its postcodes (state by code, name or slug) |
GET /validate-address?postcode=40000&city=Shah Alam&state=Selangor | Whether postcode, town and state agree, with the expected values |
POST /mykad {"ic":"900101-14-5679"} | Parsed IC number: validity, birth date, age, gender, place of birth (also GET /mykad/{ic}) |
GET /mykad/codes | All MyKad place-of-birth codes |
Example
cURL
curl "https://malaysia-postcode-and-mykad-api.p.rapidapi.com/postcode/50450" \
-H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
-H "X-RapidAPI-Host: malaysia-postcode-and-mykad-api.p.rapidapi.com"
JavaScript
const res = await fetch('https://malaysia-postcode-and-mykad-api.p.rapidapi.com/mykad', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-RapidAPI-Key': process.env.RAPIDAPI_KEY, 'X-RapidAPI-Host': 'malaysia-postcode-and-mykad-api.p.rapidapi.com' },
body: JSON.stringify({ ic: '900101-14-5679' })
});
const { data } = await res.json(); // data.birth_date, data.gender, data.birthplace
Response: GET /postcode/50450
{
"ok": true,
"data": {
"postcode": "50450",
"city": "Kuala Lumpur",
"state": "W.P. Kuala Lumpur",
"state_code": "14",
"country": "MYS",
"places": [
{
"city": "Kuala Lumpur",
"state": "W.P. Kuala Lumpur",
"state_code": "14"
}
]
}
}Plans
| Plan | Price a month | Requests a month |
|---|---|---|
| Basic | Free | 500 |
| Pro | $5 | 10,000 |
| Ultra | $15 | 100,000 |
| Mega | $39 | 1,000,000 |
Billing and keys are handled by RapidAPI. Data version 2026-11-16.
Frequently asked questions
Is the Malaysia postcode API free?
Yes. The Basic plan on RapidAPI is free for 500 requests a month; paid plans start at $5 a month.
Do you store the IC numbers sent to the MyKad endpoint?
No. Numbers are parsed in memory and not logged or stored. Send them with POST so they stay out of URLs.
Can the API confirm an IC number belongs to a real person?
No. It checks the structure (valid date, assigned place-of-birth code) and decodes it. Only JPN can confirm an IC was issued.