{
  "openapi": "3.1.1",
  "info": {
    "title": "Flashcard Format Converter API",
    "version": "1.0.0",
    "summary": "Convert flashcards between Anki text, CSV, Quizlet, Mochi, Obsidian and Lessonleaf.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://flashcardformatconverter.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Convert flashcards between Anki text, CSV, Quizlet, Mochi, Obsidian and Lessonleaf.",
        "description": "Converts flashcards between six text formats: the card syntax of Deckwright and Lessonleaf (Q:/A:, term :: definition, cloze), CSV, Anki “Notes in Plain Text” with note types and tags, Quizlet import text, Mochi Markdown and the Obsidian Spaced Repetition plugin syntax. Two-way cards, cloze gaps with hints and tags are carried over where the target can hold them; everything a format cannot hold is listed. The result is read back to check it.\n\nMethodology:\n- Every format is read into one note model (basic, two-way or cloze; question, answer, tags). The shared syntax is read with the same parser as Deckwright’s Study view (cards.ts), CSV with RFC 4180 rules, Anki text with its file headers (#separator, #html, #notetype column, #tags column, #deck column) and HTML turned into text.\n- Obsidian Spaced Repetition: tag lines such as #flashcards/deck set the deck of the cards below; front::back, front:::back (two-way), multi-line cards with a ? or ?? line, ==cloze== deletions (with ^[hint] and [^n] groups); \u003c!--SR:…--\u003e scheduling comments are ignored. Mochi: sides split at a --- line, cards at the delimiter line; {{1::…}} groups and {{…}} deletions. Quizlet: one card per line, term and definition split at a tab (or comma, or \" - \").\n- Cloze gaps are kept as {{cN::answer::hint}} internally; Obsidian gets ==answer== (classic ==answer==[^N] when gaps share a number), Mochi {{N::answer}}, Quizlet one line per gap (sentence with […] → hidden text).\n- Check: the output is parsed again with the target format’s reader; “verified” means it gives back the expected number of notes (Quizlet and Mochi count the cards they split into).\n\nText formats only: Anki .apkg packages, Mochi .mochi archives and pictures are not read or written, and review history is not converted. Card formatting beyond bold, italics and line breaks may change.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "flashcard_format_converter",
        "x-owner-app": "lessonleaf",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlashcardFormatConverterInput"
              },
              "examples": {
                "example1": {
                  "summary": "Shared card syntax to Anki (note types and tags)",
                  "value": {
                    "text": "# Spanish\nhola :: hello\ngracias ::: thank you\nQ: How do you say \"good morning\"?\nA: buenos días\n\n# Biology\nThe {{c1::nucleus}} stores the {{c2::DNA::molecule}}.\n",
                    "to": "anki"
                  }
                },
                "example2": {
                  "summary": "Obsidian Spaced Repetition to Quizlet",
                  "value": {
                    "text": "#flashcards/geography\nCapital of France::Paris\nLargest ocean:::Pacific\n\nThe ==Danube== flows into the ==Black Sea==.\n\u003c!--SR:!2026-12-20,4,270--\u003e\n",
                    "from": "obsidian",
                    "to": "quizlet"
                  }
                },
                "example3": {
                  "summary": "Quizlet export to Mochi",
                  "value": {
                    "text": "perro\tdog\ngato\tcat\ncaballo\thorse\n",
                    "from": "quizlet",
                    "to": "mochi"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlashcardFormatConverterResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "FlashcardFormatConverterInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "text": {
            "title": "Cards",
            "type": "string",
            "maxLength": 1000000,
            "default": "# Spanish\nhola :: hello\ngracias ::: thank you\nQ: How do you say \"good morning\"?\nA: buenos días\n\n# Biology\nThe {{c1::nucleus}} stores the {{c2::DNA::molecule}}.\n"
          },
          "from": {
            "title": "From",
            "type": "string",
            "enum": [
              "auto",
              "markdown",
              "csv",
              "anki",
              "obsidian",
              "quizlet",
              "mochi"
            ],
            "default": "auto"
          },
          "to": {
            "title": "To",
            "type": "string",
            "enum": [
              "markdown",
              "csv",
              "anki",
              "obsidian",
              "quizlet",
              "mochi"
            ],
            "default": "anki"
          },
          "deckTag": {
            "title": "Obsidian deck tag",
            "description": "The plugin’s flashcard tag (without #); tags become sub-decks like #flashcards/Spanish.",
            "type": "string",
            "maxLength": 40,
            "default": "flashcards"
          },
          "mochiDelimiter": {
            "title": "Mochi card delimiter",
            "description": "The line between cards; choose the same delimiter in Mochi’s Markdown import.",
            "type": "string",
            "maxLength": 20,
            "default": "==="
          }
        },
        "required": []
      },
      "FlashcardFormatConverterResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "from",
              "to",
              "notes",
              "kinds",
              "tags",
              "cardsIn",
              "cardsOut",
              "text",
              "verified",
              "readBack",
              "warnings",
              "lost",
              "file",
              "openInApp"
            ],
            "properties": {
              "from": {
                "enum": [
                  "markdown",
                  "csv",
                  "anki",
                  "obsidian",
                  "quizlet",
                  "mochi"
                ]
              },
              "to": {
                "enum": [
                  "markdown",
                  "csv",
                  "anki",
                  "obsidian",
                  "quizlet",
                  "mochi"
                ]
              },
              "notes": {
                "type": "integer"
              },
              "cardsIn": {
                "type": "integer"
              },
              "cardsOut": {
                "type": "integer"
              },
              "text": {
                "type": "string"
              },
              "kinds": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "basic",
                  "both",
                  "cloze"
                ],
                "properties": {
                  "basic": {
                    "type": "integer"
                  },
                  "both": {
                    "type": "integer"
                  },
                  "cloze": {
                    "type": "integer"
                  }
                }
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "verified": {
                "type": "boolean",
                "description": "The output was read back with the target format’s reader and gave the expected number of notes."
              },
              "readBack": {
                "type": "integer"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "lost": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "file": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "artifactId",
                      "filename",
                      "mime",
                      "bytes",
                      "sha256",
                      "path"
                    ],
                    "properties": {
                      "artifactId": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string",
                        "description": "Download path on the same site (valid for about 2 hours)."
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "openInApp": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}