{
  "openapi": "3.1.0",
  "info": {
    "title": "Readflow API",
    "description": "Create shareable read-only markdown documents. No authentication required.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://readflow.aranish.uk"
    }
  ],
  "paths": {
    "/api/share": {
      "post": {
        "operationId": "shareMarkdown",
        "summary": "Create a shareable markdown document",
        "description": "Accepts raw markdown content and an optional title. Returns a unique ID and a public URL where the document can be viewed, downloaded as .md or PDF, and shared with rich Open Graph previews.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["content"],
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "Raw markdown content to share"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Optional document title. Used for the page title, Open Graph metadata, and download filenames."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique document ID"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Public URL to view the shared document"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid content"
          },
          "429": {
            "description": "Rate limited — 25 shares per hour per IP"
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    }
  }
}
