{
  "openapi": "3.1.1",
  "info": {
    "title": "Hey, Agents! Public Content API",
    "summary": "Read-only access to published posts and pages on heyagents.agency.",
    "description": "The public, unauthenticated WordPress REST surface for the Hey, Agents! publication. This specification intentionally documents read operations only. The site has no custom write API, authentication flow, webhooks, or MCP server.",
    "version": "1.0.0"
  },
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "servers": [
    {
      "url": "https://heyagents.agency/wp-json/wp/v2",
      "description": "Production public WordPress REST API"
    }
  ],
  "tags": [
    {"name": "Posts", "description": "Published editorial posts."},
    {"name": "Pages", "description": "Published informational pages."}
  ],
  "paths": {
    "/posts": {
      "get": {
        "operationId": "listPosts",
        "summary": "List published posts",
        "description": "Returns published posts. No authentication is required. Pagination totals are returned in X-WP-Total and X-WP-TotalPages response headers.",
        "tags": ["Posts"],
        "parameters": [
          {"$ref": "#/components/parameters/Page"},
          {"$ref": "#/components/parameters/PerPage"},
          {"$ref": "#/components/parameters/Search"},
          {"$ref": "#/components/parameters/Slug"},
          {"$ref": "#/components/parameters/Fields"}
        ],
        "responses": {
          "200": {"$ref": "#/components/responses/ContentCollection"},
          "400": {"$ref": "#/components/responses/JsonError"},
          "default": {"$ref": "#/components/responses/JsonError"}
        },
        "security": []
      }
    },
    "/posts/{id}": {
      "get": {
        "operationId": "getPost",
        "summary": "Retrieve a published post",
        "tags": ["Posts"],
        "parameters": [
          {"$ref": "#/components/parameters/ContentId"},
          {"$ref": "#/components/parameters/Fields"}
        ],
        "responses": {
          "200": {"$ref": "#/components/responses/ContentItem"},
          "404": {"$ref": "#/components/responses/JsonError"},
          "default": {"$ref": "#/components/responses/JsonError"}
        },
        "security": []
      }
    },
    "/pages": {
      "get": {
        "operationId": "listPages",
        "summary": "List published pages",
        "tags": ["Pages"],
        "parameters": [
          {"$ref": "#/components/parameters/Page"},
          {"$ref": "#/components/parameters/PerPage"},
          {"$ref": "#/components/parameters/Search"},
          {"$ref": "#/components/parameters/Slug"},
          {"$ref": "#/components/parameters/Fields"}
        ],
        "responses": {
          "200": {"$ref": "#/components/responses/ContentCollection"},
          "400": {"$ref": "#/components/responses/JsonError"},
          "default": {"$ref": "#/components/responses/JsonError"}
        },
        "security": []
      }
    },
    "/pages/{id}": {
      "get": {
        "operationId": "getPage",
        "summary": "Retrieve a published page",
        "tags": ["Pages"],
        "parameters": [
          {"$ref": "#/components/parameters/ContentId"},
          {"$ref": "#/components/parameters/Fields"}
        ],
        "responses": {
          "200": {"$ref": "#/components/responses/ContentItem"},
          "404": {"$ref": "#/components/responses/JsonError"},
          "default": {"$ref": "#/components/responses/JsonError"}
        },
        "security": []
      }
    }
  },
  "components": {
    "parameters": {
      "ContentId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Unique numeric WordPress content ID.",
        "schema": {"type": "integer", "minimum": 1}
      },
      "Page": {
        "name": "page",
        "in": "query",
        "description": "Current page of the collection.",
        "schema": {"type": "integer", "minimum": 1, "default": 1}
      },
      "PerPage": {
        "name": "per_page",
        "in": "query",
        "description": "Maximum items returned per page.",
        "schema": {"type": "integer", "minimum": 1, "maximum": 100, "default": 10}
      },
      "Search": {
        "name": "search",
        "in": "query",
        "description": "Limit results to content matching this string.",
        "schema": {"type": "string"}
      },
      "Slug": {
        "name": "slug",
        "in": "query",
        "description": "Limit results to one or more comma-separated slugs.",
        "schema": {"type": "array", "items": {"type": "string"}},
        "style": "form",
        "explode": false
      },
      "Fields": {
        "name": "_fields",
        "in": "query",
        "description": "Limit the response to comma-separated object fields, such as id,link,title,content.",
        "schema": {"type": "array", "items": {"type": "string"}},
        "style": "form",
        "explode": false
      }
    },
    "responses": {
      "ContentCollection": {
        "description": "A page of published content.",
        "headers": {
          "X-WP-Total": {"description": "Total matching records.", "schema": {"type": "integer", "minimum": 0}},
          "X-WP-TotalPages": {"description": "Total available pages.", "schema": {"type": "integer", "minimum": 0}}
        },
        "content": {
          "application/json": {
            "schema": {"type": "array", "items": {"$ref": "#/components/schemas/PublishedContent"}}
          }
        }
      },
      "ContentItem": {
        "description": "Published content item.",
        "content": {
          "application/json": {"schema": {"$ref": "#/components/schemas/PublishedContent"}}
        }
      },
      "JsonError": {
        "description": "Structured WordPress REST error with a stable code, human-readable message, HTTP status, and agent-oriented resolution hint.",
        "content": {
          "application/json": {
            "schema": {"$ref": "#/components/schemas/Error"},
            "examples": {
              "notFound": {
                "summary": "Unknown route",
                "value": {
                  "code": "rest_no_route",
                  "message": "No route was found matching the URL and request method.",
                  "data": {
                    "status": 404,
                    "hint": "Check https://heyagents.agency/openapi.json for supported public routes and methods."
                  }
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "RenderedText": {
        "type": "object",
        "required": ["rendered"],
        "properties": {
          "rendered": {"type": "string", "description": "Rendered HTML."},
          "protected": {"type": "boolean"}
        },
        "additionalProperties": true
      },
      "PublishedContent": {
        "type": "object",
        "required": ["id", "date", "date_gmt", "slug", "status", "type", "link", "title", "content"],
        "properties": {
          "id": {"type": "integer", "minimum": 1},
          "date": {"type": ["string", "null"], "description": "WordPress local publication datetime."},
          "date_gmt": {"type": ["string", "null"], "description": "WordPress GMT publication datetime."},
          "modified": {"type": "string", "description": "WordPress local modification datetime."},
          "modified_gmt": {"type": "string", "description": "WordPress GMT modification datetime."},
          "slug": {"type": "string"},
          "status": {"type": "string", "const": "publish"},
          "type": {"type": "string", "enum": ["post", "page"]},
          "link": {"type": "string", "format": "uri"},
          "title": {"$ref": "#/components/schemas/RenderedText"},
          "content": {"$ref": "#/components/schemas/RenderedText"},
          "excerpt": {"$ref": "#/components/schemas/RenderedText"},
          "author": {"type": "integer", "minimum": 1},
          "featured_media": {"type": "integer", "minimum": 0}
        },
        "additionalProperties": true
      },
      "Error": {
        "type": "object",
        "required": ["code", "message", "data"],
        "properties": {
          "code": {"type": "string", "description": "Stable machine-readable WordPress error code."},
          "message": {"type": "string", "description": "Human-readable error description."},
          "data": {
            "type": "object",
            "required": ["status", "hint"],
            "properties": {
              "status": {"type": "integer", "minimum": 400, "maximum": 599},
              "hint": {"type": "string", "description": "Suggested resolution for an agent or API client."}
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  },
  "security": [],
  "externalDocs": {
    "description": "Hey, Agents! developer and machine resources",
    "url": "https://heyagents.agency/developers/"
  }
}
