English English
Chinese Chinese
English English

Quick Start Guide

Get started with BYW Lottery API in 5 minutes

1

Register

Create BYW account

2

Get Token

Create API key

3

Install SDK

Choose language

4

Call API

Get draw data

Step 1: Register

Quick Register

Visit BYW registration page to create an account. Free trial is available after registration.

After logging in, go to Free Trial to select the lottery types you want to try. The system will automatically create a trial Token.

Step 2: Get API Token

Token is the credential for calling the API. You can manage multiple Tokens in the dashboard.

  1. 1.Go to "API Management" -> "Token Management" after login
  2. 2.Click the "Create Token" button
  3. 3.Select the lottery types to authorize
  4. 4.Copy the Token and keep it safe

Security Notice

  • Token leakage may result in unauthorized data access
  • Store Token in backend server environment variables
  • If Token is compromised, recreate it immediately

Step 3: Install SDK

  • C#
  • PHP
  • JavaScript

NuGet Install

Install-Package BywLottery.SDK

dotnet add package BywLottery.SDK

Initialize

using BywLottery.SDK;
var client = new BywClient("YOUR_TOKEN");
var result = await client.GetLatestAsync("4");

Composer Install

composer require byw/lottery-api-sdk

Initialize

require_once 'vendor/autoload.php';
$client = new BywClient('YOUR_TOKEN');
$result = $client->getLatest('4');

NPM Install

npm install byw-lottery-api-sdk

Initialize

const { BywClient } = require('byw-lottery-api-sdk');
const client = new BywClient('YOUR_TOKEN');
const result = await client.latest('4');

Step 4: Call API

Get Latest Result

// Get latest result for Chongqing SSC (lotteryid=4)
var result = await client.GetLatestAsync("4");
Console.WriteLine($"Period: {result.Expect}");
Console.WriteLine($"Number: {result.Opencode}");

Get Multiple Results

// Get the latest 10 draw results
var results = await client.GetLatestAsync("4", 10);

Next Steps