Deck of Cards
扑克牌
- 认证方式
- No auth
- HTTPS
- No
- CORS
- Unknown
- 分类
- 游戏与漫画
- 文档 / URL
- http://deckofcardsapi.com/
简介
Deck of Cards API 通过 HTTP 模拟真实扑克牌组:创建牌组、洗牌、抽牌、管理堆牌——全部免密钥、无状态(牌组状态在服务端,以 deck_id 标识)。是纸牌游戏原型、21 点教程和 HTTP 状态教学的经典选择。
快速开始
创建并洗一副牌(实测可用):
curl "https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1"
{"success": true, "deck_id": "7rl58j5kyh3e", "remaining": 52, "shuffled": true}
抽 2 张牌:
curl "https://deckofcardsapi.com/api/deck/7rl58j5kyh3e/draw/?count=2"
从部分牌组抽牌(如 21 点:两张 10 + 一张 A):
curl "https://deckofcardsapi.com/api/deck/new/draw/?count=2&cards=AS,KD"
重新洗牌(同一牌组):
curl "https://deckofcardsapi.com/api/deck/7rl58j5kyh3e/shuffle/"
堆牌(发到命名手牌):
curl "https://deckofcardsapi.com/api/deck/7rl58j5kyh3e/pile/player1/add/?cards=AS,KD"
curl "https://deckofcardsapi.com/api/deck/7rl58j5kyh3e/pile/player1/list/"
牌面格式
每张牌形如:
{
"code": "AS",
"image": "https://deckofcardsapi.com/static/img/AS.png",
"images": { "svg": "...", "png": "..." },
"value": "ACE",
"suit": "SPADES"
}
代码规则:点数(A、2-10、J、Q、K)+ 花色(S、H、D、C)。
认证方式
无需认证——免密钥。
速率限制与注意事项
- 免费,没有文档化的硬性限制;牌组状态在服务端保留一段时间——不要永久依赖它(长局游戏请新建牌组)。
- 响应中的
remaining跟踪未发牌数——可用于游戏逻辑。 - 牌面图片支持热链(静态 PNG/SVG)。
- 支持 HTTPS——请使用(列表收录的 URL 是 http)。
常见问题
Deck of Cards 免费吗? 是的——免费、免密钥。
牌组状态存在哪里?
服务端,以 deck_id 标识。保存该 id 并在后续请求中携带。
能用它做纸牌游戏吗? 可以——抽牌、堆牌、部分牌组和重新洗牌覆盖了大多数纸牌游戏机制。
游戏与漫画 分类更多
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| AmiiboAPI Nintendo Amiibo Information | No auth | Yes | Yes | ↗ |
| Animal Crossing: New Horizons API for critters, fossils, art, music, furniture and villagers | No auth | Yes | Unknown | ↗ |
| Astroworld Free Minecraft data: mobs, biomes, items, enchantments, structures, commands, versions, achievements, trades | No auth | Yes | Yes | ↗ |
| Autochess VNG Rest Api for Autochess VNG | No auth | Yes | Yes | ↗ |
| Barter.VG Provides information about Game, DLC, Bundles, Giveaways, Trading | No auth | Yes | Yes | ↗ |