Deck of Cards API
Free playing card API with no key: shuffle decks, draw cards, manage piles and get card images. Stateful deck ids. Tested curl example and live JSON.
Endpoint tested and returned HTTP 200 on 19 Aug 2026
What is the Deck of Cards API?
The Deck of Cards API is a free, key-free API that simulates physical decks of playing cards. It shuffles decks, deals cards, manages named piles and provides an image for every card, tracking state server-side via a deck id.
What makes this API unusual among free APIs is that it is stateful. You create a deck, get back a `deck_id`, and every subsequent draw remembers what has already been dealt — the API tracks `remaining` for you rather than making you manage the deck yourself.
That statefulness makes it genuinely useful for building real card games rather than just demos. It also supports named piles, so you can model each player's hand and a discard pile server-side, which removes most of the bookkeeping from your client code.
Quick facts
- Base URL
https://deckofcardsapi.com/api/deck- Authentication
- No key required.
- Rate limit
- No published limit.
- Pricing
- Free.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the Deck of Cards API
Every request below was executed against the live API on 19 Aug 2026, and the response shown is the real body it returned — not an illustration.
1. Shuffle a new deck of cards
GET https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1
curl 'https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1'const res = await fetch("https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1", timeout=20)
res.raise_for_status()
print(res.json()){
"success": true,
"deck_id": "xiyuflcig0a4",
"remaining": 52,
"shuffled": true
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
deck_count | integer | Optional | Number of 52-card decks to combine. 1 |
<deck_id> | path | Optional | Deck identifier returned when you created the deck. 3p40paa87x90 |
count | integer | Optional | How many cards to draw. 5 |
jokers_enabled | boolean | Optional | Include two jokers per deck. true |
Response fields
deck_idstring- Identifier used for all subsequent operations on this deck.
remaininginteger- Cards left undealt — the API tracks this for you.
shuffledboolean- Whether the deck has been shuffled.
cards[].codestring- Short card code such as AS for ace of spades.
cards[].imagestring- PNG image URL for the card face.
cards[].value / suitstring- Card value and suit as readable strings.
What you can build with the Deck of Cards API
- Build blackjack, poker or solitaire with server-tracked deck state
- Create card-based teaching demos without implementing shuffling
- Manage player hands and discard piles using named piles
- Render real card images without sourcing your own artwork
Common errors and how to fix them
Deck not found
The deck_id expired or was mistyped.
Fix: Deck ids are not permanent — create a new deck and store the id for the session.
Not enough cards remaining
You drew more than the deck holds.
Fix: Check `remaining` before drawing, or reshuffle with the /shuffle endpoint.
Deck of Cards API — frequently asked questions
Is the Deck of Cards API free?
Yes, completely free with no API key or registration required.
Does the API remember which cards have been dealt?
Yes. It is stateful — create a deck, keep the returned `deck_id`, and each draw is tracked server-side with a `remaining` count.
Can I use multiple decks at once?
Yes, pass `deck_count` when creating a deck to combine several 52-card decks, which is how casino blackjack shoes work.
Does it provide card images?
Yes, every card includes a PNG image URL for its face, so you do not need to source or draw your own card artwork.
Tools that pair with this API
Random Number Generator
Generate random numbers in any range with cryptographically secure randomness. Multiple numbers, no-repeat mode, sorting, plus dice and coin presets.
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
Alternatives to Deck of Cards API
If Deck of Cards does not fit, these game & anime apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.
| API | What it does | Auth | CORS | Last verified |
|---|---|---|---|---|
| PokéAPI | Free Pokémon API with no key: stats, types, abilities, moves, evolutions and sprites for 1,000+ species. The most popular API for learning REST. Tested example. | No key | Yes | 19 Aug 2026 |
| Rick and Morty API | Free Rick and Morty API with no key: 800+ characters, episodes and locations with images, filtering and pagination. REST and GraphQL. Tested example. | No key | Yes | 19 Aug 2026 |
| Jikan (MyAnimeList) | Free unofficial MyAnimeList API with no key: anime and manga data, scores, characters, staff and seasonal listings. Tested curl example and live JSON. | No key | Yes | 19 Aug 2026 |
| D&D 5e API | Free Dungeons & Dragons 5th Edition API with no key: spells, monsters, classes, races, equipment and rules from the SRD. Tested curl example and live JSON. | No key | Yes | 19 Aug 2026 |
| Digi-API | Free Digimon API with no key: Digimon with levels, attributes, types, evolution chains, skills and official artwork. Paginated. Tested curl example. | No key | Yes | 20 Aug 2026 |
| Digimon TCG (digimoncard.io) | Free Digimon Card Game API with no key: search cards by name, colour, level, type or set and get play costs, DP, effects and every set a card appeared in. Live example. | No key | Yes | 21 Aug 2026 |
Deck of Cards is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 19 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.