AnkiWeb
- Rating
- 0 (π 0 Β· π 0)
- Updated
- 2026-09-21
- Anki versions
- 2.1.1~
- Description language
- en
AnkiWeb addon 1635024181
Enables external apps to communicate with Anki over HTTP, retrieves custom fields and FSRS values, and can disable macOS App Nap to prevent freezes.
Open on AnkiWeb GitHub Ask about alternatives
active
| Min Anki | Max Anki | Updated |
|---|---|---|
| 2.1.1 | + | 2026-09-21 |
Loadingβ¦
Disables macOS App Nap to keep Anki awake, helping add-ons such as AnkiConnect that require it not to sleep.
Enables external applications such as Yomichan to communicate with Anki over a simple HTTP API, query card decks, automatically create cards, and supports Anki 2.1.x.
Integrates IvyTutoring's web app with Anki, replacing AnkiConnect with pre-configured, secure, no-setup support for deck/note creation, deck names, syncing, and version checks.
Connects Anki Desktop to dictionary tools, mining apps, and scripts, supporting existing AnkiConnect integrations while adding modern API features like FSRS access, events, scoped keys, and undo.
Extends Anki's stats screen with extra graphs, custom trends, configurable charts, and many review metrics, primarily tested with an FSRS7 Anki fork.
Triggers customizable confetti bursts with optional sound after correctly rating difficult or overdue cards based on FSRS properties and specified conditions.
Anki-Connect enables external applications such as Yomichan to communicate with Anki over a simple HTTP API. Its capabilities include executing queries against the user's card deck, automatically creating new cards, and more. Anki-Connect is compatible with the latest stable (2.1.x) releases of Anki; older versions (2.0.x and below) are no longer supported.
The installation process is similar to other Anki plugins and can be accomplished in three steps:
Install Add-on dialog by selecting Tools | Add-ons | Get Add-ons... in Anki.Code and press the OK button to proceed.Anki must be kept running in the background in order for other applications to be able to use Anki-Connect. You can verify that Anki-Connect is running at any time by accessing localhost:8765 in your browser. If the server is running, you will see the message Anki-Connect displayed in your browser window.
Windows users may see a firewall nag dialog box appear on Anki startup. This occurs because Anki-Connect runs a local HTTP server in order to enable other applications to connect to it. The host application, Anki, must be unblocked for this plugin to function correctly.
Starting with Mac OS X Mavericks, a feature named App Nap has been introduced to the operating system. This feature causes certain applications which are open (but not visible) to be placed in a suspended state. As this behavior causes Anki-Connect to stop working while you have another window in the foreground, App Nap should be disabled for Anki:
defaults write net.ankiweb.dtop NSAppSleepDisabled -bool true
defaults write net.ichi2.anki NSAppSleepDisabled -bool true
defaults write org.qt-project.Qt.QtWebEngineCore NSAppSleepDisabled -bool true
Anki-Connect exposes internal Anki features to external applications via an easy to use API. After being installed, this plugin will start an HTTP server on port 8765 whenever Anki is launched. Other applications (including browser extensions) can then communicate with it via HTTP requests.
By default, Anki-Connect will only bind the HTTP server to the 127.0.0.1 IP address, so that you will only be able to access it from the same host on which it is running. If you need to access it over a network, you can change the binding address in the configuration. Go to Tools->Add-ons->AnkiConnect->Config and change the "webBindAddress" value. For example, you can set it to 0.0.0.0 in order to bind it to all network interfaces on your host. This also requires a restart for Anki.
Every request consists of a JSON-encoded object containing an action, a version, contextual params, and a key
value used for authentication (which is optional and can be omitted by default). Anki-Connect will respond with an
object containing two fields: result and error. The result field contains the return value of the executed API,
and the error field is a description of any exception thrown during API execution (the value null is used if
execution completed successfully).
Sample successful response:
{"result": ["Default", "Filtered Deck 1"], "error": null}
Samples of failed responses:
{"result": null, "error": "unsupported action"}
{"result": null, "error": "guiBrowse() got an unexpected keyword argument 'foobar'"}
For compatibility with clients designed to work with older versions of Anki-Connect, failing to provide a version
field in the request will make the version default to 4. Furthermore, when the provided version is level 4 or below, the
API response will only contain the value of the result; no error field is available for error handling.
You can use whatever language or tool you like to issue request to Anki-Connect, but a couple of simple examples are included below as reference.
curl localhost:8765 -X POST -d '{"action": "deckNames", "version": 6}'
(Invoke-RestMethod -Uri http://localhost:8765 -Method Post -Body '{"action": "deckNames", "version": 6}').result
import json
import urllib.request
def request(action, **params):
return {'action': action, 'params': params, 'version': 6}
def invoke(action, **params):
requestJson = json.dumps(request(action, **params)).encode('utf-8')
response = json.load(urllib.request.urlopen(urllib.request.Request('http://127.0.0.1:8765', requestJson)))
if len(response) != 2:
raise Exception('response has an unexpected number of fields')
if 'error' not in response:
raise Exception('response is missing required error field')
if 'result' not in response:
raise Exception('response is missing required result field')
if response['error'] is not None:
raise Exception(response['error'])
return response['result']
invoke('createDeck', deck='test1')
result = invoke('deckNames')
print('got list of decks: {}'.format(result))
function invoke(action, version, params={}) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.addEventListener('error', () => reject('failed to issue request'));
xhr.addEventListener('load', () => {
try {
const response = JSON.parse(xhr.responseText);
if (Object.getOwnPropertyNames(response).length != 2) {
throw 'response has an unexpected number of fields';
}
if (!response.hasOwnProperty('error')) {
throw 'response is missing required error field';
}
if (!response.hasOwnProperty('result')) {
throw 'response is missing required result field';
}
if (response.error) {
throw response.error;
}
resolve(response.result);
} catch (e) {
reject(e);
}
});
xhr.open('POST', 'http://127.0.0.1:8765');
xhr.send(JSON.stringify({action, version, params}));
});
}
await invoke('createDeck', 6, {deck: 'test1'});
const result = await invoke('deckNames', 6);
console.log(`got list of decks: ${result}`);
Anki-Connect supports requiring authentication in order to make API requests.
This support is disabled by default, but can be enabled by setting the apiKey field of Anki-Config's settings (Tools->Add-ons->AnkiConnect->Config) to a desired string.
If you have done so, you should see the requestPermission API request return true for requireApiKey.
You then must include an additional parameter called key in any further API request bodies, whose value must match the configured API key.
The primary goal for Anki-Connect was to support real-time flash card creation from the Yomichan browser extension. The current API provides all the required actions to make this happen. I recognise that the role of Anki-Connect has evolved from this original vision, and I am happy to review new feature requests.
With that said, this project operates on a self-serve model. If you would like a new feature, create a PR. I'll review it and if it looks good, it will be merged in. Requests to add new features without accompanying pull requests will not be serviced. Make sure that your pull request meets the following criteria:
Documentation for currently supported actions is split up by category and is referenced below. Note that deprecated APIs will continue to function despite not being listed on this page as long as your request is labeled with a version number corresponding to when the API was available for use. Search parameters are passed to Anki, check the docs for more information: https://docs.ankiweb.net/searching.html
getEaseFactorsReturns an array with the ease factor for each of the given cards (in the same order).
<details> <summary><i>Sample request:</i></summary>
{
"action": "getEaseFactors",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [4100, 3900],
"error": null
}
</details>
setEaseFactorsSets ease factor of cards by card ID; returns true if successful (all cards existed) or false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "setEaseFactors",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217],
"easeFactors": [4100, 3900]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [true, true],
"error": null
}
</details>
setSpecificValueOfCardSets specific value of a single card. Given the risk of wreaking havor in the database when changing some of the values of a card, some of the keys require the argument "warning_check" set to True. This can be used to set a card's flag, change it's ease factor, change the review order in a filtered deck and change the column "data" (not currently used by anki apparantly), and many other values. A list of values and explanation of their respective utility can be found at AnkiDroid's wiki.
<details> <summary><i>Sample request:</i></summary>
{
"action": "setSpecificValueOfCard",
"version": 6,
"params": {
"card": 1483959291685,
"keys": ["flags", "odue"],
"newValues": ["1", "-100"]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [true, true],
"error": null
}
</details>
suspendSuspend cards by card ID; returns true if successful (at least one card wasn't already suspended) or false
otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "suspend",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
unsuspendUnsuspend cards by card ID; returns true if successful (at least one card was previously suspended) or false
otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "unsuspend",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
suspendedCheck if card is suspended by its ID. Returns true if suspended, false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "suspended",
"version": 6,
"params": {
"card": 1483959293217
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
areSuspendedReturns an array indicating whether each of the given cards is suspended (in the same order). If card doesn't
exist returns null.
<details> <summary><i>Sample request:</i></summary>
{
"action": "areSuspended",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217, 1234567891234]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [false, true, null],
"error": null
}
</details>
areDueReturns an array indicating whether each of the given cards is due (in the same order). Note: cards in the learning queue with a large interval (over 20 minutes) are treated as not due until the time of their interval has passed, to match the way Anki treats them when reviewing.
<details> <summary><i>Sample request:</i></summary>
{
"action": "areDue",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [false, true],
"error": null
}
</details>
getIntervalsReturns an array of the most recent intervals for each given card ID, or a 2-dimensional array of all the intervals
for each given card ID when complete is true. Negative intervals are in seconds and positive intervals in days.
<details> <summary><i>Sample request 1:</i></summary>
{
"action": "getIntervals",
"version": 6,
"params": {
"cards": [1502298033753, 1502298036657]
}
}
</details>
<details> <summary><i>Sample result 1:</i></summary>
{
"result": [-14400, 3],
"error": null
}
</details>
<details> <summary><i>Sample request 2:</i></summary>
{
"action": "getIntervals",
"version": 6,
"params": {
"cards": [1502298033753, 1502298036657],
"complete": true
}
}
</details>
<details> <summary><i>Sample result 2:</i></summary>
{
"result": [
[-120, -180, -240, -300, -360, -14400],
[-120, -180, -240, -300, -360, -14400, 1, 3]
],
"error": null
}
</details>
findCardsReturns an array of card IDs for a given query. Functionally identical to guiBrowse but doesn't use the GUI for
better performance.
Optional: pass fields to include extra values with each card result. When fields is provided, the result is an
array of objects that always include cardId and the requested fields.
Currently supported field values are: prop:r, prop:s.
<details> <summary><i>Sample request:</i></summary>
{
"action": "findCards",
"version": 6,
"params": {
"query": "deck:current"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [1494723142483, 1494703460437, 1494703479525],
"error": null
}
</details>
<details> <summary><i>Sample request with fields:</i></summary>
{
"action": "findCards",
"version": 6,
"params": {
"query": "deck:current",
"fields": ["prop:r", "prop:s"]
}
}
</details>
<details> <summary><i>Sample result with fields:</i></summary>
{
"result": [
{
"cardId": 1494723142483,
"prop:r": 0.89,
"prop:s": 12.4
},
{
"cardId": 1494703460437,
"prop:r": null,
"prop:s": null
}
],
"error": null
}
</details>
cardsToNotesReturns an unordered array of note IDs for the given card IDs. For cards with the same note, the ID is only given once in the array.
<details> <summary><i>Sample request:</i></summary>
{
"action": "cardsToNotes",
"version": 6,
"params": {
"cards": [1502098034045, 1502098034048, 1502298033753]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [1502098029797, 1502298025183],
"error": null
}
</details>
cardsModTimeReturns a list of objects containings for each card ID the modification time.
This function is about 15 times faster than executing cardsInfo.
<details> <summary><i>Sample request:</i></summary>
{
"action": "cardsModTime",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [
{
"cardId": 1498938915662,
"mod": 1629454092
}
],
"error": null
}
</details>
cardsInfoReturns a list of objects containing for each card ID the card fields, front and back sides including CSS, note type, the note that the card belongs to, and deck name, last modification timestamp as well as ease and interval.
Optional: pass fields to include extra values on each card object. Currently supported field values are:
prop:r, prop:s, prop:d.
Optional: pass noteFields to only include selected note field names in the fields object.
Optional: pass retrieved_info_mode, one of:
ALL (default): full payload.COMPACT: omits heavy rendered fields (question, answer, css, nextReviews).FIELDS_ONLY: returns only cardId, fields, and requested metric fields (prop:*).<details> <summary><i>Sample request:</i></summary>
{
"action": "cardsInfo",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [
{
"answer": "back content",
"question": "front content",
"deckName": "Default",
"modelName": "Basic",
"fieldOrder": 1,
"fields": {
"Front": {"value": "front content", "order": 0},
"Back": {"value": "back content", "order": 1}
},
"css":"p {font-family:Arial;}",
"cardId": 1498938915662,
"interval": 16,
"note":1502298033753,
"ord": 1,
"type": 0,
"queue": 0,
"due": 1,
"reps": 1,
"lapses": 0,
"left": 6,
"mod": 1629454092
},
{
"answer": "back content",
"question": "front content",
"deckName": "Default",
"modelName": "Basic",
"fieldOrder": 0,
"fields": {
"Front": {"value": "front content", "order": 0},
"Back": {"value": "back content", "order": 1}
},
"css":"p {font-family:Arial;}",
"cardId": 1502098034048,
"interval": 23,
"note":1502298033753,
"ord": 1,
"type": 0,
"queue": 0,
"due": 1,
"reps": 1,
"lapses": 0,
"left": 6
}
],
"error": null
}
</details>
<details> <summary><i>Sample request with fields + noteFields + COMPACT mode:</i></summary>
{
"action": "cardsInfo",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048],
"noteFields": ["Front"],
"fields": ["prop:r"],
"retrieved_info_mode": "COMPACT"
}
}
</details>
<details> <summary><i>Sample result with fields + noteFields + COMPACT mode:</i></summary>
{
"result": [
{
"cardId": 1498938915662,
"deckName": "Default",
"note": 1502298033753,
"ord": 1,
"type": 0,
"queue": 0,
"due": 1,
"interval": 16,
"reps": 1,
"lapses": 0,
"mod": 1629454092,
"factor": 2500,
"flags": 0,
"fieldOrder": 1,
"fields": {
"Front": {"value": "front content", "order": 0}
},
"prop:r": 0.89
}
],
"error": null
}
</details>
<details> <summary><i>Sample request with FIELDS_ONLY mode:</i></summary>
{
"action": "cardsInfo",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048],
"noteFields": ["Front"],
"fields": ["prop:r"],
"retrieved_info_mode": "FIELDS_ONLY"
}
}
</details>
<details> <summary><i>Sample result with FIELDS_ONLY mode:</i></summary>
{
"result": [
{
"cardId": 1498938915662,
"fields": {
"Front": {"value": "front content", "order": 0}
},
"prop:r": 0.89
}
],
"error": null
}
</details>
forgetCardsForget cards, making the cards new again.
<details> <summary><i>Sample request:</i></summary>
{
"action": "forgetCards",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
relearnCardsMake cards be "relearning".
<details> <summary><i>Sample request:</i></summary>
{
"action": "relearnCards",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
answerCardsAnswer cards. Ease is between 1 (Again) and 4 (Easy). Will start the timer immediately before answering. Returns true if card exists, false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "answerCards",
"version": 6,
"params": {
"answers": [
{
"cardId": 1498938915662,
"ease": 2
},
{
"cardId": 1502098034048,
"ease": 4
}
]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [true, true],
"error": null
}
</details>
gradeNowGrades cards immediately using the same rating scale as review answers. ease must be between 1 (Again) and 4 (Easy). Returns true when the operation succeeds.
<details> <summary><i>Sample request:</i></summary>
{
"action": "gradeNow",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048],
"ease": 3
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
setDueDateSet Due Date. Turns cards into review cards if they are new, and makes them due on a certain date.
<details> <summary><i>Sample request:</i></summary>
{
"action": "setDueDate",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048],
"days": "3-7"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
repositionNewCardsRepositions eligible new cards using Anki native reposition logic while preserving caller order.
orderedCardIds must be a non-empty list of integers.
Duplicates are removed by card ID only (first occurrence kept).
Cards that do not exist are reported in skippedNotFound.
Cards that exist but are not currently is:new are reported in skippedNotNew.
<details> <summary><i>Sample request:</i></summary>
{
"action": "repositionNewCards",
"version": 6,
"params": {
"orderedCardIds": [175, 311, 800, 311, 901],
"startPosition": 1,
"step": 1,
"shift": true
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": {
"requested": 5,
"deduped": 4,
"eligibleNew": 3,
"repositioned": 3,
"skippedNotFound": [901],
"skippedNotNew": [800],
"appliedStartPosition": 1,
"appliedStep": 1,
"appliedShift": true
},
"error": null
}
</details>
deckNamesGets the complete list of deck names for the current user.
<details> <summary><i>Sample request:</i></summary>
{
"action": "deckNames",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": ["Default"],
"error": null
}
</details>
deckNamesAndIdsGets the complete list of deck names and their respective IDs for the current user.
<details> <summary><i>Sample request:</i></summary>
{
"action": "deckNamesAndIds",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": {"Default": 1},
"error": null
}
</details>
getDecksAccepts an array of card IDs and returns an object with each deck name as a key, and its value an array of the given cards which belong to it.
<details> <summary><i>Sample request:</i></summary>
{
"action": "getDecks",
"version": 6,
"params": {
"cards": [1502298036657, 1502298033753, 1502032366472]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": {
"Default": [1502032366472],
"Japanese::JLPT N3": [1502298036657, 1502298033753]
},
"error": null
}
</details>
createDeckCreate a new empty deck. Will not overwrite a deck that exists with the same name.
<details> <summary><i>Sample request:</i></summary>
{
"action": "createDeck",
"version": 6,
"params": {
"deck": "Japanese::Tokyo"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": 1519323742721,
"error": null
}
</details>
changeDeckMoves cards with the given IDs to a different deck, creating the deck if it doesn't exist yet.
<details> <summary><i>Sample request:</i></summary>
{
"action": "changeDeck",
"version": 6,
"params": {
"cards": [1502098034045, 1502098034048, 1502298033753],
"deck": "Japanese::JLPT N3"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
deleteDecksDeletes decks with the given names.
The argument cardsToo must be specified and set to true.
<details> <summary><i>Sample request:</i></summary>
{
"action": "deleteDecks",
"version": 6,
"params": {
"decks": ["Japanese::JLPT N5", "Easy Spanish"],
"cardsToo": true
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
getDeckConfigGets the configuration group object for the given deck.
<details> <summary><i>Sample request:</i></summary>
{
"action": "getDeckConfig",
"version": 6,
"params": {
"deck": "Default"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": {
"lapse": {
"leechFails": 8,
"delays": [10],
"minInt": 1,
"leechAction": 0,
"mult": 0
},
"dyn": false,
"autoplay": true,
"mod": 1502970872,
"id": 1,
"maxTaken": 60,
"new": {
"bury": true,
"order": 1,
"initialFactor": 2500,
"perDay": 20,
"delays": [1, 10],
"separate": true,
"ints": [1, 4, 7]
},
"name": "Default",
"rev": {
"bury": true,
"ivlFct": 1,
"ease4": 1.3,
"maxIvl": 36500,
"perDay": 100,
"minSpace": 1,
"fuzz": 0.05
},
"timer": 0,
"replayq": true,
"usn": -1
},
"error": null
}
</details>
saveDeckConfigSaves the given configuration group, returning true on success or false if the ID of the configuration group is
invalid (such as when it does not exist).
<details> <summary><i>Sample request:</i></summary>
{
"action": "saveDeckConfig",
"version": 6,
"params": {
"config": {
"lapse": {
"leechFails": 8,
"delays": [10],
"minInt": 1,
"leechAction": 0,
"mult": 0
},
"dyn": false,
"autoplay": true,
"mod": 1502970872,
"id": 1,
"maxTaken": 60,
"new": {
"bury": true,
"order": 1,
"initialFactor": 2500,
"perDay": 20,
"delays": [1, 10],
"separate": true,
"ints": [1, 4, 7]
},
"name": "Default",
"rev": {
"bury": true,
"ivlFct": 1,
"ease4": 1.3,
"maxIvl": 36500,
"perDay": 100,
"minSpace": 1,
"fuzz": 0.05
},
"timer": 0,
"replayq": true,
"usn": -1
}
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
setDeckConfigIdChanges the configuration group for the given decks to the one with the given ID. Returns true on success or
false if the given configuration group or any of the given decks do not exist.
<details> <summary><i>Sample request:</i></summary>
{
"action": "setDeckConfigId",
"version": 6,
"params": {
"decks": ["Default"],
"configId": 1
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
cloneDeckConfigIdCreates a new configuration group with the given name, cloning from the group with the given ID, or from the default
group if this is unspecified. Returns the ID of the new configuration group, or false if the specified group to
clone from does not exist.
<details> <summary><i>Sample request:</i></summary>
{
"action": "cloneDeckConfigId",
"version": 6,
"params": {
"name": "Copy of Default",
"cloneFrom": 1
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": 1502972374573,
"error": null
}
</details>
removeDeckConfigIdRemoves the configuration group with the given ID, returning true if successful, or false if attempting to
remove either the default configuration group (ID = 1) or a configuration group that does not exist.
<details> <summary><i>Sample request:</i></summary>
{
"action": "removeDeckConfigId",
"version": 6,
"params": {
"configId": 1502972374573
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
getDeckStatsGets statistics such as total cards and cards due for the given decks.
<details> <summary><i>Sample request:</i></summary>
{
"action": "getDeckStats",
"version": 6,
"params": {
"decks": ["Japanese::JLPT N5", "Easy Spanish"]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": {
"1651445861967": {
"deck_id": 1651445861967,
"name": "Japanese::JLPT N5",
"new_count": 20,
"learn_count": 0,
"review_count": 0,
"total_in_deck": 1506
},
"1651445861960": {
"deck_id": 1651445861960,
"name": "Easy Spanish",
"new_count": 26,
"learn_count": 10,
"review_count": 5,
"total_in_deck": 852
}
},
"error": null
}
</details>
guiBrowseInvokes the Card Browser dialog and searches for a given query. Returns an array of identifiers of the cards that were found. Query syntax is documented here.
Optionally, the reorderCards property can be provided to reorder the cards shown in the Card Browser.
This is an array including the order and columnId objects. order can be either ascending or descending while columnId can be one of several column identifiers (as documented in the Anki source code).
The specified column needs to be visible in the Card Browser.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiBrowse",
"version": 6,
"params": {
"query": "deck:current",
"reorderCards": {
"order": "descending",
"columnId": "noteCrt"
}
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [1494723142483, 1494703460437, 1494703479525],
"error": null
}
</details>
guiSelectCardFinds the open instance of the Card Browser dialog and selects a card given a card identifier.
Returns true if the Card Browser is open, false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiSelectCard",
"version": 6,
"params": {
"card": 1494723142483
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiSelectedNotesFinds the open instance of the Card Browser dialog and returns an array of identifiers of the notes that are selected. Returns an empty list if the browser is not open.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiSelectedNotes",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": [1494723142483, 1494703460437, 1494703479525],
"error": null
}
</details>
guiAddCardsInvokes the Add Cards dialog, presets the note using the given deck and model, with the provided field values and tags. Invoking it multiple times closes the old window and reopen the window with the new provided values.
Audio, video, and picture files can be embedded into the fields via the audio, video, and picture keys, respectively.
Refer to the documentation of addNote and storeMediaFile for an explanation of these fields.
The result is the ID of the note which would be added, if the user chose to confirm the Add Cards dialogue.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiAddCards",
"version": 6,
"params": {
"note": {
"deckName": "Default",
"modelName": "Cloze",
"fields": {
"Text": "The capital of Romania is {{c1::Bucharest}}",
"Extra": "Romania is a country in Europe"
},
"tags": [
"countries"
],
"picture": [{
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/13/EU-Romania.svg/285px-EU-Romania.svg.png",
"filename": "romania.png",
"fields": [
"Extra"
]
}]
}
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": 1496198395707,
"error": null
}
</details>
guiEditNoteOpens the Edit dialog with a note corresponding to given note ID. The dialog is similar to the Edit Current dialog, but:
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiEditNote",
"version": 6,
"params": {
"note": 1649198355435
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
guiAddNoteSetDataSets fields, tags, deck, and note type (model) in the Add Note dialog. Optionally appends to fields/tags instead of replacing them.
append is true, otherwise replaces.<details> <summary><i>Sample request (replace):</i></summary>
{
"action": "guiAddNoteSetData",
"version": 6,
"params": {
"note": {
"deckName": "Default",
"modelName": "Basic",
"fields": {"Front": "Hello", "Back": "World"},
"tags": ["new", "api"]
}
}
}
</details>
<details> <summary><i>Sample request (append):</i></summary>
{
"action": "guiAddNoteSetData",
"version": 6,
"params": {
"note": {
"fields": {"Front": " more text"},
"tags": ["extra"]
},
"append": true
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiCurrentCardReturns information about the current card or null if not in review mode.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiCurrentCard",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": {
"answer": "back content",
"question": "front content",
"deckName": "Default",
"modelName": "Basic",
"fieldOrder": 0,
"fields": {
"Front": {"value": "front content", "order": 0},
"Back": {"value": "back content", "order": 1}
},
"template": "Forward",
"cardId": 1498938915662,
"buttons": [1, 2, 3],
"nextReviews": ["<1m", "<10m", "4d"]
},
"error": null
}
</details>
guiStartCardTimerStarts or resets the timerStarted value for the current card. This is useful for deferring the start time to when
it is displayed via the API, allowing the recorded time taken to answer the card to be more accurate when calling
guiAnswerCard.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiStartCardTimer",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiShowQuestionShows question text for the current card; returns true if in review mode or false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiShowQuestion",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiShowAnswerShows answer text for the current card; returns true if in review mode or false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiShowAnswer",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiAnswerCardAnswers the current card; returns true if succeeded or false otherwise. Note that the answer for the current
card must be displayed before before any answer can be accepted by Anki.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiAnswerCard",
"version": 6,
"params": {
"ease": 1
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiUndoUndo the last action / card; returns true if succeeded or false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiUndo",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiDeckOverviewOpens the Deck Overview dialog for the deck with the given name; returns true if succeeded or false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiDeckOverview",
"version": 6,
"params": {
"name": "Default"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiDeckBrowserOpens the Deck Browser dialog.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiDeckBrowser",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
guiDeckReviewStarts review for the deck with the given name; returns true if succeeded or false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiDeckReview",
"version": 6,
"params": {
"name": "Default"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiImportFileInvokes the Import... (Ctrl+Shift+I) dialog with an optional file path. Brings up the dialog for user to review the import. Supports all file types that Anki supports. Brings open file dialog if no path is provided. Forward slashes must be used in the path on Windows. Only supported for Anki 2.1.52+.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiImportFile",
"version": 6,
"params": {
"path": "C:/Users/Desktop/cards.txt"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
guiExitAnkiSchedules a request to gracefully close Anki. This operation is asynchronous, so it will return immediately and won't wait until the Anki process actually terminates.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiExitAnki",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
guiCheckDatabaseRequests a database check, but returns immediately without waiting for the check to complete. Therefore, the action will always return true even if errors are detected during the database check.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiCheckDatabase",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
guiPlayAudioPlays any Audio for the current side of the current card; returns true if succeeded or false otherwise.
<details> <summary><i>Sample request:</i></summary>
{
"action": "guiPlayAudio",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
storeMediaFileStores a file with the specified base64-encoded contents inside the media folder. Alternatively you can specify a
absolute file path, or a url from where the file shell be downloaded. If more than one of data, path and url are provided, the data field will be used first, then path, and finally url. To prevent Anki from removing files not used by any cards (e.g. for configuration files), prefix the filename with an underscore. These files are still synchronized to AnkiWeb.
Any existing file with the same name is deleted by default. Set deleteExisting to false to prevent that
by letting Anki give the new file a non-conflicting name.
<details> <summary><i>Sample request (relative path):</i></summary>
{
"action": "storeMediaFile",
"version": 6,
"params": {
"filename": "_hello.txt",
"data": "SGVsbG8sIHdvcmxkIQ=="
}
}
Content of _hello.txt:
Hello world!
</details>
<details> <summary><i>Sample result (relative path):</i></summary>
{
"result": "_hello.txt",
"error": null
}
</details>
<details> <summary><i>Sample request (absolute path):</i></summary>
{
"action": "storeMediaFile",
"version": 6,
"params": {
"filename": "_hello.txt",
"path": "/path/to/file"
}
}
</details>
<details> <summary><i>Sample result (absolute path):</i></summary>
{
"result": "_hello.txt",
"error": null
}
</details>
<details> <summary><i>Sample request (url):</i></summary>
{
"action": "storeMediaFile",
"version": 6,
"params": {
"filename": "_hello.txt",
"url": "https://url.to.file"
}
}
</details>
<details> <summary><i>Sample result (url):</i></summary>
{
"result": "_hello.txt",
"error": null
}
</details>
retrieveMediaFileRetrieves the base64-encoded contents of the specified file, returning false if the file does not exist.
<details> <summary><i>Sample request:</i></summary>
{
"action": "retrieveMediaFile",
"version": 6,
"params": {
"filename": "_hello.txt"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": "SGVsbG8sIHdvcmxkIQ==",
"error": null
}
</details>
getMediaFilesNamesGets the names of media files matched the pattern. Returning all names by default.
<details> <summary><i>Sample request:</i></summary>
{
"action": "getMediaFilesNames",
"version": 6,
"params": {
"pattern": "_hell*.txt"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": ["_hello.txt"],
"error": null
}
</details>
getMediaDirPathGets the full path to the collection.media folder of the currently opened profile.
<details> <summary><i>Sample request:</i></summary>
{
"action": "getMediaDirPath",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": "/home/user/.local/share/Anki2/Main/collection.media",
"error": null
}
</details>
deleteMediaFileDeletes the specified file inside the media folder.
<details> <summary><i>Sample request:</i></summary>
{
"action": "deleteMediaFile",
"version": 6,
"params": {
"filename": "_hello.txt"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
requestPermissionRequests permission to use the API exposed by this plugin. This method does not require the API key, and is the
only one that accepts requests from any origin; the other methods only accept requests from trusted origins,
which are listed under webCorsOriginList in the add-on config. localhost is trusted by default.
Calling this method from an untrusted origin will display a popup in Anki asking the user whether they want to
allow your origin to use the API; calls from trusted origins will return the result without displaying the popup.
When denying permission, the user may also choose to ignore further permission requests from that origin. These
origins end up in the ignoreOriginList, editable via the add-on config.
The result always contains the permission field, which in turn contains either the string granted or denied,
corresponding to whether your origin is trusted. If your origin is trusted, the fields requireApiKey (true if
required) and version will also be returned.
This should be the first call you make to make sure that your application and Anki-Connect are able to communicate properly with each other. New versions of Anki-Connect are backwards compatible; as long as you are using actions which are available in the reported Anki-Connect version or earlier, everything should work fine.
<details> <summary><i>Sample request:</i></summary>
{
"action": "requestPermission",
"version": 6
}
</details>
<details> <summary><i>Sample results:</i></summary>
{
"result": {
"permission": "granted",
"requireApiKey": false,
"version": 6
},
"error": null
}
{
"result": {
"permission": "denied"
},
"error": null
}
</details>
versionGets the version of the API exposed by this plugin. Currently versions 1 through 6 are defined.
<details> <summary><i>Sample request:</i></summary>
{
"action": "version",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": 6,
"error": null
}
</details>
apiReflectGets information about the AnkiConnect APIs available. The request supports the following params:
scopes - An array of scopes to get reflection information about.
The only currently supported value is "actions".actions - Either null or an array of API method names to check for.
If the value is null, the result will list all of the available API actions.
If the value is an array of strings, the result will only contain actions which were in this array.The result will contain a list of which scopes were used and a value for each scope.
For example, the "actions" scope will contain a "actions" property which contains a list of supported action names.
<details> <summary><i>Sample request:</i></summary>
{
"action": "apiReflect",
"version": 6,
"params": {
"scopes": ["actions", "invalidType"],
"actions": ["apiReflect", "invalidMethod"]
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": {
"scopes": ["actions"],
"actions": ["apiReflect"]
},
"error": null
}
</details>
syncSynchronizes the local Anki collections with AnkiWeb.
<details> <summary><i>Sample request:</i></summary>
{
"action": "sync",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": null,
"error": null
}
</details>
getProfilesRetrieve the list of profiles.
<details> <summary><i>Sample request:</i></summary>
{
"action": "getProfiles",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": ["User 1"],
"error": null
}
</details>
getActiveProfileRetrieve the active profile.
<details> <summary><i>Sample request:</i></summary>
{
"action": "getActiveProfile",
"version": 6
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": "User 1",
"error": null
}
</details>
loadProfileSelects the profile specified in request.
<details> <summary><i>Sample request:</i></summary>
{
"action": "loadProfile",
"version": 6,
"params": {
"name": "user1"
}
}
</details>
<details> <summary><i>Sample result:</i></summary>
{
"result": true,
"error": null
}
</details>
multiPerforms multiple actions in one request, returning an array with the response of each action (in the given order).
<details> <summary><i>Sample request:</i></summary>
{
"action": "multi",
"version": 6,
"params": {
"actions": [
{
"action": "deckNames"
},
{
"action": "deckNames",
"version": 6
},
{
"action": "invalidAction",
"params": {"useless": "param"}
},
{
"action": "invalidAction",