FooSoft/anki-connect
Anki plugin to expose a remote API for creating flash cards.
Anki-Connect
Anki-Connect lets applications search, create, and update notes and cards in a running Anki Desktop collection through a local HTTP API.
Use API v1 for new integrations. It provides JSON-RPC 2.0, consistent records, structured errors, and explicit completion for long-running and interactive operations.
Existing applications can keep using the legacy API. The root endpoint, version 6 actions, parameter names, API key configuration, and response formats remain available. Existing clients do not need to migrate to v1. See the legacy guide for supported actions and compatibility details.
Install and run
Anki-Connect requires Anki Desktop 2.1.15 or later. Compatibility is tested with
every Anki 2.1 and later GitHub release listed in tools/anki_matrix.json, including
prereleases. Some methods need newer native features and report
unsupportedCapability on older releases; use api.describe to check method
availability in your running Anki instance.
| Methods | Available from |
|---|---|
collection.sync | 2.1.28 |
collection.undo, deckPresets.*, scheduling.repositionNewCards | 2.1.45 |
scheduling.answer, scheduling.answerMany, scheduling.getQueue, scheduling.predict | 2.1.45 with the v3 scheduler enabled (the default for new collections from 2.1.66) |
editors.openNote (and legacy guiEditNote) | 2.1.50 |
application.importFile (and legacy guiImportFile) | 23.10 |
Install Anki-Connect from AnkiWeb:
- In Anki, open Tools → Add-ons → Get Add-ons.
- Enter add-on code
2055492159and confirm the installation. - Restart Anki and open the profile you want your application to use.
Keep Anki running while your application uses the API; requests operate on the active profile's collection.
On macOS, Anki-Connect automatically suppresses App Nap after its HTTP listener
starts, keeping API requests responsive while Anki is minimized or in the
background. Suppression lasts until Anki exits and still allows normal system
sleep. No defaults write commands or separate App Nap add-on are needed.
Make your first request
The default v1 endpoint is http://127.0.0.1:8765/api/v1:
curl --request POST http://127.0.0.1:8765/api/v1 \
--header 'Content-Type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"decks.list","params":{}}'
{"jsonrpc":"2.0","id":1,"result":[{"id":"1","name":"Default","kind":"normal","presetId":"1"}]}
Continue with the v1 quick start and method reference. It includes
Python and JavaScript clients and request examples for all 94 methods. Entity IDs
are strings. Long-running methods return operation handles; poll operations.get
for the final result. api.describe reports the available methods and limits.
The legacy guide covers all 122 actions, their existing numeric IDs and response formats, and corresponding v1 methods. Both endpoints operate on the same active collection.
For an existing integration, send requests to http://127.0.0.1:8765/ using the
legacy action format:
curl --request POST http://127.0.0.1:8765/ \
--header 'Content-Type: application/json' \
--data '{"action":"deckNames","version":6,"params":{}}'
{"result":["Default"],"error":null}
Configuration
Open Tools → Add-ons → Anki-Connect → Config, then restart Anki after changing listener settings.
| Setting | Default | Purpose |
|---|---|---|
webBindAddress | 127.0.0.1 | Listen on the local machine. |
webBindPort | 8765 | HTTP port. |
apiKey | null | Optional authentication key. |
webCorsOriginList | ["http://localhost"] | Allowed browser origins. |
ignoreOriginList | [] | Origins for which permission prompts are suppressed. |
When a key is configured, v1 uses Authorization: Bearer <key> and legacy requests
use the JSON body’s key property. Browser origins require permission separately.
See v1 access rules and
legacy authentication.
On Windows, allow Anki through the firewall if prompted. Anki must remain running and responsive for requests to complete.
Troubleshooting
- Connection refused: check that Anki is running, the add-on is enabled, and your client uses the configured address and port. Restart Anki after installing the add-on or changing listener settings.
- Authentication or browser access errors: check your API key and origin permissions using the access rules linked above.
- A write is blocked by an editor: close editors for the affected notes, then retry the request. See the API guide for method-specific requirements.
- A method is unavailable: call
api.describeto inspect runtime capabilities and check the method's requirements in the API guide.
Contributing
See CONTRIBUTING.md for API changes, tests, and review guidelines, ARCHITECTURE.md for runtime structure, and api-v1.schema.json for the machine-readable contract.
To install from source, download or clone this repository and run
make package (or python tools/package_addon.py on Windows).
In Anki, choose Tools → Add-ons → Install from file, select the generated
AnkiConnect.zip, and restart Anki. The ZIP replaces the existing Anki-Connect
add-on code while retaining its saved configuration.
For development on Linux or macOS, make link links plugin/ into an existing
Anki add-ons directory. Use temporary profiles and collections when testing.
Run make test or .\tools\test.ps1 on Windows for the latest Anki version in the matrix,
including GUI scenarios. To skip GUI scenarios, use make test-unit or
.\tools\test.ps1 -NoUI.
To test the full compatibility matrix, use make test TEST_ARGS=--all-versions,
./tools/test.sh --all-versions, or .\tools\test.ps1 -AllVersions.
On Linux without a display, set QT_QPA_PLATFORM=offscreen; the runner then
hides any desktop session from Qt and uses software Qt Quick rendering.
Run make help for all development commands. Use make test VERSIONS="26.9.4"
to select Anki versions. The runners cache dependencies and interpreters in
.test-cache/ at the repository root. make check runs contract, API documentation,
coverage, and syntax checks in your current Python environment; select an
environment with make check PYTHON=/path/to/python. Use make contract to
regenerate the bundled contract. The Make targets use the scripts in tools/,
which can also be run directly without Make. GitHub Actions runs the same suite;
see CONTRIBUTING.md for the CI matrix.
Similar Projects
Discover other similar projects and AI models.
An immersion toolkit for learning Languages through games and other visual media.
AI-powered tools to enhance Anki flashcards with explanations, mnemonics, illustrations, and adaptive learning for medical school and beyond
Onigiri is an experimental add-on that replaces the standard Anki interface with a modern, highly customizable, and personalized dashboard, completely transforming how Anki looks.
《延世韩国语》1–6 册开源词源单词本:中韩英对照、词源追溯、可编辑数据与自制单词书生成器
Learn from your vibe coding instead of just clicking Accept. AhaDiff turns each AI diff into a code-verified lesson, quiz, and review. · 别再无脑 vibe coding 啦!让你从 vibe coding 中学到真东西。每次改动都变成能查证的课程、测验和复习。
AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.