cards.setFlags
cards_setFlagsSet or clear the user flag on specified Anki cards by card ID; passing 0 clears the flag while preserving other backend flag bits.
Instructions
Set the user flag through Anki native flag persistence.
Zero clears the user flag; preserve other backend flag bits.
Anki-Connect method cards.setFlags. Scope: collection. Effect: write. Completion: completed. Undo: perItem.
Possible errors: collectionUnavailable, editorConflict, internalError, invalidParams, notFound, staleSession.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"ids": "<ids>",
"flag": "<flag>"
},
"name": "cards_setFlags"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | Card IDs (decimal string, e.g. "1700000000001"). | |
| flag | Yes | Flag: 0 none, 1 red, 2 orange, 3 green, 4 blue, 5 pink, 6 turquoise, 7 purple. | |
| session | No | Optional. Collection session ID: the `session` field returned by `collection_get`. Usually omit it — the server then uses the session current at the time of the call. Pass it to make the call fail with `staleSession` instead of acting on a different profile/collection than the one your IDs, cursors and tokens came from. |