{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "Carol Monroe Agent API",
    "version": "1.0.0",
    "description": "A minimal, read-only interface for agents to identify Carol Monroe and discover her public content. No write or destructive operations are exposed.",
    "contact": {
      "name": "Carol Monroe",
      "email": "hello@carolmonroe.com",
      "url": "https://carolmonroe.com"
    },
    "license": {
      "name": "All rights reserved",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://carolmonroe.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Agent discovery",
      "description": "Read-only resources for AI agents."
    }
  ],
  "paths": {
    "/api": {
      "get": {
        "tags": [
          "Agent discovery"
        ],
        "operationId": "getAgentApiIndex",
        "summary": "Discover the agent-facing API",
        "description": "Returns the API version, authentication method, role, and endpoint URLs.",
        "security": [],
        "responses": {
          "200": {
            "description": "API discovery document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiIndex"
                }
              }
            }
          },
          "406": {
            "$ref": "#/components/responses/NotAcceptable"
          }
        }
      }
    },
    "/api/agent/v1/profile": {
      "get": {
        "tags": [
          "Agent discovery"
        ],
        "operationId": "getCarolMonroeProfile",
        "summary": "Read Carol Monroe's public agent profile",
        "description": "Returns a compact public profile and links to machine-readable content. Requires the least-privilege content:read role.",
        "security": [
          {
            "AgentReadKey": []
          }
        ],
        "x-required-roles": [
          "content:read"
        ],
        "responses": {
          "200": {
            "description": "Public profile and content discovery links",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "406": {
            "$ref": "#/components/responses/NotAcceptable"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AgentReadKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Agent-Key",
        "description": "A revocable API key assigned only the content:read role.",
        "x-roles": {
          "content:read": "Read Carol's public profile and machine-readable content links."
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "The agent key is missing",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The agent key is invalid or lacks the required role",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unavailable": {
        "description": "The read-only credential has not been configured",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotAcceptable": {
        "description": "The requested representation is not available",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "ApiIndex": {
        "type": "object",
        "required": [
          "name",
          "version",
          "openapi",
          "authentication",
          "endpoints"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "openapi": {
            "type": "string",
            "format": "uri"
          },
          "authentication": {
            "type": "object",
            "required": [
              "type",
              "header",
              "roles"
            ],
            "properties": {
              "type": {
                "const": "apiKey"
              },
              "header": {
                "const": "X-Agent-Key"
              },
              "roles": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "Profile": {
        "type": "object",
        "required": [
          "name",
          "canonical_url",
          "description",
          "capabilities",
          "machine_readable"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "contact": {
            "type": "string",
            "format": "email"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "machine_readable": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "resolution",
              "docs_url",
              "request_path"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "resolution": {
                "type": "string"
              },
              "docs_url": {
                "type": "string",
                "format": "uri"
              },
              "request_path": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}