2021-12-16 02:01:09 +00:00
# Anki-Connect
2016-05-30 02:59:21 +00:00
2021-12-16 16:51:35 +00:00
Anki-Connect enables external applications such as [Yomichan ](https://foosoft.net/projects/yomichan/ ) to communicate
with [Anki ](https://apps.ankiweb.net/ ) 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.
2016-05-30 02:59:21 +00:00
2020-04-22 01:22:10 +00:00
## Installation
2016-05-30 02:59:21 +00:00
2020-05-25 00:50:48 +00:00
The installation process is similar to other Anki plugins and can be accomplished in three steps:
2017-03-15 04:10:45 +00:00
2020-09-05 20:31:50 +00:00
1. Open the `Install Add-on` dialog by selecting `Tools` | `Add-ons` | `Get Add-ons...` in Anki.
2019-04-28 23:02:02 +00:00
2. Input [2055492159 ](https://ankiweb.net/shared/info/2055492159 ) into the text box labeled `Code` and press the `OK` button to proceed.
2021-12-16 16:51:35 +00:00
3. Restart Anki when prompted to do so in order to complete the installation of Anki-Connect.
2017-03-15 04:10:45 +00:00
2021-12-16 16:51:35 +00:00
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.
2016-07-03 02:46:01 +00:00
2020-04-22 01:22:10 +00:00
### Notes for Windows Users
2017-01-28 20:20:38 +00:00
2021-12-16 16:51:35 +00:00
Windows users may see a firewall nag dialog box appear on Anki startup. This occurs because Anki-Connect runs a local
2020-05-25 00:50:48 +00:00
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.
2017-01-28 20:20:38 +00:00
2021-12-16 02:01:09 +00:00
### Notes for MacOS Users
2017-01-28 20:20:38 +00:00
2017-02-12 00:41:02 +00:00
Starting with [Mac OS X Mavericks ](https://en.wikipedia.org/wiki/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
2021-12-16 16:51:35 +00:00
placed in a suspended state. As this behavior causes Anki-Connect to stop working while you have another window in the
2017-02-12 00:41:02 +00:00
foreground, App Nap should be disabled for Anki:
1. Start the Terminal application.
2018-09-16 03:21:03 +00:00
2. Execute the following commands in the terminal window:
2021-06-09 03:42:38 +00:00
```bash
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
```
2017-02-12 00:41:02 +00:00
3. Restart Anki.
2020-04-22 01:22:10 +00:00
## Application Interface for Developers
2017-02-01 17:23:09 +00:00
2021-12-16 16:51:35 +00:00
Anki-Connect exposes internal Anki features to external applications via an easy to use API. After being installed, this
2021-07-16 06:08:39 +00:00
plugin will start an HTTP server on port 8765 whenever Anki is launched. Other applications (including browser
2020-05-25 00:50:48 +00:00
extensions) can then communicate with it via HTTP requests.
2017-02-01 17:23:09 +00:00
2021-12-16 16:51:35 +00:00
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
2023-02-18 20:08:11 +00:00
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.
2017-08-28 20:15:42 +00:00
2020-04-22 01:22:10 +00:00
### Sample Invocation
2017-02-01 17:23:09 +00:00
2020-01-06 03:01:11 +00:00
Every request consists of a JSON-encoded object containing an `action` , a `version` , contextual `params` , and a `key`
2021-12-16 16:51:35 +00:00
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).
2019-02-03 16:48:57 +00:00
*Sample successful response*:
```json
{"result": ["Default", "Filtered Deck 1"], "error": null}
```
*Samples of failed responses*:
```json
{"result": null, "error": "unsupported action"}
```
```json
{"result": null, "error": "guiBrowse() got an unexpected keyword argument 'foobar'"}
```
2021-12-16 16:51:35 +00:00
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.
2019-02-03 16:48:57 +00:00
2021-12-16 16:51:35 +00:00
You can use whatever language or tool you like to issue request to Anki-Connect, but a couple of simple examples are
2019-02-03 16:48:57 +00:00
included below as reference.
2020-04-22 01:22:10 +00:00
#### Curl
2019-02-03 16:48:57 +00:00
```bash
2021-09-26 17:41:04 +00:00
curl localhost:8765 -X POST -d '{"action": "deckNames", "version": 6}'
2019-02-03 16:48:57 +00:00
```
2022-07-25 04:49:55 +00:00
#### Powershell
```powershell
(Invoke-RestMethod -Uri http://localhost:8765 -Method Post -Body '{"action": "deckNames", "version": 6}').result
```
2020-04-22 01:22:10 +00:00
#### Python
2019-02-03 16:48:57 +00:00
```python
import json
2019-09-22 10:28:25 +00:00
import urllib.request
2019-02-03 16:48:57 +00:00
def request(action, **params):
return {'action': action, 'params': params, 'version': 6}
def invoke(action, **params):
2019-09-22 10:28:25 +00:00
requestJson = json.dumps(request(action, **params)).encode('utf-8')
2023-06-15 01:14:50 +00:00
response = json.load(urllib.request.urlopen(urllib.request.Request('http://127.0.0.1:8765', requestJson)))
2019-02-03 16:48:57 +00:00
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))
```
2020-04-22 01:22:10 +00:00
#### JavaScript
2017-02-01 17:23:09 +00:00
2017-09-30 00:03:48 +00:00
```javascript
2019-02-03 16:48:57 +00:00
function invoke(action, version, params={}) {
2017-02-03 04:14:24 +00:00
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
2019-02-03 16:48:57 +00:00
xhr.addEventListener('error', () => reject('failed to issue request'));
2017-09-10 05:28:09 +00:00
xhr.addEventListener('load', () => {
try {
const response = JSON.parse(xhr.responseText);
2019-02-03 16:48:57 +00:00
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';
}
2017-09-10 05:28:09 +00:00
if (response.error) {
throw response.error;
}
2019-02-03 16:48:57 +00:00
resolve(response.result);
2017-09-10 05:28:09 +00:00
} catch (e) {
reject(e);
2017-02-03 04:14:24 +00:00
}
});
xhr.open('POST', 'http://127.0.0.1:8765');
2017-08-31 04:26:28 +00:00
xhr.send(JSON.stringify({action, version, params}));
2017-02-03 04:14:24 +00:00
});
}
2017-02-01 17:23:09 +00:00
2021-05-06 05:31:26 +00:00
await invoke('createDeck', 6, {deck: 'test1'});
2019-02-03 16:48:57 +00:00
const result = await invoke('deckNames', 6);
console.log(`got list of decks: ${result}`);
2017-05-06 12:39:38 +00:00
```
2023-09-24 16:39:52 +00:00
### Authentication
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` ](#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.
2021-07-14 00:58:27 +00:00
### Hey, could you add a new action to support $FEATURE?
2021-12-16 16:51:35 +00:00
The primary goal for Anki-Connect was to support real-time flash card creation from the
2021-07-14 00:58:27 +00:00
[Yomichan ](https://foosoft.net/projects/yomichan/ ) browser extension. The current API provides all the required actions
2021-12-16 16:51:35 +00:00
to make this happen. I recognise that the role of Anki-Connect has evolved from this original vision, and I am happy to
2021-07-14 00:58:27 +00:00
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
2021-12-16 02:01:09 +00:00
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:
2021-07-14 00:58:27 +00:00
* Attempt to match style of the surrounding code.
* Have accompanying documentation with examples.
* Have accompanying tests that verify operation.
* Implement features useful in other applications.
2023-01-14 05:39:22 +00:00
## Supported Actions
2017-08-22 08:43:37 +00:00
2020-05-25 00:23:37 +00:00
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
2020-05-25 00:50:48 +00:00
corresponding to when the API was available for use.
2023-10-08 13:57:08 +00:00
Search parameters are passed to Anki, check the docs for more information: https://docs.ankiweb.net/searching.html
2020-05-25 00:23:37 +00:00
2021-06-09 03:42:38 +00:00
* [Card Actions ](#card-actions )
* [Deck Actions ](#deck-actions )
* [Graphical Actions ](#graphical-actions )
* [Media Actions ](#media-actions )
* [Miscellaneous Actions ](#miscellaneous-actions )
* [Model Actions ](#model-actions )
* [Note Actions ](#note-actions )
* [Statistic Actions ](#statistic-actions )
2023-01-14 05:39:22 +00:00
---
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
### Card Actions
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `getEaseFactors`
* Returns an array with the ease factor for each of the given cards (in the same order).
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "getEaseFactors",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [4100, 3900],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
#### `setEaseFactors`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Sets ease factor of cards by card ID; returns `true` if successful (all cards existed) or `false` otherwise.
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "setEaseFactors",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217],
"easeFactors": [4100, 3900]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [true, true],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2022-02-23 02:31:43 +00:00
2023-01-14 05:39:22 +00:00
#### `setSpecificValueOfCard`
2022-02-23 02:31:43 +00:00
2023-01-14 05:39:22 +00:00
* Sets 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.
2022-02-23 02:31:43 +00:00
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 ](https://github.com/ankidroid/Anki-Android/wiki/Database-Structure ).
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2022-02-23 02:31:43 +00:00
```json
{
"action": "setSpecificValueOfCard",
"version": 6,
"params": {
"card": 1483959291685,
"keys": ["flags", "odue"],
"newValues": ["1", "-100"]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2022-02-23 02:31:43 +00:00
```json
{
"result": [true, true],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2022-02-23 02:31:43 +00:00
2023-01-14 05:39:22 +00:00
#### `suspend`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Suspend cards by card ID; returns `true` if successful (at least one card wasn't already suspended) or `false`
2021-06-09 03:42:38 +00:00
otherwise.
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "suspend",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": true,
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `unsuspend`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Unsuspend cards by card ID; returns `true` if successful (at least one card was previously suspended) or `false`
2021-06-09 03:42:38 +00:00
otherwise.
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "unsuspend",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": true,
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `suspended`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Check if card is suspended by its ID. Returns `true` if suspended, `false` otherwise.
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "suspended",
"version": 6,
"params": {
"card": 1483959293217
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": true,
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `areSuspended`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Returns an array indicating whether each of the given cards is suspended (in the same order). If card doesn't
2021-06-09 03:42:38 +00:00
exist returns `null` .
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "areSuspended",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217, 1234567891234]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [false, true, null],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `areDue`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Returns an array indicating whether each of the given cards is due (in the same order). *Note* : cards in the
2021-06-09 03:42:38 +00:00
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.
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "areDue",
"version": 6,
"params": {
"cards": [1483959291685, 1483959293217]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [false, true],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `getIntervals`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Returns an array of the most recent intervals for each given card ID, or a 2-dimensional array of all the intervals
2021-06-09 03:42:38 +00:00
for each given card ID when `complete` is `true` . Negative intervals are in seconds and positive intervals in days.
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request 1:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "getIntervals",
"version": 6,
"params": {
"cards": [1502298033753, 1502298036657]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result 1:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [-14400, 3],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample request 2:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "getIntervals",
"version": 6,
"params": {
"cards": [1502298033753, 1502298036657],
"complete": true
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result 2:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [
[-120, -180, -240, -300, -360, -14400],
[-120, -180, -240, -300, -360, -14400, 1, 3]
],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `findCards`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Returns an array of card IDs for a given query. Functionally identical to `guiBrowse` but doesn't use the GUI for
2021-06-09 03:42:38 +00:00
better performance.
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "findCards",
"version": 6,
"params": {
"query": "deck:current"
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [1494723142483, 1494703460437, 1494703479525],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `cardsToNotes`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Returns an unordered array of note IDs for the given card IDs. For cards with the same note, the ID is only given
2021-06-09 03:42:38 +00:00
once in the array.
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "cardsToNotes",
"version": 6,
"params": {
"cards": [1502098034045, 1502098034048, 1502298033753]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": [1502098029797, 1502298025183],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `cardsModTime`
2021-08-25 03:55:23 +00:00
2023-01-14 05:39:22 +00:00
* Returns a list of objects containings for each card ID the modification time.
2021-08-25 03:55:23 +00:00
This function is about 15 times faster than executing `cardsInfo` .
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-08-25 03:55:23 +00:00
```json
{
"action": "cardsModTime",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-08-25 03:55:23 +00:00
```json
{
"result": [
{
"cardId": 1498938915662,
"mod": 1629454092
}
],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-08-25 03:55:23 +00:00
2023-01-14 05:39:22 +00:00
#### `cardsInfo`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Returns a list of objects containing for each card ID the card fields, front and back sides including CSS, note
2021-08-25 03:55:23 +00:00
type, the note that the card belongs to, and deck name, last modification timestamp as well as ease and interval.
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "cardsInfo",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"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,
2021-08-25 03:55:23 +00:00
"left": 6,
"mod": 1629454092
2021-06-09 03:42:38 +00:00
},
{
"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
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `forgetCards`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Forget cards, making the cards new again.
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "forgetCards",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": null,
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `relearnCards`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Make cards be "relearning".
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "relearnCards",
"version": 6,
"params": {
"cards": [1498938915662, 1502098034048]
}
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": null,
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2023-06-11 21:57:08 +00:00
#### `answerCards`
2023-06-15 11:49:02 +00:00
* Answer cards. Ease is between 1 (Again) and 4 (Easy). Will start the timer immediately before answering. Returns `true` if card exists, `false` otherwise.
2023-06-11 21:57:08 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
```json
{
"action": "answerCards",
"version": 6,
"params": {
2023-06-15 11:49:02 +00:00
"answers": [
{
"cardId": 1498938915662,
"ease": 2
},
{
"cardId": 1502098034048,
"ease": 4
}
]
2023-06-11 21:57:08 +00:00
}
}
```
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
```json
{
"result": [true, true],
"error": null
}
```
< / details >
2023-01-14 05:39:22 +00:00
---
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
### Deck Actions
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `deckNames`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Gets the complete list of deck names for the current user.
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
< details >
< summary > < i > Sample request:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"action": "deckNames",
"version": 6
}
```
2023-01-14 05:39:22 +00:00
< / details >
< details >
< summary > < i > Sample result:< / i > < / summary >
2021-06-09 03:42:38 +00:00
```json
{
"result": ["Default"],
"error": null
}
```
2023-01-14 05:39:22 +00:00
< / details >
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
#### `deckNamesAndIds`
2021-06-09 03:42:38 +00:00
2023-01-14 05:39:22 +00:00
* Gets the complete list of deck names and their respective IDs for the current user.
2021-06-09 03:42:38 +00:00