{
  "openapi": "3.1.0",
  "info": {
    "title": "Mourning content API",
    "version": "1.0.0",
    "summary": "Read-only public API for Mourning (mourning.io).",
    "description": "Mourning is a private digital space for families after a death: funeral planning, memorial pages, a permanent remembrance archive, and post-loss administration. This public API is read-only and unauthenticated; it exposes the site's guides and markdown page mirrors so agents can retrieve accurate product information. Family data is never exposed. Authenticated product APIs (memorials, workspaces) are not public yet — email hello@mourning.io for early access. Please keep request rates modest (a few requests per second at most); responses are cacheable.",
    "contact": {
      "name": "Mourning",
      "email": "hello@mourning.io",
      "url": "https://mourning.io/contact"
    },
    "termsOfService": "https://mourning.io/terms"
  },
  "servers": [
    {
      "url": "https://mourning.io",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "meta",
      "description": "Service metadata and discovery"
    },
    {
      "name": "content",
      "description": "Guides and page mirrors"
    }
  ],
  "paths": {
    "/api/v1": {
      "get": {
        "operationId": "listEndpoints",
        "tags": [
          "meta"
        ],
        "summary": "List API endpoints",
        "description": "Index of every available endpoint with a one-line description.",
        "responses": {
          "200": {
            "description": "Endpoint index.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "openapi": {
                      "type": "string",
                      "format": "uri"
                    },
                    "documentation": {
                      "type": "string",
                      "format": "uri"
                    },
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/status": {
      "get": {
        "operationId": "getStatus",
        "tags": [
          "meta"
        ],
        "summary": "Service health",
        "description": "Returns service status, API version, and server time.",
        "responses": {
          "200": {
            "description": "Service is healthy.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "service",
                    "apiVersion"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "service": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "apiVersion": {
                      "type": "string"
                    },
                    "time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/guides": {
      "get": {
        "operationId": "listGuides",
        "tags": [
          "content"
        ],
        "summary": "List all guides",
        "description": "All of Mourning's practical guides for the weeks after a death (what to do when someone dies, writing an obituary or eulogy, funeral planning, death certificates, sympathy messages), with metadata and links.",
        "responses": {
          "200": {
            "description": "Guide list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "guides"
                  ],
                  "properties": {
                    "guides": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Guide"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/guides/{slug}": {
      "get": {
        "operationId": "getGuide",
        "tags": [
          "content"
        ],
        "summary": "Get one guide",
        "description": "One guide's metadata plus a markdown summary of its content.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Guide slug from listGuides, e.g. \"writing-an-obituary\".",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The guide.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guide"
                }
              }
            }
          },
          "404": {
            "description": "No guide with that slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pages": {
      "get": {
        "operationId": "listPages",
        "tags": [
          "content"
        ],
        "summary": "List markdown page mirrors",
        "description": "Index of the site pages that have markdown mirrors (product pages, pricing, FAQ, partner program, contact).",
        "responses": {
          "200": {
            "description": "Page index.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "pages"
                  ],
                  "properties": {
                    "pages": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Page"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pages/{id}": {
      "get": {
        "operationId": "getPage",
        "tags": [
          "content"
        ],
        "summary": "Get one page mirror",
        "description": "One page's full markdown mirror.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id from listPages, e.g. \"home\", \"pricing\", \"partners\".",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The page mirror.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          },
          "404": {
            "description": "No page with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getLlmsTxt",
        "tags": [
          "meta"
        ],
        "summary": "Agent index (llms.txt)",
        "description": "llmstxt.org-format index of every key page, including when-to-use guidance for agents.",
        "responses": {
          "200": {
            "description": "The llms.txt file.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/markdown/{path}": {
      "get": {
        "operationId": "getMarkdownMirror",
        "tags": [
          "content"
        ],
        "summary": "Markdown mirror of a site page",
        "description": "Direct address of the markdown variant served via Accept: text/markdown content negotiation (acceptmarkdown.com). Unknown paths return a markdown 404 with recovery links; clients whose Accept header excludes markdown get 406.",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "Site path without leading slash, e.g. \"pricing\" or \"guides/writing-an-obituary\".",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown mirror.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No page at that path (body is markdown with recovery links).",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "406": {
            "description": "Client's Accept header excludes text/markdown."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "not_found",
                  "method_not_allowed"
                ],
                "description": "Stable machine-readable error code."
              },
              "message": {
                "type": "string",
                "description": "Human-readable explanation."
              },
              "hint": {
                "type": "string",
                "description": "How to recover — usually the endpoint that lists valid ids."
              }
            }
          }
        }
      },
      "Guide": {
        "type": "object",
        "required": [
          "slug",
          "title",
          "description",
          "url"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "description": "URL-safe guide identifier."
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "readMinutes": {
            "type": "integer"
          },
          "publishedAt": {
            "type": "string",
            "format": "date"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Human-readable HTML page."
          },
          "api": {
            "type": "string",
            "format": "uri",
            "description": "This guide's API detail endpoint."
          },
          "markdown": {
            "type": [
              "string",
              "null"
            ],
            "description": "Markdown summary of the guide (detail endpoint only)."
          }
        }
      },
      "Page": {
        "type": "object",
        "required": [
          "id",
          "path",
          "title"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable page id, e.g. \"home\", \"pricing\"."
          },
          "path": {
            "type": "string",
            "description": "Site path the mirror describes."
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "api": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "string",
            "description": "Full markdown mirror of the page (detail endpoint only)."
          }
        }
      }
    }
  }
}
