canonical: https://jentic.com/apis/deckofcardsapi.com/deckofcardsapi

# Deck of Cards API

The Deck of Cards API simulates one or more decks of playing cards and returns an image for every card it deals. It creates and shuffles decks, optionally partial, multiple, or with Jokers, draws cards, organizes drawn cards into named piles, and returns cards to the deck. It is a free, public, no-auth service where every endpoint takes its parameters as either GET query parameters or POST form fields, and each deck is identified by a deck id and discarded after two weeks of inactivity.

## For AI agents

Create and shuffle one or more decks of playing cards, draw cards with image URLs, organize them into named piles, and return them to the deck. A free, public, no-auth card simulator.

## Scope

Does not handle real-money gaming, player accounts, or game scoring. Use for simulating shuffled card decks, draws, and piles only.

## Capabilities

- Create a new deck, optionally shuffled, partial, multiple, or with Jokers
- Shuffle or reshuffle a deck by its deck id
- Draw cards from a deck and read each card's image URL
- Organize drawn cards into named piles and list a pile's cards
- Draw cards from the top, bottom, or at random from a pile
- Return drawn cards to the deck

## Use cases

### Agent-Run Card Game Logic

An AI agent connected through Jentic runs the deal-and-draw logic of a card game by creating a shuffled deck, drawing hands, and tracking each player's cards in a named pile. Because the API returns a stable deck id and an image for every card, the agent can keep game state and render the table without implementing shuffling itself.

Example prompt: Create a shuffled deck, draw a five-card hand into a named pile, and list that pile to confirm the hand

### Shuffle and Draw for Prototyping

A developer prototyping a game or demo creates a shuffled deck in one call and draws cards as needed, with options for partial decks, multiple decks, or Jokers. The no-auth design means the prototype works with no sign-up, and decks are discarded after two weeks of inactivity so there is nothing to clean up.

Example prompt: Create a shuffled deck with two decks and Jokers, then draw ten cards and report what was drawn

### Pile-Based Hand Management

A multiplayer tool deals from one deck and keeps each player's hand in a separate named pile, drawing from the top, bottom, or at random as the game requires. Piles can be listed and shuffled independently, so the tool manages several hands against a single deck id.

Example prompt: Deal three cards each into two named piles from one deck and list both piles to show each hand

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/deck/new/shuffle/` | Create a new shuffled deck |
| GET | `/deck/{deck_id}/draw/` | Draw cards from a deck |
| GET | `/deck/{deck_id}/shuffle/` | Reshuffle a deck |
| GET | `/deck/{deck_id}/pile/{pile_name}/add/` | Add cards to a pile |
| GET | `/deck/{deck_id}/pile/{pile_name}/list/` | List cards in a pile |
| GET | `/deck/{deck_id}/return/` | Return drawn cards to the deck |

## Key resources

- **Decks** — Create, shuffle, and reshuffle decks, draw cards, and return drawn cards
- **Piles** — Add drawn cards to named piles, list and shuffle them, and draw from a pile

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 70 / 100
- **Maturity:** AI-Aware
- **Dimensions:**
  - Foundational Compliance: 72 / 100
  - Developer Experience & Jentic Compatibility: 67 / 100
  - AI-Readiness & Agent Experience: 49 / 100
  - Agent Usability: 94 / 100
  - Security: 100 / 100
  - AI Discoverability: 80 / 100
- **View full report:** https://jentic.com/apis/deckofcardsapi.com/deckofcardsapi/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring the Deck of Cards API by hand still means reading its base path, its deck lifecycle, and the convention that every endpoint takes its parameters as either GET query parameters or POST form fields. Through Jentic you install once, import the Deck of Cards API from the API Directory, and your agent calls it.
- **Permission scoping:** The Deck of Cards API puts the deck id in the URL path (`/deck/{deck_id}/...`), so a rule can pin your agent to one deck and the operations you pick, such as drawing cards and listing piles. You choose the operations it may call, so a full reshuffle is not included unless you add it.
- **Credential handling:** The Deck of Cards API is public and needs no key or token, so there is nothing for Jentic to store or inject. Your agent calls it directly through your own Jentic One instance, which still logs every call it makes.
- **Discovery method:** Agents search Jentic by intent such as 'shuffle a new deck' or 'draw cards from a deck', and Jentic returns the matching Deck of Cards operation with its input schema so the agent calls the right endpoint without reading the reference docs.

## Related APIs

- **RAWG Video Games Database API** — A different kind of game data: RAWG catalogs video games, where Deck of Cards simulates physical card decks.
- **PokeAPI** — Supplies game character and card data for apps that may also simulate play with Deck of Cards.
- **IGDB API** — Provides a broad games database alongside the live card mechanics Deck of Cards offers.

## FAQ

### Does the Deck of Cards API require authentication?

No. The Deck of Cards API is a free, public, no-auth service per its OpenAPI spec, so no key or token is needed. Through Jentic your agent calls it directly, with the same operation scoping and audit log as any other API in your directory.

### Can I draw cards and build piles with the Deck of Cards API?

Yes. Create a deck, shuffle it, and draw cards, each returned with an image URL, then move drawn cards into named piles that you can list, shuffle, and draw from independently. Drawn cards can also be returned to the deck.

### Can I limit what my agent is allowed to do with the Deck of Cards API?

Yes. The deck id sits in the URL path, so write a rule that allows only the draw and pile-listing operations against one deck, letting your agent deal and read hands but not reshuffle or create new decks, and every call it makes is logged. Add the shuffle and new-deck operations when you want the agent to start fresh games too.

### What are the rate limits for the Deck of Cards API?

The OpenAPI spec does not state rate limits for the Deck of Cards API. It is a free public service, so check the Deck of Cards documentation for any limits before relying on it at high volume.

### How do I draw cards from a shuffled deck with the Deck of Cards API through Jentic?

Search Jentic for 'draw cards from a shuffled deck' and it returns the draw operation with its input schema; your agent creates a shuffled deck, draws the number of cards it needs, and reads each card's image URL. To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Is there a Deck of Cards MCP server?

You don't need an MCP server to give your agent the Deck of Cards API. Jentic connects it directly from the API Directory: import it and your agent calls the shuffle, draw, and pile operations, with no key required and scoping applied.
