{
  "openapi": "3.1.0",
  "info": {
    "title": "amz.bd content API",
    "version": "1.0.0",
    "summary": "Read-only API for the site of Abdul Mannan Zinnat",
    "description": "Public, unauthenticated, read-only endpoints exposing blog posts and product case studies as JSON, plus the sitemap feed and markdown twins of every page. No API key is required.",
    "contact": {
      "name": "Abdul Mannan Zinnat",
      "url": "https://amz.bd/contact",
      "email": "mannan@spagreen.net"
    },
    "license": {
      "name": "All rights reserved",
      "url": "https://amz.bd/"
    }
  },
  "servers": [
    { "url": "https://amz.bd", "description": "Production" }
  ],
  "externalDocs": {
    "description": "Site index for LLM agents (llms.txt)",
    "url": "https://amz.bd/llms.txt"
  },
  "tags": [
    { "name": "content", "description": "Blog posts and case studies" },
    { "name": "discovery", "description": "Machine-readable site indexes" },
    { "name": "pages", "description": "Markdown representations of HTML pages" }
  ],
  "paths": {
    "/api/content/{collection}": {
      "get": {
        "tags": ["content"],
        "operationId": "listContent",
        "summary": "List published entries in a collection",
        "description": "Returns metadata for every published entry, newest first. Drafts are excluded.",
        "parameters": [{ "$ref": "#/components/parameters/collection" }],
        "responses": {
          "200": {
            "description": "Entry metadata, newest first",
            "content": {
              "application/json": {
                "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ContentMeta" } }
              }
            }
          },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/content/{collection}/{slug}": {
      "get": {
        "tags": ["content"],
        "operationId": "getContent",
        "summary": "Get one entry with its rendered HTML body",
        "parameters": [
          { "$ref": "#/components/parameters/collection" },
          { "$ref": "#/components/parameters/slug" }
        ],
        "responses": {
          "200": {
            "description": "The entry",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ContentEntry" } }
            }
          },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/{collection}/{slug}": {
      "get": {
        "tags": ["pages"],
        "operationId": "getContentPage",
        "summary": "Canonical page for an entry, as HTML or markdown",
        "description": "Send `Accept: text/markdown`, add `?format=md`, or append `.md` to the path to receive the original markdown source with frontmatter instead of HTML.",
        "parameters": [
          { "$ref": "#/components/parameters/collection" },
          { "$ref": "#/components/parameters/slug" },
          { "$ref": "#/components/parameters/format" }
        ],
        "responses": {
          "200": {
            "description": "The page",
            "headers": { "Vary": { "schema": { "type": "string", "const": "Accept" } } },
            "content": {
              "text/html": { "schema": { "type": "string" } },
              "text/markdown": { "schema": { "type": "string" } }
            }
          },
          "404": { "description": "Unknown entry" }
        }
      }
    },
    "/{page}.md": {
      "get": {
        "tags": ["pages"],
        "operationId": "getPageMarkdown",
        "summary": "Markdown twin of a static page",
        "parameters": [
          {
            "name": "page",
            "in": "path",
            "required": true,
            "description": "`index` for the home page, otherwise the page path",
            "schema": { "type": "string", "enum": ["index", "about", "services", "ventures", "work", "blog", "contact"] }
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown with YAML frontmatter",
            "content": { "text/markdown": { "schema": { "type": "string" } } }
          }
        }
      }
    },
    "/api/__sitemap__/urls": {
      "get": {
        "tags": ["discovery"],
        "operationId": "listSitemapUrls",
        "summary": "Dynamic URLs fed into sitemap.xml",
        "responses": {
          "200": {
            "description": "Sitemap entries for published content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": ["loc"],
                    "properties": {
                      "loc": { "type": "string", "description": "Path relative to the site origin", "examples": ["/blog/example-post"] },
                      "lastmod": { "type": "string", "format": "date", "description": "Last update date" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "tags": ["discovery"],
        "operationId": "getLlmsTxt",
        "summary": "llms.txt site index",
        "externalDocs": { "url": "https://llmstxt.org" },
        "responses": {
          "200": { "description": "Markdown index", "content": { "text/plain": { "schema": { "type": "string" } } } }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "tags": ["discovery"],
        "operationId": "getLlmsFullTxt",
        "summary": "Every page and post in one markdown document",
        "responses": {
          "200": { "description": "Concatenated markdown", "content": { "text/plain": { "schema": { "type": "string" } } } }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "collection": {
        "name": "collection",
        "in": "path",
        "required": true,
        "description": "`blog` for articles, `work` for product case studies",
        "schema": { "type": "string", "enum": ["blog", "work"] }
      },
      "slug": {
        "name": "slug",
        "in": "path",
        "required": true,
        "description": "Entry slug, the last segment of its canonical URL",
        "schema": { "type": "string", "pattern": "^[\\w-]+$" }
      },
      "format": {
        "name": "format",
        "in": "query",
        "required": false,
        "description": "Set to `md` to receive markdown regardless of the Accept header",
        "schema": { "type": "string", "enum": ["md", "markdown"] }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Unknown collection or slug",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "statusCode": { "type": "integer", "const": 404 },
                "statusMessage": { "type": "string" }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "ContentMeta": {
        "type": "object",
        "required": ["slug", "title", "description", "date", "updated", "tags", "draft", "readingTime", "cover"],
        "properties": {
          "slug": { "type": "string", "description": "URL slug; the page lives at /{collection}/{slug}" },
          "title": { "type": "string" },
          "description": { "type": "string", "description": "One or two sentence summary" },
          "date": { "type": "string", "format": "date", "description": "Publish date" },
          "updated": { "type": "string", "format": "date", "description": "Last update date; equals `date` when never updated" },
          "tags": { "type": "array", "items": { "type": "string" } },
          "draft": { "type": "boolean", "description": "Always false in production" },
          "readingTime": { "type": "integer", "minimum": 1, "description": "Estimated minutes to read at 200 words per minute" },
          "cover": { "type": "string", "description": "Cover image path, empty when none" }
        }
      },
      "ContentEntry": {
        "allOf": [
          { "$ref": "#/components/schemas/ContentMeta" },
          {
            "type": "object",
            "required": ["html"],
            "properties": {
              "html": { "type": "string", "description": "Body rendered from markdown to HTML" }
            }
          }
        ]
      }
    }
  }
}
