{
  "openapi": "3.1.0",
  "info": {
    "title": "Rahunok Free Keyboard Layout Switcher & KMU #55 Transliteration API",
    "version": "1.0.0",
    "description": "Free, zero-auth stateless API to convert mistyped keyboard layouts (EN <-> UA/RU), preserve IBAN/invoice codes, repair mixed-script PDF homoglyphs, and transliterate Ukrainian names via KMU #55.",
    "contact": {
      "name": "Rahunok",
      "url": "https://rahunok.com/instrumenty/zmina-rozkladky/",
      "email": "rahunok@rahunok.com"
    }
  },
  "servers": [
    {
      "url": "https://rahunok.com"
    }
  ],
  "paths": {
    "/api/keyboard": {
      "get": {
        "operationId": "convertKeyboardLayoutGet",
        "summary": "Convert mistyped keyboard layout text (EN <-> UA/RU), clean homoglyphs, or transliterate KMU #55",
        "parameters": [
          {
            "name": "text",
            "in": "query",
            "required": false,
            "description": "Mistyped or source text to convert (omit to receive API guide).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "en_to_uk",
                "uk_to_en",
                "en_to_ru",
                "ru_to_en",
                "translit_kmu55",
                "fix_homoglyphs_uk",
                "fix_homoglyphs_en"
              ],
              "default": "auto"
            }
          },
          {
            "name": "preserve_tokens",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "case_op",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "upper",
                "lower",
                "title",
                "sentence",
                "invert",
                "clean_spaces"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Converted output and diagnostics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "is_free": {
                      "type": "boolean"
                    },
                    "input": {
                      "type": "string"
                    },
                    "output": {
                      "type": "string"
                    },
                    "requested_mode": {
                      "type": "string"
                    },
                    "detected_mode": {
                      "type": "string"
                    },
                    "changed_chars": {
                      "type": "integer"
                    },
                    "preserved_tokens_count": {
                      "type": "integer"
                    },
                    "mixed_homoglyphs_found": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "convertKeyboardLayoutPost",
        "summary": "Convert multi-line text between keyboard layouts or transliterate KMU #55 via JSON body",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Source text to convert or clean"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "en_to_uk",
                      "uk_to_en",
                      "en_to_ru",
                      "ru_to_en",
                      "translit_kmu55",
                      "fix_homoglyphs_uk",
                      "fix_homoglyphs_en"
                    ],
                    "default": "auto"
                  },
                  "preserve_tokens": {
                    "type": "boolean",
                    "default": true
                  },
                  "hint_lang": {
                    "type": "string",
                    "enum": [
                      "uk",
                      "en",
                      "pl",
                      "ru"
                    ],
                    "default": "uk"
                  },
                  "case_op": {
                    "type": "string",
                    "enum": [
                      "upper",
                      "lower",
                      "title",
                      "sentence",
                      "invert",
                      "clean_spaces"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Converted output and diagnostics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "is_free": {
                      "type": "boolean"
                    },
                    "input": {
                      "type": "string"
                    },
                    "output": {
                      "type": "string"
                    },
                    "requested_mode": {
                      "type": "string"
                    },
                    "detected_mode": {
                      "type": "string"
                    },
                    "changed_chars": {
                      "type": "integer"
                    },
                    "preserved_tokens_count": {
                      "type": "integer"
                    },
                    "mixed_homoglyphs_found": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing text input"
          }
        }
      }
    }
  }
}