OngLai4D · 旺来

Developer API

A free, read-only JSON API for Malaysia 4D results — latest draws, history by date, per-number records, and jackpot growth. Build a bot, a widget, or your own analysis.

Quick start

No key needed to try it — just call an endpoint. Base URL:

curl https://onglai4d.com/api/v1/results/latest

Authentication & rate limits

Anonymous — works with no key, but is burst-limited and best-effort. Fine for trying the API and light use.

With an API key — an authoritative daily quota (default 10,000 req/day) and a higher burst allowance. Send it as a bearer token:

curl -H "Authorization: Bearer ol_live_xxx" \
     https://onglai4d.com/api/v1/results/latest

# or as a query param:
curl "https://onglai4d.com/api/v1/results/latest?key=ol_live_xxx"

Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Tier headers. Over quota returns 429 with Retry-After. Quotas reset at 00:00 UTC.

Want a key? Email hello@onglai4d.com with a one-line description of your use case.

Endpoints

GET/api/v1/results/latest

Most recent draw for every operator.

curl https://onglai4d.com/api/v1/results/latest

{
  "results": [
    { "operator": "magnum", "operatorName": "Magnum 4D",
      "drawDate": "2026-07-15", "first": "1234",
      "second": "5678", "third": "9012",
      "special": ["..."], "consolation": ["..."] }
  ]
}
GET/api/v1/results/date/{YYYY-MM-DD}

All operators' results for a specific draw date.

curl https://onglai4d.com/api/v1/results/date/2026-07-15
GET/api/v1/numbers/{4-digits}

Full win history and breakdowns for one 4-digit number, across 40+ years.

curl https://onglai4d.com/api/v1/numbers/8004

{
  "number": "8004", "total": 49,
  "lastDrawn": "2026-06-30", "firstDrawn": "1986-...",
  "byOperator": [ { "operator": "magnum", "count": 9 } ],
  "byPrize":    [ { "prize": "1st Prize", "count": 3 } ],
  "history":    [ { "date": "...", "operator": "...",
                    "prize": "..." } ]
}
GET/api/v1/jackpots/{operator}?limit=120

Jackpot growth series for an operator, oldest → newest (Magnum has the deepest history).

curl https://onglai4d.com/api/v1/jackpots/magnum?limit=30

{
  "operator": "magnum",
  "series": [ { "date": "2026-07-15",
                "jackpot1": 5637289.82,
                "jackpot2": 326086.40 } ]
}
GET/api/v1/operators

The operator vocabulary used across the API.

curl https://onglai4d.com/api/v1/operators

Errors

Errors are JSON with a stable code. Statuses: 400 bad input, 401 unknown key, 403 revoked key, 429 rate/quota.

{ "error": { "code": "quota_exceeded",
             "message": "Daily quota of 10000 requests reached. Resets at 00:00 UTC." } }

Embeddable widget

Show live Malaysia 4D results on your own site with one line — no API key, no JavaScript. Just an iframe:

<iframe src="https://onglai4d.com/widget"
        width="420" height="360" style="border:0"
        title="Malaysia 4D Results"
        loading="lazy"></iframe>

Options via query string: ?theme=dark and ?operators=magnum,toto,damacai (any of magnum, toto, damacai, sabah88, stc, cashsweep, singapore).

The widget is read-only and self-contained; it's the only page we allow to be framed.

Fair use

Results are aggregated from public sources and provided as-is, with no warranty — verify against the official operator before acting on them. Cache where you can, don't hammer, and a link back to onglai4d.com is appreciated.