asean-lottery-check-number-history avatar
asean-lottery-check-number-history

Under maintenance

Pricing

$2.00 / 1,000 results

Go to Store
asean-lottery-check-number-history

asean-lottery-check-number-history

Under maintenance

Developed by

Zhen Kai

Zhen Kai

Maintained by Community

Returns the historical results for a specific number with a particular lottery provider. This endpoint is only available for Malaysian and Singaporean providers, with records dating back to the year 2000.

0.0 (0)

Pricing

$2.00 / 1,000 results

0

Total users

1

Monthly users

1

Last modified

11 days ago

ASEAN Lottery Check Number History Actor

This Apify actor retrieves the complete historical record of a specific 4D number for Malaysia and Singapore lottery providers. It tracks when and how often a number has appeared in draws since the year 2000.

🎯 What it does

The actor connects to a MySQL database and fetches the complete history of a specific 4D number, including:

  • All dates when the number appeared
  • Prize type for each occurrence (first, second, third, special, consolation)
  • Complete chronological history since 2000

Note: This feature is only available for Malaysia and Singapore providers.

🌏 Supported Providers

Malaysia (6 providers)

  • MAG - Magnum 4D
  • DMC - Da Ma Cai 4D
  • TOT - Sports Toto 4D
  • CSP - Cashsweep 4D
  • STC - Sandakan 4D
  • S88 - Sabah 88 4D

Singapore (1 provider)

  • SGP - Singapore Pools 4D

❌ Not Supported

  • Cambodia providers (GDL, LHH, PDN)
  • Vietnam provider (VIE)
  • Philippines provider (PHL)

πŸ“₯ Input

The actor requires both a Provider ID (PID) and a 4-digit number:

{
"pid": "MAG",
"number": "1234"
}

Input Parameters

  • pid (string, required): Provider ID from Malaysia/Singapore only
  • number (string, required): 4-digit lottery number (e.g., "1234", "0001")

Input Validation

  • PID: Must be from Malaysia or Singapore providers
  • Number: Must be exactly 4 digits
  • Format: Numbers with leading zeros supported (e.g., "0123")

πŸ“€ Output

The actor returns the complete history of the specified number:

{
"success": true,
"data": {
"name": "Magnum",
"number": "1234",
"result": [
{
"draw_date": "20250520",
"prize": "first"
},
{
"draw_date": "20241104",
"prize": "special"
},
{
"draw_date": "20230815",
"prize": "consolation"
},
{
"draw_date": "20200125",
"prize": "second"
}
]
}
}

Output Fields

  • success (boolean): Operation success status
  • data (object): Number history data
    • name (string): Lottery company name
    • number (string): The queried 4D number
    • result (array): Array of historical occurrences
      • draw_date (string): Date in YYYYMMDD format
      • prize (string): Prize type - "first", "second", "third", "special", "consolation"

Prize Types

  • first - First prize winner
  • second - Second prize winner
  • third - Third prize winner
  • special - Special prize winner
  • consolation - Consolation prize winner

βš™οΈ Configuration

Required Environment Variables

MYSQLHOST=your_database_host
MYSQLUSER=your_database_user
MYSQLPASSWORD=your_database_password
MYSQLDATABASE=your_database_name
MYSQLPORT=3306

Alternative Environment Variables (Fallback)

DB_HOST=your_database_host
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_NAME=your_database_name
DB_PORT=3306

πŸ“Š Database Requirements

lottery_companies

  • company_id (INT, PRIMARY KEY)
  • pid (VARCHAR) - Provider ID
  • name (VARCHAR) - Company name

number_history

  • company_id (INT) - Foreign key to lottery_companies
  • number (VARCHAR) - 4-digit lottery number
  • draw_date (DATE) - Date when number appeared
  • prize_type (VARCHAR) - Type of prize won

πŸš€ Usage Examples

Run via Apify Console

  1. Go to the actor page
  2. Click "Start"
  3. Enter input: {"pid": "MAG", "number": "1234"}
  4. View results in the Dataset

Run via API

curl -X POST https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"pid": "MAG", "number": "1234"}'

Run via Apify Client (Node.js)

const { ApifyApi } = require('apify-client');
const client = new ApifyApi({
token: 'YOUR_API_TOKEN'
});
const input = {
pid: 'MAG',
number: '1234'
};
const run = await client.actor('YOUR_ACTOR_ID').call(input);
const dataset = await client.dataset(run.defaultDatasetId).listItems();
console.log(dataset.items[0]);

Number Analysis Example

// Analyze multiple numbers for frequency
const numbers = ['1234', '5678', '9999', '0001'];
const results = {};
for (const number of numbers) {
const run = await client.actor('YOUR_ACTOR_ID').call({
pid: 'MAG',
number: number
});
const dataset = await client.dataset(run.defaultDatasetId).listItems();
if (dataset.items[0]?.data?.result) {
results[number] = {
total_appearances: dataset.items[0].data.result.length,
last_appearance: dataset.items[0].data.result[0]?.draw_date,
prize_breakdown: {}
};
// Count prize types
dataset.items[0].data.result.forEach(entry => {
const prize = entry.prize;
results[number].prize_breakdown[prize] =
(results[number].prize_breakdown[prize] || 0) + 1;
});
}
}
console.log('Number analysis:', results);

Lucky Number Checker

// Check if a number appeared in the last year
const checkRecentAppearances = async (pid, number) => {
const run = await client.actor('YOUR_ACTOR_ID').call({ pid, number });
const dataset = await client.dataset(run.defaultDatasetId).listItems();
if (!dataset.items[0]?.data?.result) return [];
const oneYearAgo = new Date();
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
const cutoffDate = oneYearAgo.toISOString().slice(0, 10).replace(/-/g, '');
return dataset.items[0].data.result.filter(entry =>
entry.draw_date >= cutoffDate
);
};
// Usage
const recentAppearances = await checkRecentAppearances('MAG', '1234');
console.log(`Number 1234 appeared ${recentAppearances.length} times in the last year`);

πŸ” Statistical Analysis

Frequency Analysis

// Calculate number frequency and patterns
const analyzeNumberHistory = (historyData) => {
const results = historyData.data.result;
const analysis = {
total_appearances: results.length,
first_appearance: results[results.length - 1]?.draw_date,
last_appearance: results[0]?.draw_date,
prize_distribution: {},
yearly_frequency: {},
average_gap_days: 0
};
// Prize distribution
results.forEach(entry => {
const prize = entry.prize;
analysis.prize_distribution[prize] =
(analysis.prize_distribution[prize] || 0) + 1;
});
// Yearly frequency
results.forEach(entry => {
const year = entry.draw_date.substring(0, 4);
analysis.yearly_frequency[year] =
(analysis.yearly_frequency[year] || 0) + 1;
});
// Calculate average gap between appearances
if (results.length > 1) {
let totalGap = 0;
for (let i = 0; i < results.length - 1; i++) {
const date1 = new Date(
results[i].draw_date.substring(0, 4),
parseInt(results[i].draw_date.substring(4, 6)) - 1,
results[i].draw_date.substring(6, 8)
);
const date2 = new Date(
results[i + 1].draw_date.substring(0, 4),
parseInt(results[i + 1].draw_date.substring(4, 6)) - 1,
results[i + 1].draw_date.substring(6, 8)
);
totalGap += Math.abs(date1 - date2) / (1000 * 60 * 60 * 24);
}
analysis.average_gap_days = Math.round(totalGap / (results.length - 1));
}
return analysis;
};

πŸ” Troubleshooting

Common Errors

Unsupported Provider

{
"success": false,
"message": "This endpoint is only available for Malaysia and Singapore game providers."
}
  • Only use PIDs: MAG, DMC, TOT, CSP, STC, S88, SGP
  • Cambodia, Vietnam, Philippines not supported

Invalid Number Format

{
"success": false,
"message": "Invalid number format. Number must be exactly 4 digits."
}
  • Use exactly 4 digits
  • Include leading zeros if needed (e.g., "0123")
  • Numbers must be numeric only

Invalid PID

{
"success": false,
"message": "No lottery company found with pid XYZ"
}
  • Check PID spelling and case
  • Use only supported Malaysia/Singapore PIDs

Empty History

{
"success": true,
"data": {
"name": "Magnum",
"number": "1234",
"result": []
}
}
  • Number has never appeared in draws
  • Check if number is valid
  • Try different numbers

πŸ“ˆ Use Cases

Personal Number Tracking

  • Track your favorite numbers
  • Check winning history
  • Analyze patterns

Statistical Research

  • Number frequency analysis
  • Prize distribution studies
  • Pattern recognition

Lucky Number Selection

  • Find numbers with recent wins
  • Avoid overdue numbers
  • Historical performance analysis

Verification

  • Verify old ticket claims
  • Check historical results
  • Confirm number appearances

Some commonly tracked numbers include:

  • Birth dates (e.g., "0315" for March 15)
  • Lucky numbers (e.g., "8888", "9999")
  • Sequential numbers (e.g., "1234", "5678")
  • Repeated digits (e.g., "1111", "2222")

πŸ“Š Data Insights

Historical Coverage

  • Start Date: Records from year 2000
  • Coverage: Complete draw history
  • Updates: Real-time with new draws
  • Accuracy: Direct from official sources

Prize Frequency Patterns

  • First Prize: Rarest occurrences
  • Special: More frequent than top 3 prizes
  • Consolation: Most frequent category
  • Distribution: Varies by provider and number

πŸ”’ Security Considerations

  • Use read-only database access
  • Secure credential storage
  • Monitor for excessive queries
  • Rate limiting for fair usage

πŸ“ˆ Performance Tips

  • Results are cached for better performance
  • Large histories may take longer to process
  • Consider pagination for very active numbers
  • Optimize queries for frequently checked numbers

🚨 Fair Usage

Please use responsibly:

  • Avoid excessive automated queries
  • Don't overload the system
  • Consider implementing local caching
  • Respect rate limits

πŸ“ž Support

Common issues and solutions:

  1. Wrong provider: Use only Malaysia/Singapore PIDs
  2. Invalid number: Use exactly 4 digits
  3. Empty results: Number may never have appeared
  4. Slow response: Large histories take time to process

πŸ“Š Sample Output Interpretation

{
"success": true,
"data": {
"name": "Magnum",
"number": "1234",
"result": [
{"draw_date": "20250315", "prize": "first"},
{"draw_date": "20240820", "prize": "special"},
{"draw_date": "20230505", "prize": "consolation"}
]
}
}

Interpretation:

  • Number "1234" has appeared 3 times in Magnum
  • Most recent: March 15, 2025 (First Prize)
  • Previous: August 20, 2024 (Special Prize)
  • Earlier: May 5, 2023 (Consolation Prize)
  • Results are sorted by date (newest first)

πŸ“„ License

This actor is provided for number history tracking and analysis purposes.