Skip to the content.

Find trending Etsy niches with Python

In this tutorial you will build a niche finder for Etsy sellers. For each keyword it reads a full Etsy search page and reports how many results compete for it. It also counts the organic listings Etsy marks as Bestseller and those on sale, and gives the median price and the most common Etsy badge. It uses the Etsy Data API and about 50 lines of Python.

What you need: Python 3.8+, pip install requests, and a free RapidAPI key.

1. Subscribe to the free plan

  1. Open the Etsy Data API on RapidAPI and subscribe to the free Basic plan (50 requests a month; a /search call counts as 2).
  2. Copy your X-RapidAPI-Key and export it:
export RAPIDAPI_KEY=your_key

2. A small helper to call the API

The helper sends your key, retries rate limits (HTTP 429) and server errors (5xx) with a growing wait, and stops with the API’s error message on anything else.

"""Score Etsy niches: competition, bestseller share, prices and discounts.

Uses the Etsy Data API on RapidAPI:
https://rapidapi.com/apiwren-apiwren-default/api/etsy-data-api-search-listings-shops-reviews
"""
import os, sys, time
from collections import Counter
from statistics import median
import requests

HOST = "etsy-data-api-search-listings-shops-reviews.p.rapidapi.com"
HEADERS = {"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST}


def get(path, **params):
    """GET one endpoint. Retries rate limits (429) and server errors (5xx)."""
    for attempt in range(4):
        r = requests.get(f"https://{HOST}{path}", headers=HEADERS, params=params, timeout=90)
        retry = r.status_code == 429 or r.status_code in range(500, 600)
        if retry and attempt != 3:
            time.sleep(float(r.headers.get("Retry-After") or 2 ** (attempt + 1)))
            continue
        if not r.ok:
            sys.exit(f"HTTP {r.status_code}: {r.text[:300]}")
        body = r.json()
        if isinstance(body, dict) and body.get("success") is False:
            sys.exit(f"API error: {body.get('error')}")
        return body

3. Score one keyword

/search takes a query and returns the whole Etsy results page (about 55 listings) with total_results. Each listing has is_ad, is_bestseller, badge, price and discount_percent. We drop ads so paid placements do not skew the numbers.

def score(keyword):
    page = get("/search", query=keyword)["data"]
    items = [x for x in page["listings"] if not x["is_ad"]]
    prices = [x["price"] for x in items if x["price"]]
    best = [x for x in items if x["is_bestseller"]]
    badges = Counter(x["badge"] for x in items if x["badge"])
    return {
        "keyword": keyword,
        "results": page["total_results"],
        "organic": len(items),
        "best": len(best),
        "best_share": len(best) / max(len(items), 1),
        "badge": badges.most_common(1)[0] if badges else ("-", 0),
        "median": median(prices) if prices else 0,
        "on_sale": sum(1 for x in items if x["discount_percent"]) / max(len(items), 1),
    }

4. Rank the keywords

Keywords are sorted by the share of organic listings with a Bestseller flag. A high share with fewer total results is a niche worth a closer look. Badges such as Popular now are common, so they are shown but not used for the ranking.

def main(keywords):
    rows = sorted((score(k) for k in keywords), key=lambda r: r["best_share"], reverse=True)
    print("keyword".ljust(20) + "results".rjust(10) + "  organic  bestseller   median  on sale  top badge")
    for r in rows:
        badge, n = r["badge"]
        print(r["keyword"][:19].ljust(20) + f"{r['results']:10,}" + f"{r['organic']:9}"
              + f"{r['best']:6} ({r['best_share']:4.0%})" + f"{r['median']:9.2f}" + f"{r['on_sale']:9.0%}  {badge} ({n})")


if __name__ == "__main__":
    main(sys.argv[1:] or ["dog bandana", "personalized mug", "crochet pattern"])

5. Run it

python etsy_niche_finder.py "dog bandana" "personalized mug" "crochet pattern"

Real output from a run on 2026-11-28:

keyword                results  organic  bestseller   median  on sale  top badge
dog bandana            113,185       12     3 ( 25%)    11.89      92%  Popular now (9)
crochet pattern      1,158,929       42     2 (  5%)     4.65      76%  Popular now (41)
personalized mug       465,866       35     1 (  3%)    13.95      91%  Popular now (32)

The complete script is in examples/etsy_niche_finder.py. It is also a GitHub Gist you can fork or embed.

Tips

Next steps