{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentBazaar",
    "version": "2.0.0",
    "description": "Multi-marketplace product search for AI agents. Search eBay, AliExpress, Amazon, and Etsy via Apify actors.",
    "x-guidance": "AgentBazaar lets agents search products across 4 major marketplaces. Use /api/search with a query and marketplace param. Use /api/compare to find the cheapest marketplace. Use /api/deals to find underpriced items. Use /api/reviews to check product quality. Use /api/seller to check seller reputation. All paid endpoints require x402 payment on Base chain.",
    "contact": {
      "email": "ragna@agentbazaar.xyz"
    }
  },
  "servers": [
    {
      "url": "https://agentbazaar.vercel.app",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchProducts",
        "summary": "Search products across marketplaces",
        "description": "Search for products on eBay, AliExpress, Amazon, or Etsy by keyword. Returns product listings with prices, images, and seller info.",
        "tags": [
          "Search"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.100000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Search keyword (e.g. 'iphone 15 case', 'wireless headphones')",
            "schema": {
              "type": "string",
              "minLength": 1,
              "examples": [
                "wireless headphones"
              ]
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": false,
            "description": "Target marketplace to search",
            "schema": {
              "type": "string",
              "enum": [
                "ebay",
                "aliexpress",
                "amazon",
                "etsy"
              ],
              "default": "ebay"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max number of results to return",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string"
                    },
                    "marketplace": {
                      "type": "string"
                    },
                    "query": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/item": {
      "get": {
        "operationId": "getItemDetails",
        "summary": "Get detailed product info by URL",
        "description": "Get full product details from a marketplace URL including description, all images, shipping options, and seller info.",
        "tags": [
          "Products"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Full product URL from eBay, AliExpress, Amazon, or Etsy",
            "schema": {
              "type": "string",
              "format": "uri",
              "examples": [
                "https://www.ebay.com/itm/123456789"
              ]
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": false,
            "description": "Source marketplace",
            "schema": {
              "type": "string",
              "enum": [
                "ebay",
                "aliexpress",
                "amazon",
                "etsy"
              ],
              "default": "ebay"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string"
                    },
                    "marketplace": {
                      "type": "string"
                    },
                    "item": {
                      "type": "object"
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/seller": {
      "get": {
        "operationId": "checkSeller",
        "summary": "Check seller listings and reputation",
        "description": "Get a seller's active listings and reputation info. Works with eBay sellers and Etsy shops.",
        "tags": [
          "Sellers"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.100000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "username",
            "in": "query",
            "required": true,
            "description": "Seller username (eBay) or shop name (Etsy)",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": false,
            "description": "Source marketplace",
            "schema": {
              "type": "string",
              "enum": [
                "ebay",
                "etsy"
              ],
              "default": "ebay"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Seller info and listings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string"
                    },
                    "marketplace": {
                      "type": "string"
                    },
                    "seller": {
                      "type": "string"
                    },
                    "activeListings": {
                      "type": "integer"
                    },
                    "listings": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/deals": {
      "get": {
        "operationId": "findDeals",
        "summary": "Find underpriced items and deals",
        "description": "Scans 50 listings for a keyword, calculates average price, and returns items priced below 80% of the average with deal scores.",
        "tags": [
          "Deals"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.250000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Search keyword to find deals for",
            "schema": {
              "type": "string",
              "minLength": 1,
              "examples": [
                "mechanical keyboard"
              ]
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": false,
            "description": "Target marketplace",
            "schema": {
              "type": "string",
              "enum": [
                "ebay",
                "aliexpress",
                "amazon",
                "etsy"
              ],
              "default": "ebay"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max number of deals to return",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deals found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string"
                    },
                    "marketplace": {
                      "type": "string"
                    },
                    "query": {
                      "type": "string"
                    },
                    "avgPrice": {
                      "type": "number"
                    },
                    "totalScanned": {
                      "type": "integer"
                    },
                    "dealsFound": {
                      "type": "integer"
                    },
                    "deals": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/trending": {
      "get": {
        "operationId": "getTrending",
        "summary": "Trending items by marketplace",
        "description": "Get trending items and price statistics for a marketplace. Supports category filtering.",
        "tags": [
          "Trending"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.150000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "marketplace",
            "in": "query",
            "required": false,
            "description": "Target marketplace",
            "schema": {
              "type": "string",
              "enum": [
                "ebay",
                "aliexpress",
                "amazon",
                "etsy"
              ],
              "default": "ebay"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Category ID or name to filter trending items",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max number of items to return",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Trending items and stats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string"
                    },
                    "marketplace": {
                      "type": "string"
                    },
                    "category": {
                      "type": "string"
                    },
                    "stats": {
                      "type": "object"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "healthCheck",
        "summary": "Health check",
        "description": "Service health status. Free endpoint, no payment required.",
        "tags": [
          "System"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "service": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "uptime": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api": {
      "get": {
        "operationId": "getApiInfo",
        "summary": "API info and endpoint list",
        "description": "Returns API metadata and available endpoints. Free endpoint, no payment required.",
        "tags": [
          "System"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "API information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/compare": {
      "get": {
        "operationId": "comparePrices",
        "summary": "Compare prices across marketplaces",
        "description": "Search for the same product across eBay, AliExpress, and Amazon, return prices from each marketplace with the cheapest option highlighted.",
        "tags": [
          "Compare"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.250000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Product search keyword",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max results per marketplace",
            "schema": {
              "type": "integer",
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Price comparison results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/reviews": {
      "get": {
        "operationId": "getReviews",
        "summary": "Get product reviews",
        "description": "Get reviews and ratings for a product. Currently supports eBay with full review data.",
        "tags": [
          "Reviews"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.150000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Product URL",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": false,
            "description": "Source marketplace",
            "schema": {
              "type": "string",
              "enum": [
                "ebay",
                "aliexpress",
                "amazon",
                "etsy"
              ],
              "default": "ebay"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max reviews to return",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product reviews",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/seller-products": {
      "get": {
        "operationId": "getSellerProducts",
        "summary": "List seller products",
        "description": "Get all products from a specific seller with price statistics.",
        "tags": [
          "Sellers"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.100000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "username",
            "in": "query",
            "required": true,
            "description": "Seller username or shop name",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": false,
            "description": "Source marketplace",
            "schema": {
              "type": "string",
              "enum": [
                "ebay",
                "aliexpress",
                "amazon",
                "etsy"
              ],
              "default": "ebay"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max products to return",
            "schema": {
              "type": "integer",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Seller products with stats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    }
  }
}