The problem#
Before you post, sponsor or reach out, you need to know which communities matter, who the recurring helpful voices are and which companies are active. That information is public, but scattered over forums, Q&A sites and code hosts.
Onekey searches them with one call shape and returns the same fields for each.
Endpoints to call#
| Endpoint | Used for | Credits | Status |
|---|---|---|---|
reddit.search_subreddits | Subreddits about a topic, with subscriber counts. | 2 | beta may need a pack |
lemmy.search_communities | Lemmy communities about a topic. | 5 | stable |
stackexchange.tag_top_answerers | The people who answer the most questions for a Stack Exchange tag. | 5 | stable |
github.search_repos | Repositories in a space, most starred first, with owner and homepage. | 5 | stable |
web.contacts | Contact points a company publishes on a page: emails, phone numbers, social links. | 3 | stable |
Each endpoint name links to its reference page with every parameter, the caching window and a recorded response.
Your first call#
This is github.search_repos (5 credits). Replace YOUR_API_KEY with your key; sign up, no card. 1,000 free credits cover the open-platform endpoints. Hard-to-reach platforms (X, TikTok, Instagram, Reddit, and others marked on their page) need a verified email and a purchased pack.
curl "https://api.onekey.dev/v1/github/search_repos?q=language%3Apython%20stars%3A%3E50000" \
-H "x-api-key: YOUR_API_KEY"A working script#
Map a niche: communities, top answerers, active projects and the public contact page of the organisation behind one of them.
import os
import requests
API = "https://api.onekey.dev"
HEADERS = {"x-api-key": os.environ["ONEKEY_KEY"]}
def call(path, **params):
"""GET /v1/<platform>/<endpoint>; returns the data or raises with the error code."""
r = requests.get(f"{API}/v1/{path}", params=params, headers=HEADERS, timeout=30)
body = r.json()
if not body["success"]:
raise RuntimeError(f"{path}: {body['error']['code']}")
return body["data"]
def get(item, field):
"""get(item, 'content.title'): a field of the unified schema, or None."""
for key in field.split("."):
item = (item or {}).get(key)
return item
TOPIC = "home automation"
for sub in call("reddit/search_subreddits", q=TOPIC)[:5]: # beta
print("reddit", get(sub, "entity.name"), get(sub, "entity.stats.followers"))
for comm in call("lemmy/search_communities", q=TOPIC)[:5]:
print("lemmy ", get(comm, "entity.name"), get(comm, "entity.stats.followers"))
for a in call("stackexchange/tag_top_answerers", tag="home-automation")[:5]:
print("answerer", get(a, "author.username"), get(a, "author.reputation"))
for repo in call("github/search_repos", q=f"{TOPIC} stars:>500")[:5]:
print("project", get(repo, "entity.name"), get(repo, "entity.stats.stars"), get(repo, "package.homepageUrl"))
page = call("web/contacts", url="https://example.com/contact")
print("public contact points:", get(page, "ext.emails"), get(page, "ext.social"))What a month costs#
Illustrative volume, not a benchmark: 30 topic searches on each of Reddit and Lemmy, 30 tag lookups on Stack Exchange, 100 repository searches and 100 company contact pages, in one month.
| Endpoint | Calls | Credits per call | Credits |
|---|---|---|---|
reddit.search_subreddits beta | 30 | 2 | 60 |
lemmy.search_communities | 30 | 5 | 150 |
stackexchange.tag_top_answerers | 30 | 5 | 150 |
github.search_repos | 100 | 5 | 500 |
web.contacts | 100 | 3 | 300 |
| Total | 1,160 |
About 1,160 credits: the Starter pack (5,000 credits, $9) covers it, at $1.80 per 1,000 credits. Prices are in USD (regional pricing is planned); credits never expire. See pricing.
Every figure above assumes every call is a fresh fetch. These endpoints cache for 2 minutes to 10 minutes. Free when served from cache (0.2 credit for a cached response over 100 KB). Repeating a call inside that window costs nothing. Invalid, failed and not-found calls are not charged either.
Good to know#
- Only public information is returned, and you remain responsible for how you use it, including emails and profiles of individuals. Read the Acceptable use policy and Public data pages first.
- Reddit endpoints are in beta.
Keep reading#
- Acceptable use
- Public data
- Errors
- Platform pages: Reddit, Lemmy, Stack Exchange, GitHub, Web pages