ankit
A complete, async-first Rust client for the AnkiConnect API.
Features
- Complete API coverage - 79 AnkiConnect actions implemented (~85% coverage)
- Async-first - Built on
reqwestandtokio - Type-safe - Strongly typed request/response types with
serde - Ergonomic - Fluent API with action groups (
client.notes(),client.decks(), etc.) - Well-documented - Comprehensive doc comments and examples
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["rt-multi-thread", "macros"] }
use ;
async
Action Groups
Operations are organized into logical groups:
| Group | Description | Examples |
|---|---|---|
client.cards() |
Card operations | find, info, suspend, unsuspend, forget |
client.decks() |
Deck management | create, delete, names, stats, config |
client.gui() |
GUI control | browse, add_cards, show_answer |
client.media() |
Media files | store, retrieve, list, delete |
client.models() |
Note types | names, field_names, templates, create |
client.notes() |
Note operations | add, find, update, delete, add_tags |
client.statistics() |
Study stats | cards_reviewed_today, reviews_by_day |
client.misc() |
Utilities | version, sync, profiles, multi |
Examples
Find and inspect cards
// Find due cards
let due = client.cards.find.await?;
// Get card details
let info = client.cards.info.await?;
for card in info
Work with media
use StoreMediaParams;
// Store from base64
let params = from_base64;
client.media.store.await?;
// Store from URL
let params = from_url;
client.media.store.await?;
// List media files
let files = client.media.list.await?;
Batch operations
use MultiAction;
let actions = vec!;
let results = client.misc.multi.await?;
Client Configuration
use Duration;
use AnkiClient;
let client = builder
.url // Custom URL
.api_key // If AnkiConnect requires auth
.timeout
.build;
Related Crates
ankit-engine- High-level workflows (import, export, analyze, organize)ankit-builder- TOML-based deck builder with .apkg generationankit-mcp- MCP server for AI assistant integration
Requirements
- Anki with AnkiConnect add-on installed
- AnkiConnect running (Anki must be open)
- Rust 1.85+ (Edition 2024)
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.