{
  "openapi": "3.0.3",
  "info": {
    "title": "PeakD Agent API",
    "version": "1.0.0",
    "description": "Read-only endpoints for AI agents and automated clients. PeakD is a Vue SPA, so these endpoints provide public content without requiring JavaScript rendering."
  },
  "servers": [
    {
      "url": "https://peakd.com"
    }
  ],
  "paths": {
    "/api/agents": {
      "get": {
        "summary": "Get agent API discovery metadata",
        "responses": {
          "200": {
            "description": "Agent API discovery metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Discovery"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/post/{author}/{permlink}": {
      "get": {
        "summary": "Get a public post as JSON",
        "parameters": [
          {
            "$ref": "#/components/parameters/Author"
          },
          {
            "$ref": "#/components/parameters/Permlink"
          }
        ],
        "responses": {
          "200": {
            "description": "Wrapped Hive bridge post response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedContent"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/post/{author}/{permlink}.md": {
      "get": {
        "summary": "Get a public post as Markdown",
        "parameters": [
          {
            "$ref": "#/components/parameters/Author"
          },
          {
            "$ref": "#/components/parameters/Permlink"
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown post content with basic metadata",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/discussion/{author}/{permlink}": {
      "get": {
        "summary": "Get a public discussion tree as JSON",
        "parameters": [
          {
            "$ref": "#/components/parameters/Author"
          },
          {
            "$ref": "#/components/parameters/Permlink"
          }
        ],
        "responses": {
          "200": {
            "description": "Wrapped Hive bridge discussion response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedContent"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/profile/{username}": {
      "get": {
        "summary": "Get a public profile as JSON",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Wrapped Hive bridge profile response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedContent"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/feed": {
      "get": {
        "summary": "Get a public ranked post feed",
        "parameters": [
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "trending"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string",
              "default": ""
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 50,
              "minimum": 1
            }
          },
          {
            "name": "start_author",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_permlink",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Wrapped Hive bridge ranked feed response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedContent"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Author": {
        "name": "author",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "Permlink": {
        "name": "permlink",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "Discovery": {
        "type": "object",
        "additionalProperties": true
      },
      "WrappedContent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          },
          "source": {
            "type": "string"
          },
          "content": {
            "description": "Hive bridge response payload",
            "nullable": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}
