Reddit Integration
Validate Subreddit
Check if a subreddit exists and is accessible
POST
Validate Subreddit
Overview
This endpoint validates whether a subreddit name is valid and accessible via the Reddit API. It’s useful for validating user input before creating sessions or fetching content.Request Body
string
required
Subreddit name to validate. Can include
r/ prefix or not.Examples:"pics""r/aww""cats"
Response
boolean
Whether the subreddit is valid and accessible
string
Error message if validation failed
string
The normalized subreddit name (returned when valid)
Examples
Validate a Subreddit
Validate with r/ Prefix
Response Examples
Valid Subreddit
Invalid Subreddit
Empty Subreddit Name
Error Responses
Missing Subreddit Parameter
Status:400 Bad Request
Reddit Service Not Configured
Status:500 Internal Server Error
Validation Error
Status:500 Internal Server Error
Validation Logic
- Name Cleaning: Removes
r/prefix and trims whitespace - Empty Check: Rejects empty strings after cleaning
- Reddit API Check: Uses centralized Reddit service to verify subreddit exists and is accessible
- Normalization: Returns the cleaned, normalized subreddit name on success
Use Cases
- Form Validation: Validate subreddit input in real-time as users type
- Bulk Validation: Validate multiple subreddits before session creation
- Autocomplete: Confirm a subreddit exists before adding it to a list
- Error Prevention: Prevent invalid subreddits from being saved to sessions
Notes
- Subreddit names are case-insensitive
- The
r/prefix is optional and automatically stripped - Validation checks both existence and accessibility (some subreddits may be private or quarantined)
- The endpoint uses the centralized Reddit service, which handles API credentials and caching
- This endpoint does not require authentication