Sources › Social media › Reddit › Subreddit
Subreddit API
Fetch posts from a subreddit.
Request
https://api.zapi.ink/v1/social-media:reddit/subreddit/:subSend your key in the x-api-key header. The response is JSON in the { project, data, timestamp } envelope, and an identical request is served from cache for 5 minutes.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| sub | string | path | Yes | Subreddit name (without the /r/ prefix) Example: programming |
| sort | enum: hot | new | top | rising | query | No | Listing sort order. Default hot Example: hot |
| time | enum: hour | day | week | month | year | all | query | No | Time window, only meaningful when sort=top Example: week |
| after | string | query | No | Cursor from a previous response's `after` field Example: t3_1vdnb3e |
Code examples
curl -X GET "https://api.zapi.ink/v1/social-media:reddit/subreddit/programming?sort=hot&time=week&after=t3_1vdnb3e" \ -H "x-api-key: zpi_xxxxxxxxxxxxxxxxxxxxxxxx"
const res = await fetch("https://api.zapi.ink/v1/social-media:reddit/subreddit/programming?sort=hot&time=week&after=t3_1vdnb3e", { method: "GET", headers: { "x-api-key": "zpi_xxxxxxxxxxxxxxxxxxxxxxxx" }, }); const data = await res.json(); console.log(data);
import requests res = requests.get( "https://api.zapi.ink/v1/social-media:reddit/subreddit/programming", params={"sort":"hot","time":"week","after":"t3_1vdnb3e"}, headers={"x-api-key":"zpi_xxxxxxxxxxxxxxxxxxxxxxxx"}, ) print(res.json())
Frequently asked questions
How do I call the Subreddit API?
Send a GET request to https://api.zapi.ink/v1/social-media:reddit/subreddit/programming with your Zapi key in the x-api-key header. Parameters — required: sub; optional: sort, time, after. The response is JSON in the { project, data, timestamp } envelope.
What does the Subreddit API return?
Fetch posts from a subreddit.
Is the Subreddit API free?
Yes. It is on the Zapi free tier: 600 Zap a month with one API key and no credit card. Each call costs 5 Zap. Paid plans raise the limits.
Can an AI assistant call the Subreddit API?
Yes. Add the Zapi MCP server (https://mcp.zapi.ink/mcp) to Claude, Cursor or another MCP client and ask in plain words; it calls run_scraper with scraper "reddit" and endpoint "subreddit".
What other Reddit API endpoints are there?
It has 3 endpoints. Besides Subreddit: User, Post.