reefapi (Python)
Official Python SDK for ReefAPI. ReefAPI is one API key for 600+ site-specific,
live web-data APIs (Amazon, eBay, Zillow, Reddit, Google Maps, LinkedIn Jobs, TikTok Shop and hundreds
more): every engine fetches the site in real time and returns clean JSON, and failed calls are not charged.
pip install reefapi
Python 3.9+. One dependency (httpx). Sync and async clients, typed helpers for the 20 most-used
engines, automatic retries for retryable errors, and a client-side limiter that keeps you inside the
rate limit.
Quick start
Get an API key at reefapi.com and put it in the REEFAPI_KEY environment variable
(or pass ReefAPI(api_key="...")).
from reefapi import ReefAPI
client = ReefAPI() # reads REEFAPI_KEY
data = client.ebay.search(query="iphone 13 pro")
for item in data["results"][:5]:
print(item["title"], item["price"]["value"], item["price"].get("currency"))
Every engine is also reachable with one generic method, which mirrors the HTTP API exactly
(POST https://api.reefapi.com/<engine>/v1/<action> with a JSON body):
data = client.call("ebay", "search", query="iphone 13 pro")
data = client.call("ebay", "search", {"query": "iphone 13 pro"}) # dict form, same call
call() returns the response data. Use call_raw() when you also need meta (request id, latency,
meta.pagination for paged actions).
Examples
1. Amazon product detail
product = client.amazon.product_detail(asin="B0DGHMNQ5Z")["product"]
print(product["title"], product.get("price"), product.get("currency_code"), product.get("rating"))
2. Zillow listings for a city
homes = client.zillow.search(location="Austin, TX")
for h in homes["items"][:5]:
print(h.get("address_line"), h.get("list_price_usd"), h.get("beds"), h["url"])
3. Reddit posts from a subreddit
posts = client.reddit.subreddit_posts(subreddit="python", limit=10)
for p in posts["posts"]:
print(p.get("score"), p["title"])
4. Google Maps places near a point
places = client.google_maps.place_search(
query="specialty coffee Times Square", lat=40.7589, lng=-73.9881, maxResults=10
)
for pl in places["places"]:
print(pl["name"], pl.get("rating"), pl.get("review_count"), pl.get("address"))
5. Trustpilot reviews with the generic call() (works for every engine)
res = client.call("trustpilot", "company/reviews", company="amazon.com", maxReviews=40)
company = res["results"][0]["company"]
print(company["name"], company.get("trust_score"), company.get("number_of_reviews"))
for r in res["results"][0].get("reviews", [])[:3]:
print(r.get("rating"), r.get("title"))
Async
import asyncio
from reefapi import AsyncReefAPI
async def main():
async with AsyncReefAPI() as client:
ebay, reddit = await asyncio.gather(
client.ebay.search(query="nintendo switch"),
client.reddit.search(q="nintendo switch"),
)
print(len(ebay["results"]), "eBay listings")
asyncio.run(main())
Discover engines and parameters
engines = client.engines() # every engine: name, title, category, actions (no key needed)
spec = client.spec("vinted") # one engine: every action with typed params, allowed values, examples
for action in spec["actions"]:
print(action["name"], action["required_params"])
The same information is on each engine's docs page, https://reefapi.com/docs/<engine>, and as
Markdown at https://reefapi.com/docs/<engine>.md.
Errors
A call that does not return ok: true raises ReefAPIError:
from reefapi import ReefAPI, ReefAPIError
try:
client.ebay.search(query="")
except ReefAPIError as e:
print(e.code) # e.g. "MISSING_PARAM", "INVALID_PARAM", "AUTH_FAILED", "QUOTA_EXCEEDED", "RATE_LIMITED"
print(e.message) # human-readable reason
print(e.retryable) # True when repeating the call later may succeed
print(e.status) # HTTP status (None if no response arrived)
print(e.request_id) # quote this when contacting support
Failed calls are not charged. Errors the SDK raises itself use the codes TIMEOUT, NETWORK_ERROR,
MISSING_API_KEY and INVALID_RESPONSE.
Retries. Errors the gateway marks retryable and HTTP 429 are retried automatically (default
max_retries=2, exponential backoff with jitter, Retry-After honoured up to max_retry_wait=60 seconds).
Connection failures where the request never left your machine are retried too; a request that timed out
after being sent is not repeated automatically (it raises TIMEOUT with retryable=True, and you decide).
Rate limit. The gateway allows 30 requests per 3 seconds per key. The client keeps a sliding window of
the same size, so a burst of calls (threads or asyncio.gather) waits instead of failing. Change it with
rate_limit=(requests, seconds) or turn it off with rate_limit=None.
Timeouts. Default 180 seconds per request: some engines render pages in a real browser and can take
over a minute. Override per client (ReefAPI(timeout=60)) or per call site:
fast = client.with_options(timeout=30, max_retries=0)
fast.ebay.search(query="lego")
Typed helpers
The helpers below are generated from the live engine specs (scripts/generate.py): keyword arguments are
typed (enums become Literal[...]), and every method's docstring lists the parameters, allowed values,
defaults and what the response contains. All other engines work through client.call().
| Helper |
Methods |
client.amazon |
product_detail, product_reviews, product_offers, search, products_batch, category_browse, bestsellers, new_releases, seller_profile, autocomplete, seller_products, seller_reviews, deals, product_related, gtin_to_asin |
client.ebay |
search, item_detail, items_batch, seller_items, seller_profile, deals, categories |
client.walmart |
search, product_detail, reviews, category |
client.aliexpress |
search, product_detail, reviews, similar, description, shipping, store_info, deals |
client.etsy |
listings_search, listings_detail, shops_detail, shops_listings, listings_category, reviews_shop, reviews_listing, search_suggest |
client.vinted |
catalog_search, item_detail, seller, seller_items, seller_feedback, brand_search, autocomplete, similar, catalog_filters, categories, colors, conditions, countries, sizes |
client.zillow |
new_listings, search, search_by_coordinates, search_by_url, property_detail, comps, sold, agent, agent_profile, agents_by_location, autocomplete, market_trends, walk_transit_bike, home_value_chart |
client.redfin |
search, listing_detail, similar, autocomplete, market_stats, agent_search, agent_profile, agent_listings |
client.idealista |
search, detail, geography |
client.rightmove |
location_search, search, property_detail, agent, similar, sold_prices |
client.google_maps |
place_search, place_detail, place_by_id, place_nearby, geocode, place_reviews, place_photos, place_freshness |
client.reddit |
subreddit_posts, multi_subreddit_posts, post_comments, search, user, subreddit_about, communities, trending, user_search, load_more_comments, subreddit_extras |
client.tiktok_shop |
product_detail, products_by_ids, category_tree, category_products, search, recommended_shops, seller_profile, seller_catalog, related_products, ranking_list, premium_offers, flash_sales, recommended_for_you, reviews |
client.youtube |
search, video_detail, video_details, comments, channel, transcript, playlist, channel_videos, channel_shorts, related, channel_about |
client.linkedin_jobs |
jobs_search, jobs_detail, company, jobs_by_company, locations_search, jobs_similar |
client.indeed |
jobs_search, job, company, company_search, company_reviews, company_salaries, estimated_salary |
client.trustpilot |
company_reviews, company_details, category_browse, category_companies, category_recently_reviewed, category_newest, category_details, category_search, company_search, consumer_details, consumer_reviews, reviewer_profile |
client.tcgplayer |
search, product_detail, product_listings, product_sales, product_price_history, sets, games |
client.cardmarket |
search, expansion_products, expansions, product_detail, product_offers, search_suggest, price_guide, product_catalog, image |
client.trademe |
search, listing, cars_search, real_estate_search, real_estate_suburbs, seller_listings, seller_feedback, categories, suggest |
All engines
838 engines in the live catalog when this package was built (the current list: client.engines() or https://reefapi.com/docs).