English English
Chinese Chinese
English English

Lottery API HTTP Request Example

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.

GET / POST https://api.byw.bet/api

API Request

📌 Basic Info

  • Endpoint: https://api.byw.bet/api
  • Method: GET / POST (Both methods support CORS requests)
  • Formats: JSON / XML / JSONP / JSON2

GET Request Example

HTTP GET
https://api.byw.bet/api?token=YOUR_TOKEN&t=4&limit=10&p=json

POST Request Example

HTTP POST
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.

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 "https://api.byw.bet/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