Get posts for a hashtag
curl --request POST \
--url https://api.stophy.dev/v1/mastodon/hashtag \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hashtag": "caturday",
"limit": 40
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({hashtag: 'caturday', limit: 40})
};
fetch('https://api.stophy.dev/v1/mastodon/hashtag', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/mastodon/hashtag"
payload = {
"hashtag": "caturday",
"limit": 40
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"posts": [
{
"url": "<string>",
"isSensitive": true,
"replies": 0,
"reposts": 0,
"likes": 0,
"quotes": 0,
"id": "<string>",
"uri": "<string>",
"text": "<string>",
"html": "<string>",
"spoiler": "<string>",
"language": "<string>",
"visibility": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"editedAt": "2023-11-07T05:31:56Z",
"replyTo": {
"id": "<string>",
"url": "<string>",
"username": "<string>"
},
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"repostedBy": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"hashtags": [
"<string>"
],
"mentions": [
"<string>"
],
"media": [
{
"url": "<string>",
"type": "<string>",
"thumbnail": "<string>",
"description": "<string>"
}
],
"link": {
"url": "<string>",
"title": "<string>",
"description": "<string>",
"image": "<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
}
}Mastodon
Mastodon hashtag API
Call the Mastodon hashtag API to get uri, text, html, spoiler, language and visibility, as JSON or markdown. 1 credit per 20 items, at least 1 credit.
POST
/
v1
/
mastodon
/
hashtag
Get posts for a hashtag
curl --request POST \
--url https://api.stophy.dev/v1/mastodon/hashtag \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hashtag": "caturday",
"limit": 40
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({hashtag: 'caturday', limit: 40})
};
fetch('https://api.stophy.dev/v1/mastodon/hashtag', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/mastodon/hashtag"
payload = {
"hashtag": "caturday",
"limit": 40
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"posts": [
{
"url": "<string>",
"isSensitive": true,
"replies": 0,
"reposts": 0,
"likes": 0,
"quotes": 0,
"id": "<string>",
"uri": "<string>",
"text": "<string>",
"html": "<string>",
"spoiler": "<string>",
"language": "<string>",
"visibility": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"editedAt": "2023-11-07T05:31:56Z",
"replyTo": {
"id": "<string>",
"url": "<string>",
"username": "<string>"
},
"author": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"repostedBy": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"hashtags": [
"<string>"
],
"mentions": [
"<string>"
],
"media": [
{
"url": "<string>",
"type": "<string>",
"thumbnail": "<string>",
"description": "<string>"
}
],
"link": {
"url": "<string>",
"title": "<string>",
"description": "<string>",
"image": "<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:
mastodon.hashtag - Returns:
datahasposts. - Cost: 1 credit per 20 items, at least 1 credit. 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.mastodon.hashtag({ hashtag: "caturday", limit: 40 });
console.log(result.data.posts);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.mastodon.hashtag(hashtag="caturday", limit=40)
print(result["data"]["posts"])
curl -X POST https://api.stophy.dev/v1/mastodon/hashtag \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"hashtag":"caturday","limit":40}'
stophy mastodon hashtag caturday --limit 40
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json