{
  "openapi": "3.1.0",
  "info": {
    "title": "hypertext.live API",
    "version": "1.0.0",
    "description": "Publish complete HTML documents and receive public share URLs.",
    "contact": {
      "url": "https://github.com/withsherpa/hypertext"
    }
  },
  "servers": [
    {
      "url": "https://hypertext.live"
    }
  ],
  "paths": {
    "/api/publish": {
      "post": {
        "operationId": "publishHtml",
        "summary": "Publish HTML",
        "description": "Stores a complete HTML document unchanged and returns a public URL.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "html"
                ],
                "additionalProperties": false,
                "properties": {
                  "html": {
                    "type": "string",
                    "description": "A complete HTML document beginning with <!doctype html>."
                  },
                  "title": {
                    "type": "string",
                    "description": "Optional display title. If omitted, the document title is used when present."
                  }
                }
              },
              "example": {
                "title": "Research report",
                "html": "<!doctype html><html><head><title>Research report</title></head><body>...</body></html>"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Published page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "url",
                    "title",
                    "size_bytes",
                    "sha256",
                    "created_at"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or invalid HTML document"
          },
          "413": {
            "description": "HTML body is too large"
          },
          "415": {
            "description": "Expected application/json"
          },
          "429": {
            "description": "Too many publish requests"
          }
        }
      }
    }
  }
}