{
  "openapi": "3.0.3",
  "info": {
    "title": "HLPlanet Keyboard API",
    "version": "1.0.0",
    "description": "Keyboard size data from HLPlanet: standard layouts from full-size to 60%, measured case sizes of 30 keyboards, comparisons, desk and mousepad fit, and which sizes have a key. Free, no API key. Please credit HLPlanet (https://www.hlplanet.com/keyboard-layout/) when you publish the numbers.",
    "contact": {
      "name": "HLPlanet",
      "url": "https://www.hlplanet.com/"
    },
    "license": {
      "name": "MIT",
      "url": "https://github.com/hlplanet/hlplanet-keyboard-api/blob/main/LICENSE"
    }
  },
  "externalDocs": {
    "description": "Documentation",
    "url": "https://api.hlplanet.com/"
  },
  "servers": [
    {
      "url": "https://api.hlplanet.com/v1"
    }
  ],
  "tags": [
    {
      "name": "Sizes"
    },
    {
      "name": "Keyboards"
    },
    {
      "name": "Tools"
    }
  ],
  "paths": {
    "/sizes": {
      "get": {
        "tags": [
          "Sizes"
        ],
        "operationId": "listSizes",
        "summary": "List keyboard sizes",
        "description": "Every standard size with key count, typical dimensions, missing keys and example reviews.",
        "responses": {
          "200": {
            "description": "The six standard sizes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/sizes/{id}": {
      "get": {
        "tags": [
          "Sizes"
        ],
        "operationId": "getSize",
        "summary": "Get one keyboard size",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Size id: full, 1800, tkl, 75, 65 or 60",
            "schema": {
              "type": "string",
              "example": "75"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One size",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/keyboards": {
      "get": {
        "tags": [
          "Keyboards"
        ],
        "operationId": "listKeyboards",
        "summary": "List measured keyboards",
        "parameters": [
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Only keyboards of this size",
            "schema": {
              "type": "string",
              "example": "75"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Every word must appear in the name",
            "schema": {
              "type": "string"
            },
            "example": "nuphy"
          }
        ],
        "responses": {
          "200": {
            "description": "Measured keyboards",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/keyboards/{id}": {
      "get": {
        "tags": [
          "Keyboards"
        ],
        "operationId": "getKeyboard",
        "summary": "Get one measured keyboard",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Keyboard id from the list, e.g. wooting-80he",
            "schema": {
              "type": "string",
              "example": "wooting-80he"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One keyboard with its HLPlanet review link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/compare": {
      "get": {
        "tags": [
          "Keyboards"
        ],
        "operationId": "compareKeyboards",
        "summary": "Compare sizes or keyboards",
        "parameters": [
          {
            "name": "items",
            "in": "query",
            "required": true,
            "description": "2 to 6 comma-separated size ids or keyboard ids; the first is the reference",
            "schema": {
              "type": "string"
            },
            "example": "tkl,75"
          },
          {
            "name": "iso",
            "in": "query",
            "required": false,
            "description": "Use the ISO layout (UK/EU). Default ANSI.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Differences from the reference",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/desk-fit": {
      "get": {
        "tags": [
          "Keyboards"
        ],
        "operationId": "checkDeskFit",
        "summary": "Check desk and mousepad fit",
        "parameters": [
          {
            "name": "keyboard",
            "in": "query",
            "required": true,
            "description": "Size id or keyboard id",
            "schema": {
              "type": "string"
            },
            "example": "tkl"
          },
          {
            "name": "desk_width_cm",
            "in": "query",
            "required": true,
            "description": "Desk width in cm",
            "schema": {
              "type": "number",
              "minimum": 30,
              "maximum": 400
            },
            "example": 120
          },
          {
            "name": "mousepad",
            "in": "query",
            "required": false,
            "description": "Mousepad size",
            "schema": {
              "type": "string",
              "enum": [
                "small",
                "medium",
                "large",
                "xl",
                "deskmat",
                "custom"
              ],
              "default": "large"
            }
          },
          {
            "name": "mousepad_width_cm",
            "in": "query",
            "required": false,
            "description": "Mousepad width in cm, required when mousepad=custom",
            "schema": {
              "type": "number",
              "minimum": 5,
              "maximum": 200
            }
          },
          {
            "name": "cm_per_360",
            "in": "query",
            "required": false,
            "description": "Mouse sensitivity in cm per 360° turn",
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "left_handed",
            "in": "query",
            "required": false,
            "description": "Mousepad on the left",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "keyboard_offset_cm",
            "in": "query",
            "required": false,
            "description": "Move the keyboard from centred; negative moves it left",
            "schema": {
              "type": "number",
              "minimum": -100,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Desk fit result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/keys/{key}": {
      "get": {
        "tags": [
          "Sizes"
        ],
        "operationId": "whichSizesHaveKey",
        "summary": "Which sizes have a key",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "Key or group: delete, f5, page-up, print-screen, arrow-keys, numpad…",
            "schema": {
              "type": "string",
              "example": "delete"
            }
          },
          {
            "name": "iso",
            "in": "query",
            "required": false,
            "description": "Use the ISO layout (UK/EU). Default ANSI.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Availability per size",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/tools": {
      "get": {
        "tags": [
          "Tools"
        ],
        "operationId": "listTestingTools",
        "summary": "List free HLPlanet testing tools",
        "responses": {
          "200": {
            "description": "Keyboard and controller testers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
