Reddit API
oauth.reddit.com · Social
Access Reddit posts, comments, subreddits, user data, and search. Free tier: 100 requests/minute. OAuth required for user actions; read-only access available without login.
Authentication
Sample Requests
Get hot posts from r/programming (no auth needed for public data).
Hover any highlighted part to learn what it does
curl -X GET "https://www.reddit.com/r/programming/hot.json?limit=5"
import requests
params = {
"limit": "5"
}
response = requests.get(
"https://www.reddit.com/r/programming/hot.json",
params=params,
)
print(response.json())const url = new URL('https://www.reddit.com/r/programming/hot.json');
url.searchParams.set('limit', '5');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.reddit.com/r/programming/hot.json")
q := baseURL.Query()
q.Set("limit", "5")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.reddit.com/r/programming/hot.json")
uri.query = URI.encode_www_form({
"limit" => "5"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.reddit.com/r/programming/hot.json?" . http_build_query([
"limit" => "5"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Search Reddit posts by keyword.
Hover any highlighted part to learn what it does
curl -X GET "https://www.reddit.com/search.json?q=API%20development&sort=relevance&limit=5"
import requests
params = {
"q": "API development",
"sort": "relevance",
"limit": "5"
}
response = requests.get(
"https://www.reddit.com/search.json",
params=params,
)
print(response.json())const url = new URL('https://www.reddit.com/search.json');
url.searchParams.set('q', 'API development');
url.searchParams.set('sort', 'relevance');
url.searchParams.set('limit', '5');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.reddit.com/search.json")
q := baseURL.Query()
q.Set("q", "API development")
q.Set("sort", "relevance")
q.Set("limit", "5")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.reddit.com/search.json")
uri.query = URI.encode_www_form({
"q" => "API development",
"sort" => "relevance",
"limit" => "5"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.reddit.com/search.json?" . http_build_query([
"q" => "API development",
"sort" => "relevance",
"limit" => "5"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Public read: add .json to any Reddit URL (no auth needed)
- Set User-Agent header — Reddit blocks requests without it
- For OAuth: register at reddit.com/prefs/apps → script type
- Hot posts: GET /r/{subreddit}/hot.json?limit=10
- Top of all time: /r/{subreddit}/top.json?t=all&limit=10
What can you build with Reddit API?
Reddit API is a Social API. Developers commonly use social APIs for:
- adding social login (Sign in with Google/Twitter)
- fetching user-generated content for analysis
- scheduling and publishing social posts
- tracking mentions and engagement metrics
- building community dashboards
OAuth 2.0. OAuth lets your app act on behalf of a user. You redirect them to authorise access, receive a token, then use that token in requests. Best for accessing user-owned data. Reddit API is free to use up to a usage limit, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide