{
  "openapi": "3.1.0",
  "info": {
    "title": "MarketNow Skills API",
    "description": "The open marketplace for MCP-compatible agent skills. 8,535 verified skills, micro-priced from $0.99 to $9.99. Designed for autonomous agent consumption.\n\n## Authentication\nMost read endpoints are public (no auth required). Write endpoints (checkout) require no auth but redirect to Stripe.\n\n## Rate Limits\n- Anonymous: 60 requests/minute\n- The full catalog (/api/skills.json) is ~7MB — cache locally for 24h\n\n## Languages\nSkills are available in 5 languages: en, es, zh, pt, fr. Each skill with a system_prompt has a `translations` field.",
    "version": "3.0.0",
    "contact": {
      "name": "MarketNow",
      "url": "https://marketnow.site",
      "email": "eddyflores100@gmail.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://marketnow.site",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/skills.json": {
      "get": {
        "summary": "List all skills",
        "description": "Returns the complete catalog of 7,881 skills. Each skill includes id, name, slug, description, category, tags, price, currency, install command, translations (if available), and system_prompt (if available).\n\n**Cache this response locally** — refresh every 24 hours maximum. The catalog changes infrequently.",
        "operationId": "listSkills",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Search query (filter client-side)",
            "required": false,
            "schema": { "type": "string" }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Filter by category (filter client-side)",
            "required": false,
            "schema": { "type": "string", "enum": ["AI/ML", "Developer Tools", "Data", "Security", "DevOps", "Finance", "Communication", "Media", "Healthcare", "Legal", "Education", "Research", "Analytics", "IoT", "Web/API", "Automation", "Productivity", "Blockchain", "Sales", "Marketing", "Agent Reliability", "Agent Tool Use", "Agent Context Management", "Agent Production", "Agent Safety", "Agent Performance", "Cloud", "Database", "Mobile", "Gaming", "Government", "Scientific", "Voice", "Network", "System", "Cognitive", "Analysis", "Messaging"] }
          },
          {
            "name": "max_price",
            "in": "query",
            "description": "Maximum price in USD (filter client-side)",
            "required": false,
            "schema": { "type": "number", "minimum": 0.99, "maximum": 9.99 }
          },
          {
            "name": "language",
            "in": "query",
            "description": "Filter by available translation language (filter client-side on translations field)",
            "required": false,
            "schema": { "type": "string", "enum": ["en", "es", "zh", "pt", "fr"] }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of results (client-side slice)",
            "required": false,
            "schema": { "type": "integer", "default": 20, "maximum": 100 }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of skills",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/Skill" }
                }
              }
            }
          }
        }
      }
    },
    "/api/manifest.json": {
      "get": {
        "summary": "Get marketplace metadata",
        "description": "Returns marketplace metadata including total skills, pricing tiers, commission rates, and API version.",
        "operationId": "getManifest",
        "responses": {
          "200": {
            "description": "Marketplace manifest",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Manifest" }
              }
            }
          }
        }
      }
    },
    "/api/categories.json": {
      "get": {
        "summary": "List all categories",
        "description": "Returns all 46 categories with skill counts.",
        "operationId": "listCategories",
        "responses": {
          "200": {
            "description": "Array of categories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": { "type": "string" },
                      "slug": { "type": "string" },
                      "count": { "type": "integer" },
                      "url": { "type": "string", "format": "uri" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/agent.json": {
      "get": {
        "summary": "Get agent instructions",
        "description": "Machine-readable instructions for autonomous agents. Includes workflow, tools, rate limits, and authentication requirements.",
        "operationId": "getAgentInstructions",
        "responses": {
          "200": {
            "description": "Agent instructions",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentInstructions" }
              }
            }
          }
        }
      }
    },
    "/api/bundles.json": {
      "get": {
        "summary": "List skill bundles",
        "description": "Returns curated skill bundles with discounts (40-50% savings).",
        "operationId": "listBundles",
        "responses": {
          "200": {
            "description": "Array of bundles",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bundles": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Bundle" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/create-checkout-session": {
      "post": {
        "summary": "Create Stripe Checkout session",
        "description": "Creates a Stripe Checkout session for purchasing a skill. Returns a URL that the user (or agent's human operator) should be redirected to. After payment, Stripe redirects back to /vault?success=true&skillId=X.\n\n**This endpoint creates real charges in LIVE mode.**",
        "operationId": "createCheckoutSession",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["skillId"],
                "properties": {
                  "skillId": {
                    "type": "string",
                    "description": "Skill ID (e.g. mn-gen-00015)",
                    "example": "mn-gen-00015"
                  },
                  "affiliateCode": {
                    "type": "string",
                    "description": "Optional affiliate code for commission tracking",
                    "example": "aff_abc12345"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checkout session created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": { "type": "string", "format": "uri", "description": "Stripe Checkout URL" },
                    "sessionId": { "type": "string", "description": "Stripe session ID (cs_live_...)" }
                  }
                }
              }
            }
          },
          "400": { "description": "Missing skillId" },
          "404": { "description": "Skill not found" },
          "503": { "description": "Stripe not configured" }
        }
      }
    },
    "/api/stripe-webhook": {
      "post": {
        "summary": "Stripe webhook receiver",
        "description": "Receives Stripe webhook events. Verifies signature using STRIPE_WEBHOOK_SECRET. Handles: checkout.session.completed, payment_intent.payment_failed, charge.refunded.\n\n**This endpoint is called by Stripe, not by agents.**",
        "operationId": "stripeWebhook",
        "responses": {
          "200": { "description": "Webhook received" },
          "400": { "description": "Invalid signature" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Skill": {
        "type": "object",
        "required": ["id", "name", "slug", "description", "category", "price"],
        "properties": {
          "id": { "type": "string", "description": "Unique identifier", "example": "mn-gen-00015" },
          "name": { "type": "string", "description": "Human-readable name", "example": "Discord-mcp-server" },
          "slug": { "type": "string", "description": "URL-safe slug for install command", "example": "discord-mcp-server" },
          "description": { "type": "string", "description": "What the skill does", "example": "A comprehensive MCP server for Discord interaction" },
          "category": { "type": "string", "description": "Skill category", "example": "Communication" },
          "tags": { "type": "array", "items": { "type": "string" }, "description": "Searchable tags" },
          "price": { "type": "number", "description": "Price in USD", "minimum": 0.99, "maximum": 9.99, "example": 1.99 },
          "currency": { "type": "string", "description": "Always USD", "example": "USD" },
          "payment": { "type": "string", "description": "Always one-time", "example": "one-time" },
          "license": { "type": "string", "description": "Always perpetual", "example": "perpetual" },
          "verified": { "type": "boolean", "description": "Always true (all skills pass Sentinel L1)" },
          "sentinel_score": { "type": "integer", "description": "Security score 0-10", "minimum": 0, "maximum": 10 },
          "install": { "type": "string", "description": "Shell command to install", "example": "npx -y @marketnow/install discord-mcp-server" },
          "author": { "type": "string", "description": "Skill author" },
          "version": { "type": "string", "description": "Semver version", "example": "1.0.0" },
          "language": { "type": "string", "description": "Source language", "example": "es" },
          "translations": {
            "type": "object",
            "description": "Available translations (only for skills with system_prompt)",
            "properties": {
              "en": { "$ref": "#/components/schemas/Translation" },
              "es": { "$ref": "#/components/schemas/Translation" },
              "zh": { "$ref": "#/components/schemas/Translation" },
              "pt": { "$ref": "#/components/schemas/Translation" },
              "fr": { "$ref": "#/components/schemas/Translation" }
            }
          },
          "doc": {
            "type": "object",
            "properties": {
              "setup": { "type": "string" },
              "usage": { "type": "string" },
              "system_prompt": { "type": "string", "description": "Ready-to-use system prompt for AI agents" }
            }
          },
          "premium": { "type": "boolean", "description": "True if premium tier skill" },
          "tier": { "type": "string", "description": "Premium tier name" }
        }
      },
      "Translation": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "description": { "type": "string" },
          "system_prompt": { "type": "string" }
        }
      },
      "Manifest": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "version": { "type": "string" },
          "total_skills": { "type": "integer" },
          "categories_count": { "type": "integer" },
          "pricing": { "type": "object" },
          "commission_rate": { "type": "number" },
          "endpoints": { "type": "object" }
        }
      },
      "Bundle": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "skills": { "type": "array", "items": { "type": "string" } },
          "original_price": { "type": "number" },
          "bundle_price": { "type": "number" },
          "savings": { "type": "integer" },
          "category": { "type": "string" }
        }
      },
      "AgentInstructions": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "description": { "type": "string" },
          "url": { "type": "string" },
          "api_base": { "type": "string" },
          "pricing": { "type": "object" },
          "endpoints": { "type": "object" },
          "workflow_for_agents": { "type": "object" },
          "rate_limits": { "type": "object" },
          "mcp_server": { "type": "object" }
        }
      }
    }
  }
}
