{
  "openapi": "3.1.0",
  "info": {
    "title": "Amazon Scraper API",
    "version": "1.0.0",
    "description": "Structured Amazon product, search, and review data as JSON. Pay only for successful (2xx) responses. ~55 fields per product across 20 marketplaces. Free tier: 1,000 requests/month, then $0.90 per 1,000 successful requests; monthly plans down to $0.50 per 1,000.",
    "contact": { "name": "Amazon Scraper API", "url": "https://amazonscraperapi.com", "email": "info@amazonscraperapi.com" }
  },
  "servers": [{ "url": "https://api.amazonscraperapi.com" }],
  "security": [{ "apiKeyQuery": [] }, { "bearerAuth": [] }],
  "paths": {
    "/api/v1/amazon/product": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get structured data for a single Amazon product (ASIN).",
        "parameters": [
          { "name": "query", "in": "query", "required": true, "schema": { "type": "string" }, "description": "10-character ASIN (or 10-char ISBN for books)." },
          { "name": "domain", "in": "query", "required": false, "schema": { "type": "string", "default": "com", "enum": ["com","co.uk","de","fr","it","es","nl","pl","se","ca","com.mx","com.br","com.au","co.jp","sg","in","com.tr","ae","sa","eg"] }, "description": "Amazon marketplace TLD." },
          { "name": "language", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Content language as xx_YY (e.g. en_US)." },
          { "name": "add_html", "in": "query", "required": false, "schema": { "type": "boolean", "default": false }, "description": "Attach the raw page HTML under `html`." },
          { "name": "api_key", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Your API key (or use the Authorization: Bearer header)." }
        ],
        "responses": {
          "200": { "description": "Structured product data (~55 fields).", "content": { "application/json": { "schema": { "type": "object" } } } },
          "401": { "description": "Missing or invalid API key." },
          "400": { "description": "Invalid parameters (e.g. ASIN not 10 chars)." },
          "502": { "description": "Amazon blocked or returned an unparseable page (not charged)." }
        }
      }
    },
    "/api/v1/amazon/search": {
      "get": {
        "operationId": "getSearch",
        "summary": "Get structured Amazon search results for a keyword.",
        "parameters": [
          { "name": "query", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Search keyword(s)." },
          { "name": "domain", "in": "query", "required": false, "schema": { "type": "string", "default": "com" } },
          { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "default": 1 } },
          { "name": "api_key", "in": "query", "required": false, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Search results.", "content": { "application/json": { "schema": { "type": "object" } } } },
          "401": { "description": "Missing or invalid API key." }
        }
      }
    },
    "/api/v1/amazon/batch": {
      "post": {
        "operationId": "createBatch",
        "summary": "Submit an asynchronous batch of product/search jobs.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object" } } } },
        "responses": {
          "200": { "description": "Batch accepted; returns a batch id to poll." },
          "401": { "description": "Missing or invalid API key." }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKeyQuery": { "type": "apiKey", "in": "query", "name": "api_key" },
      "bearerAuth": { "type": "http", "scheme": "bearer" }
    }
  }
}
