Get a user's posts and comments
curl --request POST \
--url https://api.stophy.dev/v1/reddit/user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"user": "spez"
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({user: 'spez'})
};
fetch('https://api.stophy.dev/v1/reddit/user', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/reddit/user"
payload = { "user": "spez" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"items": [
{
"type": "post",
"url": "<string>",
"score": 0,
"comments": 0,
"isNsfw": true,
"isVideo": true,
"isPinned": true,
"id": "<string>",
"title": "<string>",
"text": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"subreddit": "<string>",
"upvotePercent": 50,
"createdAt": "2023-11-07T05:31:56Z",
"flair": "<string>",
"link": {
"url": "<string>",
"title": "<string>",
"description": "<string>",
"image": "<string>"
},
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"video": {
"url": "<string>",
"hls": "<string>",
"durationSeconds": 123
},
"poll": {
"options": [
{
"text": "<string>",
"votes": 0
}
],
"totalVotes": 0,
"endsAt": "2023-11-07T05:31:56Z"
},
"repostOf": {
"id": "<string>",
"url": "<string>",
"subreddit": "<string>",
"title": "<string>"
}
}
],
"user": {
"type": "user",
"url": "<string>",
"isVerified": true,
"id": "<string>",
"username": "<string>",
"postKarma": 0,
"commentKarma": 0,
"createdAt": "2023-11-07T05:31:56Z",
"avatar": "<string>"
},
"cursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}Reddit
Reddit user API
Call the Reddit user API to get user and items, as JSON or markdown. 2 credits.
POST
/
v1
/
reddit
/
user
Get a user's posts and comments
curl --request POST \
--url https://api.stophy.dev/v1/reddit/user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"user": "spez"
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({user: 'spez'})
};
fetch('https://api.stophy.dev/v1/reddit/user', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/reddit/user"
payload = { "user": "spez" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"items": [
{
"type": "post",
"url": "<string>",
"score": 0,
"comments": 0,
"isNsfw": true,
"isVideo": true,
"isPinned": true,
"id": "<string>",
"title": "<string>",
"text": "<string>",
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"subreddit": "<string>",
"upvotePercent": 50,
"createdAt": "2023-11-07T05:31:56Z",
"flair": "<string>",
"link": {
"url": "<string>",
"title": "<string>",
"description": "<string>",
"image": "<string>"
},
"thumbnail": "<string>",
"images": [
{
"url": "<string>",
"caption": "<string>",
"alt": "<string>"
}
],
"video": {
"url": "<string>",
"hls": "<string>",
"durationSeconds": 123
},
"poll": {
"options": [
{
"text": "<string>",
"votes": 0
}
],
"totalVotes": 0,
"endsAt": "2023-11-07T05:31:56Z"
},
"repostOf": {
"id": "<string>",
"url": "<string>",
"subreddit": "<string>",
"title": "<string>"
}
}
],
"user": {
"type": "user",
"url": "<string>",
"isVerified": true,
"id": "<string>",
"username": "<string>",
"postKarma": 0,
"commentKarma": 0,
"createdAt": "2023-11-07T05:31:56Z",
"avatar": "<string>"
},
"cursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}- Endpoint:
reddit.user - Returns:
datahasuser,items. - Cost: 2 credits. Failed calls cost nothing.
- Paging: Yes. Send the
cursorfrom the response to get the next page. See Paging.
Example
import { Stophy } from "stophy";
const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
const result = await stophy.reddit.user({ user: "spez" });
console.log(result.data.user);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.reddit.user(user="spez")
print(result["data"]["user"])
curl -X POST https://api.stophy.dev/v1/reddit/user \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"user":"spez"}'
stophy reddit user spez
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Available options:
overview, posts, comments Available options:
newest, hot, top, controversial Available options:
hour, day, week, month, year, all Required range:
1 <= x <= 100Required string length:
1 - 8192