freeapis

Open Trivia

冷知识问答

认证方式
No auth
HTTPS
Yes
CORS
Unknown

简介

Open Trivia DB 是免费、免密钥的百科问答 API,提供 4,000+ 道题目,覆盖 24 个分类(综合知识、书籍、电影、音乐、科学、计算机、体育、地理、历史……)、三档难度,以及多选和判断题两种形式。非常适合问答应用、游戏之夜和聊天机器人暖场。

2026-08 实测:API 响应正常,但限流比较激进——连续请求会返回 HTTP 429。请把请求间隔拉开(每次间隔一两秒即可)。

快速开始

获取一道题:

curl "https://opentdb.com/api.php?amount=1"

响应示例(含正确答案——怎么用就看你了!):

{
  "response_code": 0,
  "results": [
    {
      "type": "multiple",
      "difficulty": "easy",
      "category": "Geography",
      "question": "Which Borough is the farthest in the north of New York City?",
      "correct_answer": "Bronx",
      "incorrect_answers": ["Queens", "Brooklyn", "Manhattan"]
    }
  ]
}

按分类/难度/题型筛选:

curl "https://opentdb.com/api.php?amount=10&category=18&difficulty=medium&type=multiple"

用 session token 避免跨会话重复出题:

curl "https://opentdb.com/api_token.php?command=request"
curl "https://opentdb.com/api.php?amount=10&token=YOUR_TOKEN"

分类(部分)

ID 分类 ID 分类
9 综合知识 18 科学:计算机
10 书籍 19 科学:数学
11 电影 20 神话
12 音乐 21 体育
15 电子游戏 22 地理
17 科学与自然 27 动物

认证方式

无需认证——免密钥。(session token 是可选的,只用于防止题目重复。)

速率限制与注意事项

  • 突发请求出现 429 是正常的——客户端要做限速(请求间加延时)。
  • response_code0 = 成功,1 = 无结果(如 token 题库耗尽),2 = 参数无效,3 = token 不存在,4 = token 题库已用完。
  • 题目由社区贡献,偶尔有笔误或过时事实。
  • CORS 不保证——为稳定起见建议从服务端调用。

常见问题

Open Trivia DB 免费吗? 是的——免费且免密钥。

为什么返回 HTTP 429? 限流。把请求间隔拉开(每次间隔一两秒)即可正常。

如何避免重复出题? 先请求 session token(api_token.php?command=request),每次调用时带上。

游戏与漫画 分类更多

APIAuthHTTPSCORS
AmiiboAPI

Nintendo Amiibo Information

No authYesYes
Animal Crossing: New Horizons

API for critters, fossils, art, music, furniture and villagers

No authYesUnknown
Astroworld

Free Minecraft data: mobs, biomes, items, enchantments, structures, commands, versions, achievements, trades

No authYesYes
Autochess VNG

Rest Api for Autochess VNG

No authYesYes
Barter.VG

Provides information about Game, DLC, Bundles, Giveaways, Trading

No authYesYes