Admin API Endpoints
The admin site exposes these API endpoints for deck and collection editing. All endpoints require authentication.
For general admin API endpoints (authentication, config, audit log, etc.), see the admin command reference.
Create Deck
POST /api/deck/create
Create a new deck file. The slug is auto-generated from the name.
Request Body:
{
"name": "My Commander Deck",
"format": "commander"
}
| Field | Description | Required |
|---|---|---|
name | Deck name (used to generate the slug) | Yes |
format | Deck format (default: "commander") | No |
Response:
{
"success": true,
"message": "Created deck 'My Commander Deck'",
"slug": "my-commander-deck"
}
Rename Deck
POST /api/deck/:slug/rename
Rename a deck. Updates the frontmatter name field and renames the file to match the new slug. Also renames any associated changelog and primer files.
Request Body:
{
"newName": "New Deck Name"
}
Response:
{
"success": true,
"message": "Renamed deck to 'New Deck Name'",
"newSlug": "new-deck-name"
}
Delete Deck
DELETE /api/deck/:slug
Delete a deck. Requires the full deck name to be provided as confirmation. Removes the deck file along with any changelog and primer files.
Request Body:
{
"confirmName": "My Commander Deck"
}
The confirmName must match the deck's name field exactly. Returns 400 if they don't match.
Response:
{
"success": true,
"message": "Deleted deck 'My Commander Deck'"
}
Card Autocomplete
GET /api/autocomplete?q=<query>
Search for card names using the in-memory card cache. Returns up to 20 results sorted by relevance (prefix matches first, then substring matches).
Query Parameters:
| Parameter | Description | Required |
|---|---|---|
q | Search query (minimum 2 characters) | Yes |
Response:
{
"success": true,
"names": ["Sol Ring", "Soltari Champion"]
}
Load Deck
GET /api/deck/:slug
Load a deck with full card data, printings, and mana symbol map.
Response:
{
"success": true,
"deck": { "name": "...", "sections": [] },
"cards": { "Sol Ring": {} },
"printings": { "Sol Ring": [] },
"symbolMap": { "{W}": "https://..." },
"frontMatter": {},
"slug": "my-deck"
}
Card Printings
GET /api/card-printings?name=<cardName>
Get all printings of a card. Uses the card cache with fallback to Scryfall API.
Query Parameters:
| Parameter | Description | Required |
|---|---|---|
name | Exact card name | Yes |
Response:
{
"success": true,
"printings": [{ "id": "...", "set": "2xm" }]
}
Card Price
GET /api/card-price?name=<cardName>
Get price data for a card including representative and cheapest printings for all currencies. If the cached data is more than 24 hours old, fresh data is fetched from Scryfall and the cache is updated.
Query Parameters:
| Parameter | Description | Required |
|---|---|---|
name | Exact card name | Yes |
Response:
{
"success": true,
"printings": [{ "id": "...", "set": "2xm", "prices": { "usd": "1.23" } }],
"representative": { "id": "...", "set": "2xm" },
"lowestPriceCard": { "id": "...", "set": "a25" },
"lowestPriceCardEur": { "id": "...", "set": "a25" },
"lowestPriceCardTix": { "id": "...", "set": "vma" }
}
| Field | Description |
|---|---|
representative | The USD representative printing (recent, mid-priced) |
lowestPriceCard | The cheapest USD printing across all printings |
lowestPriceCardEur | The cheapest EUR printing |
lowestPriceCardTix | The cheapest MTGO Tix printing |
Save Deck
POST /api/deck/:slug/save
Save deck changes. Writes the updated deck file and appends to the changelog.
Request Body:
{
"changes": [{ "id": "...", "timestamp": 123, "action": "add", "cardName": "Sol Ring" }],
"deck": { "name": "...", "sections": [] },
"frontMatter": {}
}
Response:
{
"success": true,
"message": "Saved 3 changes to My Deck"
}
List Collections
GET /api/collections
Returns the list of available collections.
Response:
{
"success": true,
"collections": ["my-collection", "trade-binder"]
}
Load Collection
GET /api/collection/:slug
Load a collection with full card data, printings, and mana symbol map.
Response:
{
"success": true,
"collection": { "name": "...", "cards": [] },
"cards": { "Sol Ring": {} },
"printings": { "Sol Ring": [] },
"symbolMap": { "{W}": "https://..." },
"slug": "my-collection"
}
Save Collection
POST /api/collection/:slug/save
Save collection changes. Writes the updated collection file and creates a changelog entry.
Request Body:
{
"changes": [{ "id": "...", "timestamp": 123, "action": "add", "cardName": "Sol Ring" }],
"collection": { "name": "...", "cards": [] }
}
Response:
{
"success": true,
"message": "Saved 3 changes to My Collection"
}
List Wanted Lists
GET /api/wanted
Returns the list of available wanted lists.
Response:
{
"wantedLists": [{ "slug": "high-priority", "name": "High Priority" }]
}
Load Wanted List
GET /api/wanted/:slug
Load a wanted list with full card data, printings, and mana symbol map.
Response:
{
"success": true,
"entries": [{ "name": "Sol Ring", "set": "2xm", "collectorNumber": "270" }],
"cards": { "Sol Ring": {} },
"printings": { "Sol Ring": [] },
"symbolMap": { "{W}": "https://..." },
"slug": "high-priority"
}
Save Wanted List
POST /api/wanted/:slug/save
Save wanted list changes. Writes the updated wanted list file and appends to the changelog.
Request Body:
{
"changes": [{ "id": "...", "timestamp": 123, "action": "add", "cardName": "Sol Ring" }],
"entries": [{ "name": "Sol Ring", "set": "2xm", "collectorNumber": "270" }]
}
Response:
{
"success": true,
"message": "Saved 3 changes to high-priority"
}