{
  "openapi": "3.1.1",
  "info": {
    "title": "Keyboard Heatmap Visualizer API",
    "version": "1.0.0",
    "summary": "Paste any text: see which keys and fingers do the work on QWERTY, Dvorak, Colemak & co.",
    "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://keyboardheatmapvisualizer.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Paste any text: see which keys and fingers do the work on QWERTY, Dvorak, Colemak & co.",
        "description": "Paste text and see a key-frequency heatmap on a QWERTY, QWERTZ, AZERTY, Dvorak or Colemak keyboard, plus finger and hand load, row usage, same-finger bigrams and hand alternation — and a table comparing how the same text would feel on each layout.\n\nMethodology:\n- Every character is looked up on the layout (unshifted, Shift or AltGr level). Characters not on the layout are decomposed when possible (é → e) and counted as approximated; the rest (e.g. emoji) are counted as unmapped and skipped. Line breaks and tabs are skipped.\n- Fingers follow standard touch typing on a row-staggered keyboard: left pinky for 1/Q/A/Z (and the ISO key left of Z), ring for 2/W/S/X, middle for 3/E/D/C, index for 4–5/R–T/F–G/V–B; mirrored on the right, with the right pinky also covering the keys beyond P/;//. The space bar counts for the thumbs.\n- Same-finger bigram = two consecutive characters typed with the same finger on different keys (a key repeated, like “ll”, is not counted). Hand alternation = share of consecutive characters typed by different hands. Both exclude spaces, and a space resets the sequence.\n- Home-row share is calculated without spaces. Shift and AltGr presses are counted as extra key presses but not attributed to a finger.\n- The heatmap colour uses the square root of the count so that rarer keys stay visible.\n\nA simplified model of typing effort: real comfort also depends on rolls, lateral stretches, keyboard geometry and habits.",
        "tags": [
          "fun"
        ],
        "x-mcp-tool": "keyboard_heatmap_visualizer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyboardHeatmapVisualizerInput"
              },
              "examples": {
                "example1": {
                  "summary": "English pangrams on QWERTY vs the rest",
                  "value": {
                    "text": "The quick brown fox jumps over the lazy dog. Pack my box with five dozen liquor jugs! How vexingly quick daft zebras jump; sphinx of black quartz, judge my vow.",
                    "layout": "qwerty",
                    "compare": [
                      "qwerty",
                      "dvorak",
                      "colemak"
                    ]
                  }
                },
                "example2": {
                  "summary": "German text on QWERTZ",
                  "value": {
                    "text": "Zwölf Boxkämpfer jagen Viktor quer über den großen Sylter Deich. Falsches Üben von Xylophonmusik quält jeden größeren Zwerg.",
                    "layout": "qwertz",
                    "compare": [
                      "qwertz",
                      "qwerty",
                      "colemak"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyboardHeatmapVisualizerResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "KeyboardHeatmapVisualizerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "text": {
            "title": "Text",
            "type": "string",
            "maxLength": 100000
          },
          "layout": {
            "title": "Layout for the heatmap",
            "type": "string",
            "enum": [
              "qwerty",
              "qwertz",
              "azerty",
              "dvorak",
              "colemak"
            ],
            "default": "qwerty"
          },
          "compare": {
            "title": "Compare with",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "qwerty",
                "qwertz",
                "azerty",
                "dvorak",
                "colemak"
              ]
            },
            "default": [
              "qwerty",
              "qwertz",
              "azerty",
              "dvorak",
              "colemak"
            ]
          }
        },
        "required": [
          "text"
        ]
      },
      "KeyboardHeatmapVisualizerResult": {
        "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": [
              "characters",
              "layout",
              "topKeys",
              "comparison",
              "bestForHomeRow",
              "bestForSameFinger"
            ],
            "properties": {
              "characters": {
                "type": "integer"
              },
              "layout": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "layout",
                  "name",
                  "keystrokes",
                  "typed",
                  "unmapped",
                  "approximated",
                  "rows",
                  "fingers",
                  "leftHand",
                  "rightHand",
                  "homeRow",
                  "sameFingerBigrams",
                  "handAlternation",
                  "modifierPresses"
                ],
                "properties": {
                  "layout": {
                    "type": "string",
                    "enum": [
                      "qwerty",
                      "qwertz",
                      "azerty",
                      "dvorak",
                      "colemak"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "keystrokes": {
                    "type": "integer",
                    "description": "Key presses including Shift/AltGr."
                  },
                  "typed": {
                    "type": "integer",
                    "description": "Characters typed (excluding modifier presses)."
                  },
                  "unmapped": {
                    "type": "integer"
                  },
                  "approximated": {
                    "type": "integer"
                  },
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "% of characters per row: number, top, home, bottom, space."
                  },
                  "fingers": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "% per finger: L-pinky, L-ring, L-middle, L-index, R-index, R-middle, R-ring, R-pinky, Thumbs."
                  },
                  "leftHand": {
                    "type": "number"
                  },
                  "rightHand": {
                    "type": "number"
                  },
                  "homeRow": {
                    "type": "number",
                    "description": "% of non-space characters typed on the home row."
                  },
                  "sameFingerBigrams": {
                    "type": "number"
                  },
                  "handAlternation": {
                    "type": "number"
                  },
                  "modifierPresses": {
                    "type": "integer"
                  }
                }
              },
              "topKeys": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "key",
                    "count",
                    "percent"
                  ],
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "percent": {
                      "type": "number"
                    }
                  }
                }
              },
              "comparison": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "layout",
                    "name",
                    "keystrokes",
                    "typed",
                    "unmapped",
                    "approximated",
                    "rows",
                    "fingers",
                    "leftHand",
                    "rightHand",
                    "homeRow",
                    "sameFingerBigrams",
                    "handAlternation",
                    "modifierPresses"
                  ],
                  "properties": {
                    "layout": {
                      "type": "string",
                      "enum": [
                        "qwerty",
                        "qwertz",
                        "azerty",
                        "dvorak",
                        "colemak"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "keystrokes": {
                      "type": "integer",
                      "description": "Key presses including Shift/AltGr."
                    },
                    "typed": {
                      "type": "integer",
                      "description": "Characters typed (excluding modifier presses)."
                    },
                    "unmapped": {
                      "type": "integer"
                    },
                    "approximated": {
                      "type": "integer"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      },
                      "description": "% of characters per row: number, top, home, bottom, space."
                    },
                    "fingers": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      },
                      "description": "% per finger: L-pinky, L-ring, L-middle, L-index, R-index, R-middle, R-ring, R-pinky, Thumbs."
                    },
                    "leftHand": {
                      "type": "number"
                    },
                    "rightHand": {
                      "type": "number"
                    },
                    "homeRow": {
                      "type": "number",
                      "description": "% of non-space characters typed on the home row."
                    },
                    "sameFingerBigrams": {
                      "type": "number"
                    },
                    "handAlternation": {
                      "type": "number"
                    },
                    "modifierPresses": {
                      "type": "integer"
                    }
                  }
                }
              },
              "bestForHomeRow": {
                "type": "string"
              },
              "bestForSameFinger": {
                "type": "string"
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}