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
OAuth2
OAuth2 required. Register an app at reddit.com/prefs/apps. Read-only access: use script type app with client_id:secret base64 encoded. Commercial use: contact Reddit.
Sample Requests
GET
Get subreddit posts
Get hot posts from r/programming (no auth needed for public data).
https://www.reddit.com/r/programming/hot.json?limit=5
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));
GET
Search Reddit
Search Reddit posts by keyword.
https://www.reddit.com/search.json?q=API development&sort=relevance&limit=5
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