lottery-results-history-query
彩票開獎及歷史查詢
查詢雙色球、大樂透等八類福利彩票和體育彩票的官方開獎結果,支援獲取最近最多 50 期的歷史開獎號碼與時間。
呼叫價格
5 匠幣/次
快速接入
保持統一返回結構,直接透過服務端發起請求即可接入。
https://openapi.toolkk.com/v1/lottery-results-history-querycURL 示例
curl --request POST \
--url 'https://openapi.toolkk.com/v1/lottery-results-history-query' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--data '{\n "type": "ssq",\n "count": "20"\n}'Python 示例
import os
import requests
url = "https://openapi.toolkk.com/v1/lottery-results-history-query"
payload = {
"type": "ssq",
"count": "20"
}
headers = {
"Content-Type": "application/json",
"X-API-Key": os.getenv("TOOLKK_API_KEY", "YOUR_API_KEY"),
}
response = requests.request("POST", url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.json())Go 示例
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
endpoint := "https://openapi.toolkk.com/v1/lottery-results-history-query"
payload := []byte("{\n \"type\": \"ssq\",\n \"count\": \"20\"\n}")
req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}Java 示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ToolkkExample {
public static void main(String[] args) throws Exception {
String payload = "{\n \"type\": \"ssq\",\n \"count\": \"20\"\n}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://openapi.toolkk.com/v1/lottery-results-history-query"))
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.header("Content-Type", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP 示例
<?php
$endpoint = 'https://openapi.toolkk.com/v1/lottery-results-history-query';
$payload = "{\n \"type\": \"ssq\",\n \"count\": \"20\"\n}";
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
curl_close($ch);
echo $response;響應示例
{
"count": 20,
"items": [
{
"expect": "2026078",
"openCode": "01,02,03,04,05,06+07",
"name": "双色球",
"time": "2026-07-19 21:15:00"
}
]
}範例用於理解回傳結構,實際結果以介面回傳為準。
- 鑑權方式
- 請求頭傳入 X-API-Key
- 預設限流
- 30 次/分鐘
- 超時時間
- 15000 ms
服務端呼叫時,將 API Key 放在 X-API-Key 請求頭中。
建議按 response code 與業務欄位雙重判斷呼叫結果。
高頻呼叫場景請結合速率限制與重試策略使用。
請求欄位
從伺服器發起請求,並在 X-API-Key 標頭中傳入金鑰。
請求欄位
以下欄位根據示例 JSON 自動提取,僅作接入參考。
| 欄位路徑 | 型別 | 必填 | 說明 | 示例值 |
|---|---|---|---|---|
| type | string | 未標註 | 未標註 | ssq |
| count | string | 未標註 | 未標註 | 20 |
請求示例
{
"type": "ssq",
"count": "20"
}- 鑑權方式
- 請求頭傳入 X-API-Key
- 預設限流
- 30 次/分鐘
- 超時時間
- 15000 ms
響應欄位
範例用於理解回傳結構,實際結果以介面回傳為準。
響應欄位
以下欄位根據示例 JSON 自動提取,僅作接入參考。
| 欄位路徑 | 型別 | 必填 | 說明 | 示例值 |
|---|---|---|---|---|
| count | number | 未標註 | 未標註 | 20 |
| items | array | 未標註 | 未標註 | [{"expect":"2026078","openCode":"01,02,03,04,05,06+07","name":"双色球","time":"2026-07-19 21:15:00"}] |
| items[] | object | 未標註 | 未標註 | {...} |
| items[].expect | string | 未標註 | 未標註 | 2026078 |
| items[].openCode | string | 未標註 | 未標註 | 01,02,03,04,05,06+07 |
| items[].name | string | 未標註 | 未標註 | 双色球 |
| items[].time | string | 未標註 | 未標註 | 2026-07-19 21:15:00 |
響應示例
{
"count": 20,
"items": [
{
"expect": "2026078",
"openCode": "01,02,03,04,05,06+07",
"name": "双色球",
"time": "2026-07-19 21:15:00"
}
]
}$.code == 200介面簡介
介面功能、應用情境、使用限制與常見問題。
介面能力
本介面提供中國福利彩票和體育彩票的開獎結果及歷史記錄查詢服務。支援雙色球、大樂透等八類常見彩種。使用者可透過指定彩種型別和查詢期數,快速獲取最近最多 50 期的官方開獎號碼、期號以及開獎時間。資料結構清晰,方便開發者快速整合到各類資訊查詢應用中。
請求與返回
- 請求引數:需傳入
type(彩種程式碼,如 ssq 代表雙色球)和count(需要查詢的期數,最大支援 50 期)。 - 返回結果:返回包含查詢期數
count和具體記錄items的 JSON 資料。每條記錄包含expect(期號)、openCode(開獎號碼,通常以逗號和加號分隔)、name(彩種名稱)以及time(開獎時間)。
使用場景
適用於便民服務類 App、生活資訊網站、小程式等需要為使用者提供彩票開獎資訊核對、歷史開獎記錄查詢的場景。
使用說明與限制
- 合規宣告:本介面僅展示客觀的開獎資料與歷史記錄,絕不提供任何形式的號碼預測、薦號、投注建議、推薦或投注入口。
- 資料準度:介面返回結果僅供參考,最終開獎資訊請務必以國家彩票發行管理機構的最新官方公告為準。
- 呼叫邊界:單次查詢最多支援 50 期歷史資料。若請求失敗,請檢查彩種程式碼是否正確以及請求期數是否超出限制範圍。