Built-in REST API for Anki Clients

I would like to suggest and discuss a built-in REST API server for Anki Clients, particularly the Anki Desktop client.

As the many users of AnkiConnect demonstrate, there are many use-cases for 3rd party applications integrating with Anki.

Prior Art

I have searched through the forums and the only recent discussion on an Anki REST API appears to be centered around an AnkiWeb API, which is an entirely different beast and was understandably not desirable for the reasons discusssed in Is there any plan to expose REST api for Anki? and Anki public API

Why not just use AnkiConnect?

AnkiConnect is great and I have used it for a few projects in the past, namely the Obsidian Anki Bridge I built a few years ago (👋 AnkiBridge Introduction | Obsidian AnkiBridge), but has a few important shortcomings.

  1. Somewhat difficult to actually find the source code
    1. There are many unclosed issues on the AnkiConnect GitHub
    2. The project git repository and project website appears to be offline (https://foosoft.net/projects/anki-connect/ gives a HTTP 404 response (checked 2025-09-12)
    3. It does appear that it is actively hosted on ~foosoft/anki-connect - Anki plugin to expose a remote API for creating flash cards - sourcehut git
  2. Documentation could be improved (OpenAPI/Swagger)
  3. Does not follow the Anki release cycle
  4. Does not use versioned endpoints and overall API design could be improved upon
  5. Somewhat brittle implementation as a Python addon

That being said, using AnkiConnect is definitely a viable and decent option, although I would argue that a native and official implementation could be beneficial to the Anki ecosystem.

Musings on Implementation

  • Implementing this would not necessarily be a large undertaking and the maintenance burden should be relatively small
  • An implementation would likely tie in to the Rust core layer, so most likely the GUI actions from AnkiConnect would not be supported, which should be fine
  • An implementation outside of the Python Addon API and directly at or ‘next to’ the Rust core layer could mean that the API could be served from a no-gui/tray mode
    • This is a somewhat minor use-case, but is very helpful for some tools which insert or extract cards from Anki. The paper cut of having to have a full Anki instance open is sometimes brought up in the issues of such tools
  • Configuration for the implementation (and whether the server should be enabled, default could be disabled) would fit well within the “Third-Party Services” tab of the preferences.
  • Implementation could either be in Python or Rust – I am not sure whether Python is very gradually being phased out

I would be happy to contribute to the implementation and have experience implementing similar features in other projects, though I may benefit from some helpful discussion on where such a feature would fit in the Anki architecture, if it is deemed to be within the scope of the project.

MCP

I think a large number of users are using Anki in conjunction with AI tools and an additional MCP connector could be implemented in a similar fashion to the REST connector suggested here. This would be a separate discussion.

1 Like

There’s some discussion on GitHub:

I’m interested in contributing to making this happen in the future (will take me at least a few months to start looking into it).

3 Likes

That sounds really neat! I think exposing an OpenAPI schema would enable MCP to be easily added using something like crates/rmcp-openapi-server · main · LX Industries / rmcp-openapi · GitLab. I realise AI and associated tooling is still a somewhat controversial topic, so I understand if something like this would not be considered appropriate for Anki or at least as a core item.

1 Like

I’ve actually been working on something similar - made a plugin called AnkiRestful to help with card creation via API. It’s still in early stages and can only fetch and manage limited information., but the basic stuff is working. You can check it out here: GitHub - sailist/AnkiRestful . Suggestions and contributions from anyone are totally welcome!