Deck of Cards API keeps real deck state on its server: create a shuffled deck, get its deck_id, then draw from it until it runs out.
None — no key, no signup. Every example runs as-is.
Full reference: https://deckofcardsapi.com/
Creates a shuffled deck and draws in one call. Keep deck_id to draw more.
curl "https://deckofcardsapi.com/api/deck/new/draw/?count=2"
{
"success": true,
"deck_id": "pjr5bute3qjf",
"cards": [
{
"code": "6D",
"image": "https://deckofcardsapi.com/static/img/6D.png",
"images": {
"svg": "https://deckofcardsapi.com/static/img/6D.svg",
"png": "https://deckofcardsapi.com/static/img/6D.png"
},
"value": "6",
"suit": "DIAMONDS"
},
{
"code": "3C",
"image": "https://deckofcardsapi.com/static/img/3C.png",
"images": {
"svg": "https://deckofcardsapi.com/static/img/3C.svg",
"png": "https://deckofcardsapi.com/static/img/3C.png"
},
"value": "3",
"suit": "CLUBS"
}
],
"remaining": 50
}
deck_count sets how many decks are shuffled together (blackjack uses 6).
curl "https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=6"
{
"success": true,
"deck_id": "wvss5rrd7wvt",
"remaining": 312,
"shuffled": true
}