{
  "openapi": "3.0.3",
  "info": {
    "title": "Contrive Solutions API",
    "description": "Public read-only API for Contrive Solutions (contrivesol.com) — an AI-first software development company. Includes markdown/LLM-friendly content endpoints and the standard WordPress REST API. No authentication is required for the endpoints listed here.",
    "version": "1.0.0",
    "contact": {
      "name": "Contrive Solutions",
      "url": "https://contrivesol.com/contact-us/",
      "email": "connect@contrivesolution.com"
    }
  },
  "servers": [
    { "url": "https://contrivesol.com/wp-json", "description": "Production" }
  ],
  "externalDocs": {
    "description": "Developer resources index (llms.txt, ai.txt, markdown endpoints, this spec)",
    "url": "https://contrivesol.com/developers/"
  },
  "tags": [
    { "name": "content", "description": "LLM/agent-friendly content endpoints (Contrive Solutions custom API)" },
    { "name": "wordpress", "description": "Standard WordPress core REST API (read-only, public content types)" }
  ],
  "paths": {
    "/contrive/v1/pages": {
      "get": {
        "tags": ["content"],
        "summary": "List all published pages and recent posts",
        "description": "Site map of every published page and the 50 most recent posts, each with a link to its human HTML URL and its markdown (.md) equivalent. Use this to discover all site content programmatically.",
        "operationId": "listPages",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/PageSummary" }
                }
              }
            }
          }
        }
      }
    },
    "/contrive/v1/markdown/{slug}": {
      "get": {
        "tags": ["content"],
        "summary": "Get a page or post as clean markdown",
        "description": "Returns the requested page/post content converted to markdown — no HTML, no navigation chrome, no scripts. Use `home` for the front page.",
        "operationId": "getMarkdown",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "URL slug of the page/post (e.g. `about-us`, `services/ai-services`), or `home` for the front page.",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown content",
            "content": {
              "text/markdown": { "schema": { "type": "string" } }
            }
          },
          "404": {
            "description": "Page not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/contrive/v1/llms": {
      "get": {
        "tags": ["content"],
        "summary": "Get the llms.txt company/service summary",
        "description": "Same content as /llms.txt at the site root, served through the REST API. Pass `full=1` for the comprehensive version (equivalent to /llms-full.txt).",
        "operationId": "getLlmsTxt",
        "parameters": [
          {
            "name": "full",
            "in": "query",
            "required": false,
            "description": "Set to `1` or `true` for the comprehensive version.",
            "schema": { "type": "string", "enum": ["1", "true"] }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": { "schema": { "type": "string" } }
            }
          }
        }
      }
    },
    "/wp/v2/pages": {
      "get": {
        "tags": ["wordpress"],
        "summary": "List published pages (WordPress core REST API)",
        "description": "Standard WordPress core endpoint. See the official WordPress REST API Handbook for the full schema and query parameters.",
        "operationId": "wpListPages",
        "externalDocs": {
          "description": "WordPress REST API Handbook — Pages",
          "url": "https://developer.wordpress.org/rest-api/reference/pages/"
        },
        "responses": {
          "200": { "description": "OK" }
        }
      }
    },
    "/wp/v2/posts": {
      "get": {
        "tags": ["wordpress"],
        "summary": "List published blog posts (WordPress core REST API)",
        "description": "Standard WordPress core endpoint. See the official WordPress REST API Handbook for the full schema and query parameters.",
        "operationId": "wpListPosts",
        "externalDocs": {
          "description": "WordPress REST API Handbook — Posts",
          "url": "https://developer.wordpress.org/rest-api/reference/posts/"
        },
        "responses": {
          "200": { "description": "OK" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PageSummary": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 322 },
          "title": { "type": "string", "example": "Home" },
          "type": { "type": "string", "enum": ["page", "post"], "example": "page" },
          "url": { "type": "string", "format": "uri", "example": "https://contrivesol.com/about-us/" },
          "markdown_url": { "type": "string", "format": "uri", "example": "https://contrivesol.com/about-us.md" },
          "date_modified": { "type": "string", "format": "date-time" }
        },
        "required": ["id", "title", "type", "url", "markdown_url", "date_modified"]
      },
      "Error": {
        "type": "object",
        "description": "Standard WordPress REST API error shape, used by every endpoint on this server.",
        "properties": {
          "code": { "type": "string", "example": "not_found" },
          "message": { "type": "string", "example": "Page not found" },
          "data": {
            "type": "object",
            "properties": {
              "status": { "type": "integer", "example": 404 },
              "hint": { "type": "string", "example": "Check the slug against GET /wp-json/contrive/v1/pages." }
            }
          }
        },
        "required": ["code", "message", "data"]
      }
    }
  }
}
