Lottery API HTTP request example for real-time data access. By default, use GET requests, and POST requests are also supported. Response formats include JSON, XML, JSONP, and JSON2.
https://api.byw.bet/api
https://api.byw.bet/apihttps://api.byw.bet/api?token=YOUR_TOKEN&t=4&limit=10&p=json
POST https://api.byw.bet/api
Content-Type: application/json
{
"p": "json",
"t": "120",
"token": "YOUR_TOKEN",
"limit": "5",
"date": "20260628",
"nexttime": "1"
}
Note: POST request response data and parameters are identical to GET requests.
| Parameter | Required | Type | Description |
|---|---|---|---|
token |
Yes | String | API Key from your dashboard |
t |
Yes | String | Lottery type code See lottery list |
p |
Yes | String |
Format: json / xml / json2 /
jsonp
|
limit |
No | Int | Number of records returned, range 1–50, default is 1, maximum is 50 |
date |
No | String | Query date, format: YYYYMMDD (returns all records for that day, ignores limit). |
nexttime |
No | Int | Set to 1 to include next draw time |
{
"rows": 1,
"type": "4",
"data": [
{
"expect": "20260418053",
"opencode": "9,0,0,1,1",
"opentime": "2026-04-18 21:50:03"
}
]
}
<?xml version="1.0" encoding="utf-8"?>
<xml rows="1" type="4">
<row expect="20260418053" opencode="9,0,0,1,1" opentime="2026-04-18 21:50:03"/>
</xml>
| Code | Meaning | Solution |
|---|---|---|
1001 |
Token is empty | Add valid token |
1002 |
Token not found or expired | Check token or renew |
1003 |
Token permission denied | Purchase lottery access |
1004 |
Invalid lottery code | Check lotteryid |
1005 |
Too many requests | Reduce request frequency |
1006 |
IP not authorized | Add IP to whitelist |
require_once 'BywClient.php';
$client = new BywClient('YOUR_TOKEN');
$result = $client->getLatest('4', 10);
var client = new BywClient("YOUR_TOKEN");
var results = await client.GetLatestAsync("4", 10);
const client = new BywClient('YOUR_TOKEN');
const results = await client.latest('4', 10);
curl "https://api.byw.bet/api?token=YOUR_TOKEN&t=4&limit=10&p=json"