{
  "openapi": "3.1.0",
  "info": {
    "title": "UnicodeFYI API",
    "version": "1.0.0",
    "description": "Free Unicode character lookup API. Character info, encodings (16 formats), blocks, scripts, collections, confusables, and search. No authentication required. CORS enabled."
  },
  "servers": [
    {
      "url": "https://unicodefyi.com/api"
    }
  ],
  "paths": {
    "/search/": {
      "get": {
        "operationId": "search",
        "summary": "Universal Search",
        "description": "Search across characters, glossary terms, guides, collections, and signature series chapters.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2
            },
            "description": "Search query (min 2 characters)"
          }
        ],
        "responses": {
          "200": {
            "description": "Search results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "subtitle": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "icon": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          }
                        }
                      },
                      "maxItems": 15
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/char/{hex}/": {
      "get": {
        "operationId": "getCharacter",
        "summary": "Character detail",
        "description": "Get full character info: properties, block, script, and 16 encoding formats.",
        "parameters": [
          {
            "name": "hex",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9A-Fa-f]{1,6}$"
            },
            "description": "Hex codepoint (e.g., 2713, 1F600)",
            "example": "2713"
          }
        ],
        "responses": {
          "200": {
            "description": "Character info"
          },
          "400": {
            "description": "Invalid codepoint"
          },
          "404": {
            "description": "Character not found"
          }
        }
      }
    },
    "/char/{hex}/encodings/": {
      "get": {
        "operationId": "getEncodings",
        "summary": "Character encodings",
        "description": "Get all 16 encoding representations for a character.",
        "parameters": [
          {
            "name": "hex",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9A-Fa-f]{1,6}$"
            },
            "description": "Hex codepoint (e.g., 2713, 1F600)",
            "example": "2713"
          }
        ],
        "responses": {
          "200": {
            "description": "Encoding representations"
          },
          "400": {
            "description": "Invalid codepoint"
          }
        }
      }
    },
    "/blocks/": {
      "get": {
        "operationId": "listBlocks",
        "summary": "List Unicode blocks",
        "description": "Returns all 331 Unicode blocks with codepoint ranges.",
        "responses": {
          "200": {
            "description": "Block list"
          }
        }
      }
    },
    "/block/{slug}/": {
      "get": {
        "operationId": "getBlock",
        "summary": "Block characters",
        "description": "List characters in a Unicode block.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "arrows"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 200,
              "maximum": 500
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Block with characters"
          },
          "404": {
            "description": "Block not found"
          }
        }
      }
    },
    "/scripts/": {
      "get": {
        "operationId": "listScripts",
        "summary": "List Unicode scripts",
        "description": "Returns all 52 Unicode scripts.",
        "responses": {
          "200": {
            "description": "Script list"
          }
        }
      }
    },
    "/script/{slug}/": {
      "get": {
        "operationId": "getScript",
        "summary": "Script characters",
        "description": "List curated characters for a script.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "latin"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 100,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Script with characters"
          },
          "404": {
            "description": "Script not found"
          }
        }
      }
    },
    "/collections/": {
      "get": {
        "operationId": "listCollections",
        "summary": "List curated collections",
        "description": "Returns all 88 curated character collections.",
        "responses": {
          "200": {
            "description": "Collection list"
          }
        }
      }
    },
    "/collection/{slug}/": {
      "get": {
        "operationId": "getCollection",
        "summary": "Collection characters",
        "description": "List characters in a curated collection.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "arrows"
          }
        ],
        "responses": {
          "200": {
            "description": "Collection with characters"
          },
          "404": {
            "description": "Collection not found"
          }
        }
      }
    },
    "/confusables/": {
      "get": {
        "operationId": "getConfusables",
        "summary": "Confusable characters",
        "description": "List confusable character comparisons or filter by character.",
        "parameters": [
          {
            "name": "char",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 1
            },
            "description": "Single character to find confusables for"
          }
        ],
        "responses": {
          "200": {
            "description": "Confusable comparisons"
          }
        }
      }
    },
    "/random/": {
      "get": {
        "operationId": "randomCharacter",
        "summary": "Random character",
        "description": "Get a random character from the curated set.",
        "responses": {
          "200": {
            "description": "Random character info"
          }
        }
      }
    }
  }
}