Skip to content

Anki Export & Import

LWT can export your vocabulary to a real Anki package (.apkg) and read changes back from a .apkg you re-export from Anki. The flow is manual round-trip — not a live sync — but the file format is universal, so any Anki client (desktop, AnkiMobile, AnkiDroid, AnkiWeb) can study the deck.

Importing a deck you built in Anki?

This page covers the round trip for terms that started in LWT: export them, study in Anki, import the file back to update them. Notes are matched by an lwt- identifier that only LWT-exported files carry, so a deck built in Anki or downloaded from AnkiWeb has nothing to match and nothing would change.

To seed LWT from a deck you already study, use Import an Anki Deck instead.

When to use this

  • You already have an Anki workflow and want LWT to seed it from your reading.
  • You want to study LWT terms on your phone via AnkiDroid or AnkiMobile.
  • You want changes you make in Anki (translation tweaks, suspending a card you no longer need to drill) to flow back into LWT the next time you re-import.

If you only want LWT-side spaced repetition, the built-in Review module is simpler.

Round-trip in three steps

  1. Export — LWT generates lwt-{language}-{date}.apkg. Each LWT term becomes one Anki note with five fields: Term, Translation, Romanization, Notes, LwtId.
  2. Study in Anki — Import the file into Anki (File → Import). Subsequent exports merge cleanly because each note carries a stable guid (lwt-{TermID}), so Anki updates the existing note instead of creating a duplicate.
  3. Re-import to LWT — Export the deck from Anki (File → Export → Anki Deck Package, include scheduling info). Upload it back into LWT. Translation, romanization, notes, and tag edits flow back. Cards you suspended in Anki demote learning-status terms to Ignored in LWT.

Where to find it

On the vocabulary list page, both the "ALL" and "Marked Terms" action dropdowns expose the new options under their Export group:

  • Marked Terms → Export Selection to Anki package (.apkg) — exports only the terms you've ticked
  • ALL → Export Language to Anki package (.apkg) — exports every term in the current language
  • ALL → Import Anki package (.apkg)… — opens the upload form

Endpoints

EndpointPurpose
GET /vocabulary/apkg/export?lang_id=NStreams a whole-language .apkg
POST /vocabulary/apkg/exportSame, with optional marked[] to restrict to a subset
GET /vocabulary/apkg/importUpload form
POST /vocabulary/apkg/importAccepts a .apkg upload, merges into LWT, returns a summary

lang_id defaults to your current language if omitted. An empty marked[] is treated as "every term in the language".

Field mapping (LWT → Anki)

LWT columnAnki fieldNotes
WoTextTermSort field; also drives Anki's duplicate detection
WoTranslationTranslationBack of the card
WoRomanizationRomanizationShown on the front under the term, if non-empty
WoNotesNotesShown on the back, if non-empty
WoIDLwtId + note guidStable identity for round-trip
word_tag_mapNote tagsTag strings preserved; spaces in tag names become _

Status mapping

LWT statusAnki card stateOn re-import
1–5 (learning / learned)new card, not suspendedsuspended-in-Anki → demoted to Ignored (98)
98 (Ignored)suspendedunsuspending in Anki does not reverse this
99 (Well-known)suspendedunsuspending in Anki does not reverse this

The status mapping is intentionally one-way for 98/99 → suspended on export. We don't promote terms to Well-known based on Anki state because suspension and "well-known" carry different semantics, and silently collapsing them would lose information.

Scheduling state (ease, interval, due date) is not exported or imported. LWT and Anki keep their own SRS state. If you study the same word in both apps, you maintain two parallel review schedules — that's by design; see the discussion in #228.

What round-trips, what doesn't

FieldRound-trip
Term text
Translation
Romanization
Notes
Tags
Suspended ↔ Ignored (one direction)
Anki SRS state❌ (deliberate)
New notes added in Anki (no LWT id)❌ (silently skipped in v1)
Deletions in Anki❌ (LWT terms are never auto-deleted)

Note type and deck convention

  • Note type: a single LWT-defined type called LWT Term. Five fields, one card template (Term → Translation). Re-importing into Anki repeatedly does not create new note types — Anki dedupes on the type's id (1607392319000).
  • Deck: one Anki deck per LWT language, named LWT::{LanguageName}. The double-colon makes Anki nest it under a top-level LWT deck so all your LWT decks live under one parent.

Requirements

An .apkg is a zip containing a SQLite collection, so this feature needs PHP's pdo_sqlite extension. It is compiled in by default on most Linux builds; on Windows and some shared hosts you may need to enable extension=pdo_sqlite in php.ini and restart PHP. If it is missing, export and import stop with a message telling you exactly that — nothing else in LWT is affected.

Troubleshooting

"Anki .apkg support requires the pdo_sqlite PHP extension." See Requirements above — enable extension=pdo_sqlite in your php.ini.

"No terms to export for language X." The language has zero terms. Add some by reading a text first.

Anki imports the file but creates duplicates each time. That happens when the note guid changes between exports. LWT pins the guid to the LWT term ID, so this only occurs if you re-imported a .apkg from a different LWT install — guids are LWT-instance-specific.

Re-importing my edited .apkg reports "skipped (term not found): N". The original LWT term was deleted between export and re-import. New terms are not auto-recreated to avoid losing the language link; this will become an explicit prompt in a future iteration.

My Anki scheduling resets every time I import the file again. Anki only resets scheduling on full collection imports. Importing a .apkg deck merges by guid and preserves Anki's local schedule on existing notes.

The summary says "skipped (no LWT id): N". Those are notes you created directly in Anki (not via an LWT export). v1 ignores them; later we'll surface a "create as new term" flow with a language picker.

See also

  • Term Scores — LWT's own SRS algorithm
  • Issue #228 — design discussion and roadmap for richer Anki interop (real-time AnkiConnect bridge, etc.)

Released into the Public Domain under the Unlicense.