Root Hub API
Root communities and their live numbers, for your own app or bot.
https://roothub.net/api/v1
Getting a key
Keys are given out by hand, one for each app. Message @bit on Root with what you're building and which data you need.
Until then, try everything on this page with the demo key.
Try it
Pick an endpoint and send it. The demo key is filled in and shows up to 5 items an answer; paste your own key to see whole answers.
Sending your key
Send it with every request in the Authorization header as a bearer token, or in X-Api-Key. Never put it in the address, where logs and browsers keep it.
curl -H "Authorization: Bearer rhk_demo" "https://roothub.net/api/v1/communities?limit=3"
Answers are JSON. What you asked for is in data; lists also have meta, with the page and totals. Times are UTC, as ISO 8601. Call /me to see what your key may read and how far its limits go.
Endpoints
Every endpoint answers GET, under https://roothub.net/api/v1. Your key needs the scope shown next to each one; /me works with any key. Each endpoint has live checks that it answers the way this page says. They run from your browser with the key in Try it, and each one is a real request that counts toward that key's limits.
Your key
GET
/me
Any key
The key you sent: its name, the endpoints and fields it may read, its limits, how many devices may use it and how many do, how much of its limits is used and when it ends. Good for checking a key works.
Hub totals
GET
/hub
Scope: hub
How many communities and members the Hub lists, and each category with its count.
List communities
GET
/communities
Scope: communities
Listed communities, biggest first unless you sort them another way. Search, filter and page through them.
| Parameter | What it does | Values |
|---|---|---|
q |
Search the Hub address, and the names, tags and descriptions your key may read. | Any |
category |
One category. Needs the category scope. | gaming, music, education, technology, art-creative, sports, social, other |
tag |
Only communities with this tag, without the #. Needs the tags scope. | Any |
sort |
popular (most members), trending (fastest growing this week), new (latest listed), name, or address (Hub address). Each needs the data it sorts by; address works for every key. | popular, trending, new, name, address |
page |
Which page, from 1. A key can page as deep as its result limit. | 1 by default |
limit |
Communities per page, up to your key's page size. | 25 by default |
fields |
Only these fields, split by commas. slug always comes back. | Any |
One community
GET
/communities/{slug}
Scope: community
One community by its Hub address.
| Parameter | What it does | Values |
|---|---|---|
slug in the path |
Its Hub address, as in roothub.net/<slug>. | Any |
fields |
Only these fields, split by commas. slug always comes back. | Any |
Member history
GET
/communities/{slug}/history
Scope: history
Members and the busiest online count for each day the Hub counted them, oldest first.
| Parameter | What it does | Values |
|---|---|---|
slug in the path |
Its Hub address. | Any |
days |
How far back, up to your key's history limit. | 7, 30, 90, 365 |
Roles
GET
/communities/{slug}/roles
Scope: roles
The roles the community shows on its page, up to your key's page size. Empty when its owner hid them.
| Parameter | What it does | Values |
|---|---|---|
slug in the path |
Its Hub address. | Any |
Comments
GET
/communities/{slug}/comments
Scope: comments
The discussion on the community page, ten threads a page with their replies (fewer when your key's page size is smaller). Page 1 starts with the pinned ones.
| Parameter | What it does | Values |
|---|---|---|
slug in the path |
Its Hub address. | Any |
sort |
new or old. | new, old |
page |
Which page, from 1. | 1 by default |
Find by invite
GET
/lookup
Scope: lookup
The listed community behind a Root invite link or code.
| Parameter | What it does | Values |
|---|---|---|
invite needed |
A rootapp.gg link or its code. | Any |
fields |
Only these fields, split by commas. slug always comes back. | Any |
Community fields
Each community in an answer has the fields your key may read, in this order, and no others. slug and url always come along. To get fewer, name them: ?fields=name,members.
| Field | What it is | Scope |
|---|---|---|
slug | Its Hub address, as in roothub.net/<slug>. Always there. | Every key |
url | Its page on the Hub. Always there. | Every key |
name | Its name on Root. | name |
avatar | The address of its picture, or null. | pictures |
banner | The address of its banner, or null. | pictures |
description | Its description as plain text. Only verified listings have one; else null. | description |
category | One of the Hub's categories, by name. | category |
tags | Its tags, without the #. | tags |
invite | Its Root invite link. | invite |
members | How many members it has. Null while the Hub has no count yet. | members |
online | How many were online at the last count. Null when that count is old. | online |
growth | Members gained over the last 7 days (week) and 30 days (month). Below 0 when it shrank. | growth |
trend | How fast it grows for its size. The trending sort uses it. | growth |
createdAt | When the community was made on Root, or null when the Hub cannot tell. | created |
listedAt | When it was added to the Hub. | listed |
verified | True when its owner verified it on the Hub. | marks |
official | True when it is an official Root community. | marks |
adult | True when it is marked 18+. Only keys with the 18+ scope see these communities at all. | adult |
owner | Its owner's Root name and picture, or null when not known. | owner |
rootId | Root's own id for the community, as a UUID, or null when not known. | root_id |
Data and scopes
A key reads only what it was given, one scope at a time: the endpoints it may ask, and each piece of community data its answers show. Search, filters and sorts follow the same scopes, so a key cannot search descriptions it may not read or sort by member counts it cannot see. Ask for the scopes your app needs and no more.
Endpoints
- Hub totals
hub - How many communities and members the Hub lists, and each category with its count.
- List communities
communities - Page through the listed communities, with search, filters and sorting.
- One community
community - One community by its Hub address.
- Find by invite
lookup - The listed community behind a Root invite link or code.
- Member history
history - Member and online counts for each day, as far back as the key's history limit.
- Roles
roles - The roles a community shows on its page, with their colours and member counts.
- Comments
comments - The public discussion on a community page: names, text, times and replies.
Community data
- Name
name - The community's name. Also lets search match names, and the name sort.
- Logo and banner
pictures - Links to its logo and banner pictures.
- Description
description - The description its owner wrote, as plain text. Also lets search match descriptions.
- Category
category - Its category. Also lets the key filter by category.
- Tags
tags - Its tags. Also lets the key filter by tag, and search match tags.
- Invite link
invite - Its rootapp.gg invite link.
- Member count
members - How many members it has. Also the popular sort.
- Online count
online - How many members were online at the last count.
- Growth
growth - Members gained this week and month, and how fast it grows. Also the trending sort.
- Date of creation
created - When the community was made on Root.
- Date listed
listed - When it was added to the Hub. Also the newest-first sort.
- Verified marks
marks - Whether its owner verified it on the Hub, and whether it is an official Root community.
- Root ID
root_id - Root's own id for the community.
- Owner
owner - The owner's Root name and picture, as the community page shows them.
- 18+ communities
adult - Includes communities marked 18+, with an adult field. Without it they are left out of every answer.
The demo key may use Hub totals, and reads nothing.
Limits
Each key has its own limits for each endpoint, and an end date, set when it's made. Each endpoint counts on its own, so a busy list doesn't use up your lookups. Most keys get 20 a minute, 100 a day for each endpoint. Days are counted in UTC. Call /me to see your key's limits for each endpoint.
- Rate: requests a minute and a day, for each endpoint.
- Page size: the most communities, roles or comment threads one answer holds. Ask for less with
limit. - Most results: how deep your key can page into one list. Past it you get
key_limit; narrow the list withq,categoryortaginstead. - History: how far back member history goes for your key.
- Devices: a key works from one device (IP address) at a time, unless it was given more. Another device gets
device_limituntil the first has sent nothing for 15 minutes. An IPv6 device counts as its /64 network. Ask for more devices if your app runs on several servers. - Addresses: a key can be kept to a few IP addresses. From anywhere else it gets
ip_not_allowed.
The demo key allows 100 a minute, 3,000 a day for each endpoint and each visitor, at most 5 items an answer, the first 25 of a list, and history back 30 days.
Every answer says where your key stands:
| Header | What it says |
|---|---|
X-RateLimit-Limit | Requests to this endpoint allowed a minute. |
X-RateLimit-Remaining | How many are left this minute. |
X-RateLimit-Reset | Seconds until this minute's count frees up. |
X-RateLimit-Day-Limit | Requests to this endpoint allowed a day. |
X-RateLimit-Day-Remaining | How many are left today. |
Retry-After | With a 429 only: seconds to wait before trying again. |
Errors
A request that fails has an HTTP status and a body like this, with a code to check and a message to show:
{"error": {"code": "not_found", "message": "This community is not listed on the Hub."}}
| Status | Code | Why |
|---|---|---|
| 400 | bad_request | A parameter is missing or not one the endpoint takes. |
| 401 | missing_key | No key was sent. |
| 401 | bad_key | The key is not one the Hub gave out. |
| 401 | key_expired | The key reached its end date. |
| 401 | key_revoked | The key was ended for good. |
| 403 | key_paused | The key is paused for now. |
| 403 | demo_off | The demo key is turned off for now. |
| 403 | ip_not_allowed | The key only works from certain IP addresses, and this is not one of them. |
| 403 | device_limit | The key is in use from as many devices (IP addresses) as it may be at once. A device keeps its place until it has been quiet for 15 minutes. |
| 403 | missing_scope | The key may not use this endpoint, or read a field, filter or sort the request asks for. |
| 403 | key_limit | The request goes further than the key may: deeper into a list, or further back in history. |
| 404 | not_found | No such endpoint, or no listed community there. |
| 404 | closed | The API is closed for now. Keys work again once it opens. |
| 405 | method | The API only answers GET. |
| 429 | rate_limited | Too many requests to this endpoint this minute. Wait for Retry-After seconds. |
| 429 | daily_limit | The key used up today's requests to this endpoint (UTC). It starts again at midnight UTC. |
Using the data
- When you show the data, link to the community's Hub page (its
url) or to Root Hub. - Keep answers for a few minutes instead of asking again each time. The numbers don't change by the second.
- Keep your key private: not in public code, apps or web pages. If it leaks, ask for a new one and the old one stops working.
- Limits can change, and a key that's misused can be ended.
What is logged
For each request with a key, the Hub keeps the time, the address asked, the answer, how long it took, the IP address and the app name your client sends (its User-Agent), for 30 days. After that only daily totals for each key stay. They are used to keep the API fair and to stop misuse, never sold or shared. More on the privacy page.