Lottery API HTTP Request Example
Lottery API HTTP request example for real-time data access. Use GET calls to retrieve results in JSON, XML, JSONP, or JSON2 formats.
GET
http://api.byw.bet:868/api
API Request
📌 Basic Info
- Endpoint:
http://api.byw.bet:868/api - Method: GET
- Formats: JSON / XML / JSONP / JSON2
Request Example
HTTP GET
http://api.byw.bet:868/api?token=YOUR_TOKEN&t=4&limit=10&p=json
Parameters
| 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 |
JSON Response
JSON Response
{
"rows": 1,
"type": "4",
"data": [
{
"expect": "20260418053",
"opencode": "9,0,0,1,1",
"opentime": "2026-04-18 21:50:03"
}
]
}
XML Response
XML Response
<?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>
Error Codes
| 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 |
Code Examples
- PHP
- C#
- JavaScript
- cURL
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 "http://api.byw.bet:868/api?token=YOUR_TOKEN&t=4&limit=10&p=json"
Rate Limits
⚠️ Important
- Max 3 IPs per lottery per day
- Latest query: min interval 1 second, recommended 5-10 seconds
- History query: min interval 10 seconds
