API Documentation
Get Subreddit Links
Fetch the associated community links for a specific subreddit.
GET/api/r/[subreddit]
Retrieves the list of links (e.g., Discord, Lemmy, Matrix) associated with the specified subreddit name. The subreddit name is case-insensitive in the query but will be returned in its canonical (database) casing. Results are cached for 60 seconds.
Path Parameters
subreddit
(string, required): The name of the subreddit. Must be 3-21 characters long and contain only letters, numbers, or underscores.
Example Request
curl https://subharbor.com/api/r/example
Successful Response (200 OK)
Returns the subreddit name, an array of link objects, and the last updated timestamp.
{
"subreddit": "example",
"links": [
{ "type": "discord", "url": "https://discord.gg/example" },
{ "type": "lemmy", "url": "https://lemmy.world/c/example" }
],
"last_updated": "2025-04-24T16:00:00Z"
}
Link Object Properties
type
(string): The type of the link (e.g., "discord", "lemmy", "website").url
(string): The URL of the community link.
Other Properties
subreddit
(string): The canonical name of the subreddit.last_updated
(string): ISO 8601 timestamp indicating when the subreddit's links were last updated.
Error Responses
- 400 Bad Request: Returned if the
subreddit
parameter is missing or invalid (fails validation).{ "error": "Subreddit name must be between 3 and 21 characters long and contain only letters, numbers, or underscores." }
- 404 Not Found: Returned if the specified subreddit does not exist in the database.
{ "error": "Subreddit not found" }
- 500 Internal Server Error: Returned if there is a database error or other unexpected server issue.
{ "error": "Internal Server Error" }