AnkiWeb CLI
ReadingOct 2026Create flashcards, review decks, and batch import Markdown directly from your terminal, without running desktop Anki.
Quick start
go install github.com/sameerbajaj/ankiweb-cli/cmd/ankiweb@latest
ankiweb auth login
ankiweb card add --deck "Default" --front "What is Raft?" --back "Distributed consensus algorithm"Why I built this
Every Anki automation tool I came across required running the full Anki desktop application with the AnkiConnect add-on bound to port 8765. That works fine on a workstation where the desktop app is already open. If you want to add cards from a headless VPS, import reading notes from a background script, or review a quick hand of cards inside a terminal multiplexer without launching a heavy GUI, AnkiConnect cannot help you.
I wanted a standalone binary that talks directly to AnkiWeb over HTTPS using session cookies. No GUI required, no local server listening on a port, and no desktop dependencies.
How to manage flashcards from the command line
The CLI connects to your AnkiWeb account and lets you manage collections, run reviews, and batch import notes without opening a browser or the desktop client.
Custom card templates and arbitrary fields
Most command-line utilities only support basic Front and Back card pairs. If your decks use custom notetypes with five or six distinct fields, those tools fail. AnkiWeb CLI reads your collection schema and lets you populate arbitrary fields using --field "Name=Value" flags alongside standard tags.
Batch importing Markdown notes and cloze deletions
Turn raw reading notes into review cards in one pass with ankiweb card import. It handles common note formats including question-and-answer headings, explicit Q/A markers, bullet pairs (- Front :: Back), and cloze deletion syntax ({{c1::text}}).
Reviewing cards in your terminal shell
Run ankiweb study --deck "Spanish" to review due cards right in your shell. Hit space to flip the card, grade your recall from 1 to 4 (Again, Hard, Good, Easy), and the CLI records your ease score directly to AnkiWeb.
Analyzing deck backlog and review debt
The deck triage command calculates review debt across nested decks. It measures overdue card volume against your historical study pace and estimates how many days it will take to clear the backlog.
Connecting Anki to Claude with the MCP server
The project includes a built-in Model Context Protocol server (ankiweb-mcp) and an --agent flag that outputs structured JSON. This makes it easy for assistants in Claude Desktop or Cursor to inspect your review schedule and draft flashcards from what you are reading.
How to install and authenticate
- Install with Go (1.22+):
Or download a precompiled binary from GitHub Releases.go install github.com/sameerbajaj/ankiweb-cli/cmd/ankiweb@latest - Log in with your AnkiWeb account:
On headless systems, you can pass your session cookie directly viaankiweb auth loginexport ANKIWEB_COOKIES="ankiweb=YOUR_COOKIE". - Verify your connection:
ankiweb doctor
Local security and privacy
Session cookies and credentials stay on your local disk. The only network requests go directly to ankiuser.net over HTTPS to sync cards and review states. There are no analytics, no telemetry, and no third-party servers involved.