{
  "openapi": "3.1.0",
  "info": {
    "title": "PostSmooth API",
    "version": "1.0.0",
    "description": "API surface for authenticated PostSmooth accounts and connected social profiles."
  },
  "servers": [
    { "url": "https://postsmooth.com" }
  ],
  "security": [
    { "postSmoothSession": [] }
  ],
  "paths": {
    "/api/posts": {
      "get": {
        "summary": "List posts",
        "responses": { "200": { "description": "Posts for the authenticated account" }, "401": { "description": "Authentication required" } }
      }
    },
    "/api/posts/publish": {
      "post": {
        "summary": "Publish a post",
        "responses": { "200": { "description": "Publish result" }, "400": { "description": "Invalid post or platform" }, "401": { "description": "Authentication required" } }
      }
    },
    "/api/profiles": {
      "get": {
        "summary": "List connected profiles",
        "responses": { "200": { "description": "Connected profiles" }, "401": { "description": "Authentication required" } }
      },
      "post": {
        "summary": "Add a profile",
        "responses": { "201": { "description": "Profile created" }, "400": { "description": "Invalid profile" }, "401": { "description": "Authentication required" } }
      }
    },
    "/api/analytics": {
      "get": {
        "summary": "Read account analytics",
        "responses": { "200": { "description": "Analytics for connected profiles" }, "401": { "description": "Authentication required" } }
      }
    },
    "/api/media": {
      "get": {
        "summary": "List uploaded media",
        "responses": { "200": { "description": "Media belonging to the account" }, "401": { "description": "Authentication required" } }
      },
      "post": {
        "summary": "Upload media",
        "responses": { "201": { "description": "Media uploaded" }, "400": { "description": "Unsupported media" }, "401": { "description": "Authentication required" } }
      }
    },
    "/api/auth/{platform}/connect": {
      "get": {
        "summary": "Start OAuth account linking",
        "parameters": [
          { "name": "platform", "in": "path", "required": true, "schema": { "type": "string", "enum": ["facebook", "instagram", "threads", "twitter", "tiktok", "linkedin", "pinterest", "youtube"] } }
        ],
        "responses": { "307": { "description": "Redirect to the platform authorization page" }, "401": { "description": "Authentication required" } }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "postSmoothSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "authjs.session-token",
        "description": "Authenticated PostSmooth browser session."
      }
    }
  }
}
