# Mastodon Posts & Hashtag Scraper (`dabooti/mastodon-posts-scraper`) Actor

Export public Mastodon posts by hashtag or account from any instance: text, author, date, language, likes, boosts, replies, hashtags, media and links. No login or API key.

- **URL**: https://apify.com/dabooti/mastodon-posts-scraper.md
- **Developed by:** [Danial Maqbool](https://apify.com/dabooti) (community)
- **Categories:** Social media, Marketing, News
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 posts

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Mastodon Posts & Hashtag Scraper

Export public Mastodon posts by hashtag or by account from any Mastodon server (mastodon.social, fosstodon.org, mstdn.social and thousands more). Get the post text, author, date, language, likes, boosts, replies, hashtags, mentions, media links and link previews as JSON, CSV or Excel.

It uses Mastodon's public REST API. No login, API key or proxy needed.

### What you can use it for

- **Hashtag monitoring**: follow a topic, event or campaign hashtag across the fediverse.
- **Brand and community tracking**: export every public post from your own or a competitor's account.
- **Research and datasets**: collect public posts with language tags and engagement counts for analysis or NLP.
- **Content curation**: find the most liked and boosted posts on a topic.

### What data you get

| Field | Description |
|---|---|
| `id`, `url`, `uri` | Post ID and links |
| `createdAt`, `editedAt` | Post and edit time (ISO 8601) |
| `text`, `spoilerText`, `sensitive` | Post text as plain text and content warning |
| `language` | Language tag set by the author |
| `favouritesCount`, `reblogsCount`, `repliesCount` | Likes, boosts and replies |
| `hashtags`, `mentions` | Hashtags and mentioned accounts |
| `mediaUrls`, `mediaTypes` | Attached images, videos or audio |
| `linkUrl`, `linkTitle` | Link preview card |
| `accountHandle`, `accountDisplayName`, `accountUrl`, `accountFollowers`, `accountIsBot` | Author |
| `isReply`, `inReplyToId`, `isBoost`, `boostedBy` | Thread and boost context |
| `source`, `sourceValue`, `instance`, `scrapedAt` | Which hashtag or account the post came from |

### How to use it

1. Set the **Mastodon instance** (default `mastodon.social`).
2. Add **Hashtags** and/or **Accounts** (`user@instance`, `@user@instance` or a profile URL).
3. Optionally filter by **Language** or **Posted on or after**, and choose whether to include replies and boosts.
4. Click **Start** and export from the **Output** tab.

#### Example input

```json
{
  "instance": "mastodon.social",
  "hashtags": ["opensource", "rustlang"],
  "accounts": ["Mastodon@mastodon.social", "https://fosstodon.org/@fosstodon"],
  "language": "en",
  "dateFrom": "2026-11-01",
  "maxPostsPerSource": 200
}
```

#### Example output

One record from a real run:

```json
{
  "source": "hashtag",
  "sourceValue": "opensource",
  "instance": "mastodon.social",
  "id": "117616123489683897",
  "url": "https://social.nerdzoom.media/@marius/117616123068406511",
  "uri": "https://social.nerdzoom.media/users/marius/statuses/117616123068406511",
  "createdAt": "2026-11-14T18:06:52.000Z",
  "editedAt": null,
  "language": "en",
  "text": "RE: https://marius.blog/steam-machine/\n\nI tested Valve’s “GabeCube” on the TV and at my desk. What impressed me most was the everyday Linux PC: quiet, compact, and happy to leave me alone to get some work done.\n\nThere’s a lot to like about having KDE Plasma one menu away from the console interface. The price and limited ports are harder to love.\n\n#SteamMachine #SteamOS #Linux #OpenSource #Gaming",
  "spoilerText": null,
  "sensitive": false,
  "repliesCount": 0,
  "reblogsCount": 0,
  "favouritesCount": 0,
  "hashtags": [
    "steammachine",
    "steamos",
    "linux",
    "opensource",
    "gaming"
  ],
  "mentions": [],
  "mediaUrls": [],
  "mediaTypes": [],
  "linkUrl": null,
  "linkTitle": null,
  "accountHandle": "marius@social.nerdzoom.media",
  "accountDisplayName": "Marius Quabeck 🔜 40C3",
  "accountUrl": "https://social.nerdzoom.media/@marius",
  "accountFollowers": 671,
  "accountIsBot": false,
  "isReply": false,
  "inReplyToId": null,
  "isBoost": false,
  "boostedBy": null,
  "scrapedAt": "2026-11-14T18:08:54.929Z"
}
```

### Pricing

Pay per event: **$1.00 per 1,000 posts** saved, plus a tiny standard start fee and Apify platform usage (usually a fraction of a cent per run). Set **Max cost per run** to cap spending.

### Tips and limits

- A hashtag timeline shows the posts the chosen instance knows about. Large instances such as mastodon.social see most of the fediverse; for niche communities, use their own instance.
- Up to 2,000 posts per hashtag or account per run. Use **Posted on or after** for regular monitoring runs.
- Mastodon has no public keyword search without login, so search works by hashtag or account.
- By default, hashtag posts from accounts that opted out of search indexing are skipped. Accounts you list by name are exported as requested.
- Only public posts are exported. Followers-only and direct messages are never returned by the public API.
- Instances rate-limit anonymous clients (usually 300 requests per 5 minutes); the Actor paces its requests and retries.

### FAQ

**Do I need a Mastodon account?** No. Hashtag timelines and public account posts are open to anonymous API clients on almost every instance.

**Why did an instance return nothing?** Some servers turn off public timeline access for logged-out visitors. Try another instance or the account's home server.

### Legal note

This Actor reads public posts through Mastodon's public API. Respect each instance's rules and the authors' rights, and handle any personal data in line with GDPR and other privacy laws.

# Actor input Schema

## `instance` (type: `string`):

Server used for hashtag timelines and for accounts given without a server, for example mastodon.social, fosstodon.org or mstdn.social.

## `hashtags` (type: `array`):

Hashtags to export from the instance's public hashtag timeline, with or without #.

## `accounts` (type: `array`):

Optional. Accounts whose public posts to export: user@instance, @user@instance or a profile URL such as https://mastodon.social/@Mastodon.

## `includeReplies` (type: `boolean`):

Also export posts that are replies.

## `includeBoosts` (type: `boolean`):

For accounts, also export posts the account boosted (reblogged).

## `language` (type: `string`):

Optional ISO 639-1 code such as en, de or ja. Only posts tagged with this language.

## `dateFrom` (type: `string`):

Optional date, YYYY-MM-DD. Paging stops at older posts.

## `skipNoIndexAccounts` (type: `boolean`):

Skip hashtag posts from accounts that opted out of search indexing. Recommended.

## `maxPostsPerSource` (type: `integer`):

Up to 2,000.

## Actor input object example

```json
{
  "instance": "mastodon.social",
  "hashtags": [
    "opensource"
  ],
  "includeReplies": false,
  "includeBoosts": false,
  "skipNoIndexAccounts": true,
  "maxPostsPerSource": 50
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `resultsFull` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "hashtags": [
        "opensource"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dabooti/mastodon-posts-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "hashtags": ["opensource"] }

# Run the Actor and wait for it to finish
run = client.actor("dabooti/mastodon-posts-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "hashtags": [
    "opensource"
  ]
}' |
apify call dabooti/mastodon-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dabooti/mastodon-posts-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NnSdFJ3xNh8jbqbDd/builds/iltdMnzHePQNEUrHG/openapi.json
