AnkiIO is a .NET 10 library for creating, validating, reading, and writing Anki-compatible deck data. It offers a format-independent object model, conventional Basic and Cloze helpers, custom note types, media, scheduling state, deterministic JSON, a CrowdAnki-inspired interchange format, and guarded legacy APKG I/O.
- Note
- AnkiIO was built with substantial AI assistance. Contributions and independent review are welcome.
Start here
- Getting started builds a useful deck and introduces the main APIs.
- Anki concepts explains why notes, cards, and templates are separate.
- Formats, compatibility, and safety defines the verified scope and important boundaries.
- The Classes and Class Members navigation entries contain the complete public API generated directly from the source comments.
Smallest useful program
var deck =
new AnkiDeck(
"German Vocabulary");
deck.AddBasicNote("Haus", "house", tags: ["german", "noun"]);
deck.AddBasicAndReversedNote("gehen", "to go", tags: ["german", "verb"]);
Builds one named deck hierarchy and acts as the root for validation and export.
Writes validated deck data as a legacy-compatible .apkg archive accepted by Anki 26....
static async Task WriteAsync(AnkiDeck deck, string path, CancellationToken cancellationToken=default)
Writes one deck hierarchy to a package file without opening or modifying an Anki profile.
AnkiIO never needs access to a live Anki profile to create a package. Write a new output file, inspect validation diagnostics when using advanced state, and import the resulting package through Anki.