{
  "openapi": "3.1.0",
  "info": {
    "title": "RolePatch public discovery API",
    "version": "1.0.0",
    "description": "Read-only discovery for an evidence-bound resume tailoring and review-first application product. This is not an application-submission API.",
    "contact": {
      "name": "RolePatch",
      "url": "https://rolepatch.com"
    }
  },
  "x-versioning-policy": "This discovery contract uses semantic info.version values. Breaking changes publish a new major version and retain the previous contract for at least 90 days with Deprecation and Sunset response headers.",
  "servers": [
    {
      "url": "https://rolepatch.com"
    }
  ],
  "tags": [
    {
      "name": "discovery",
      "description": "Machine-readable public product surfaces"
    }
  ],
  "paths": {
    "/api/ai": {
      "get": {
        "operationId": "getAgentCatalog",
        "tags": [
          "discovery"
        ],
        "summary": "Complete public catalog",
        "responses": {
          "200": {
            "description": "Complete public catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentCatalog"
                }
              }
            }
          },
          "404": {
            "description": "The requested discovery surface does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/surfaces/{id}": {
      "get": {
        "operationId": "getPublicSurface",
        "tags": [
          "discovery"
        ],
        "summary": "Look up one public RolePatch surface",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Stable surface id from the public catalog.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public surface",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSurface"
                }
              }
            }
          },
          "404": {
            "description": "No public surface uses that id.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getLlmsTxt",
        "tags": [
          "discovery"
        ],
        "summary": "Compact LLM index",
        "responses": {
          "200": {
            "description": "Compact LLM index",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "The requested discovery surface does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "operationId": "getLlmsFullTxt",
        "tags": [
          "discovery"
        ],
        "summary": "Full LLM product brief",
        "responses": {
          "200": {
            "description": "Full LLM product brief",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "The requested discovery surface does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/index.md": {
      "get": {
        "operationId": "getProductBrief",
        "tags": [
          "discovery"
        ],
        "summary": "Canonical Markdown product brief",
        "responses": {
          "200": {
            "description": "Canonical Markdown product brief",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "The requested discovery surface does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/sitemap.xml": {
      "get": {
        "operationId": "getSitemap",
        "tags": [
          "discovery"
        ],
        "summary": "Public XML sitemap",
        "responses": {
          "200": {
            "description": "Public XML sitemap",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "The requested discovery surface does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApiSpec",
        "tags": [
          "discovery"
        ],
        "summary": "This OpenAPI document",
        "responses": {
          "200": {
            "description": "This OpenAPI document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "The requested discovery surface does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AgentCatalog": {
        "type": "object",
        "required": [
          "name",
          "version",
          "url",
          "llms",
          "surfaces"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "llms": {
            "type": "string",
            "format": "uri"
          },
          "llmsFull": {
            "type": "string",
            "format": "uri"
          },
          "sitemap": {
            "type": "string",
            "format": "uri"
          },
          "robots": {
            "type": "string",
            "format": "uri"
          },
          "openapi": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "object",
            "required": [
              "suffix",
              "negotiation"
            ],
            "properties": {
              "suffix": {
                "type": "string"
              },
              "negotiation": {
                "type": "boolean"
              }
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicSurface"
            }
          }
        }
      },
      "PublicSurface": {
        "type": "object",
        "required": [
          "id",
          "url",
          "md",
          "kind",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "md": {
            "type": "string",
            "format": "uri"
          },
          "kind": {
            "type": "string",
            "const": "static"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "Problem": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "resolution": {
            "type": "string"
          }
        }
      }
    }
  }
}