{
  "openapi": "3.0.1",
  "info": {
    "title": "Amazon KDP Niche Analyzer",
    "description": "Analyze Amazon KDP niches by keyword: competing Kindle/paperback books with BSR, price, ratings, reviews, plus a transparent 0-100 opportunity score. 10 marketplaces. PPE. MCP-ready.",
    "version": "0.1",
    "x-build-id": "EGFIPN947hMuJs27J"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~amazon-kdp-niche-analyzer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-amazon-kdp-niche-analyzer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/khadinakbar~amazon-kdp-niche-analyzer/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-amazon-kdp-niche-analyzer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/khadinakbar~amazon-kdp-niche-analyzer/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-amazon-kdp-niche-analyzer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "keywords": {
            "title": "Niche keywords",
            "type": "array",
            "description": "List of book niche keywords to analyze, one per line, e.g. 'cozy mystery', 'keto cookbook', 'dragon romance'. Each keyword runs one Amazon Kindle Store (or Books) search and returns competing books plus one niche report. Use short buyer-style phrases; do not paste Amazon URLs.",
            "items": {
              "type": "string"
            }
          },
          "keyword": {
            "title": "Single keyword (alternative)",
            "type": "string",
            "description": "One niche keyword as plain text, e.g. 'cozy mystery'. Use this instead of the list when an agent or API caller passes a single string. Combined and de-duplicated with Niche keywords when both are set."
          },
          "marketplace": {
            "title": "Amazon marketplace",
            "enum": [
              "US",
              "UK",
              "DE",
              "CA",
              "ES",
              "IT",
              "JP",
              "AU",
              "IN"
            ],
            "type": "string",
            "description": "Which Amazon store to search. Controls domain, currency, and proxy country. Defaults to US (amazon.com).",
            "default": "US"
          },
          "department": {
            "title": "Department",
            "enum": [
              "kindle",
              "paperback"
            ],
            "type": "string",
            "description": "Search the Kindle Store (e-books, default) or the Books department (paperback/print). Choose 'kindle' for KDP e-book niches, 'paperback' for low-content or print niches.",
            "default": "kindle"
          },
          "maxBooksPerKeyword": {
            "title": "Max books per keyword",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "How many competing books to analyze per keyword (organic results first, sponsored only to fill). Accepts 1-30. Defaults to 10. This is the main cost cap: you pay per book saved.",
            "default": 10
          },
          "fetchDetails": {
            "title": "Fetch detail pages (BSR)",
            "type": "boolean",
            "description": "When true (default), opens each book's Amazon page to read Best Sellers Rank, publisher, publish date, page count, and the independently-published flag. Demand scoring relies on BSR, so keep this on for niche decisions. Set false for a faster search-only scan.",
            "default": true
          },
          "includeNicheSummary": {
            "title": "Include niche report",
            "type": "boolean",
            "description": "When true (default), adds one niche-report row per keyword with median BSR, median price, median reviews, title density, demand, competition, and a 0-100 opportunity score. Only produced when at least one book was saved for that keyword.",
            "default": true
          },
          "maxKeywords": {
            "title": "Max keywords per run",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Safety cap on how many keywords are processed in one run. Accepts 1-20. Defaults to 5. Extra keywords are ignored and listed in OUTPUT warnings.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings. Amazon blocks many datacenter IPs. Leave the default (Apify Proxy on): the Actor tries residential in the marketplace country first, then other Apify proxy groups. Override only for your own proxy groups or URLs.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}