# Mastodon Scraper - Hashtags, Accounts, Trends & Monitor (`martin10291/mastodon-hashtag-monitor`) Actor

Mastodon scraper for hashtags, accounts, trending tags and links, and replies across several instances. No API key, no login, no proxy: official open Mastodon API. Only-new mode turns it into a brand and keyword monitor for the fediverse. $0.80 per 1000 results.

- **URL**: https://apify.com/martin10291/mastodon-hashtag-monitor.md
- **Developed by:** [Martin Petrov](https://apify.com/martin10291) (community)
- **Categories:** Social media, Lead generation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.56 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Scraper - Hashtags, Accounts, Trends & Keyword Monitor

Collect **Mastodon posts by hashtag or account**, trending hashtags and links, and the replies to each post, across one or many instances. Turn on the only-new mode and it works as a **brand, keyword or hashtag monitor for the fediverse**.

It uses the official public Mastodon REST API: no login, no API key, no browser. **$0.80 per 1000 results, no start fee.**

### What you get

- **Hashtag posts** from every instance you list (mastodon.social, fosstodon.org, ...). Same hashtag on several servers gives wider coverage.
- **Account posts**: public posts of accounts you name (`user@server` or a profile URL). Boosts and replies are left out.
- **Trends**: trending hashtags and trending links per instance, with uses and accounts over the last days.
- **Replies**: the public replies under each post (optional, capped per post).
- **Filters**: keywords, language, max results.
- **Only-new monitoring**: schedule the actor and every run returns only posts you have not received before.
- **Official API**: no HTML parsing that breaks when a page changes. Requests are sequential and small, and the actor waits when a server rate-limits it.

### Input

| Field | Type | Description |
|---|---|---|
| `instances` | array | Mastodon servers to read. Default `["mastodon.social"]`. |
| `hashtags` | array | Hashtags, with or without `#`. Default `["python"]`. |
| `accounts` | array | `user@server` or a profile URL. |
| `keywords` | array | Keep only posts containing any of these words (not case sensitive). |
| `language` | string | ISO code such as `en`, `de`, `bg`. |
| `maxItems` | integer | Hard limit on rows saved (and paid for). Default `50`. |
| `includeTrends` | boolean | Add trending hashtags and links of every instance. |
| `includeLocalTimeline` | boolean | Also read each server's local timeline (many servers need a login for it and are skipped). |
| `includeReplies` | boolean | Save public replies to each post. |
| `maxRepliesPerPost` | integer | Default `20`. |
| `onlyNew` | boolean | Monitoring mode. |
| `monitorId` | string | Separate memory per tracked search. |

With no input the actor reads the latest `#python` posts from mastodon.social and returns results in a few seconds.

#### Example: brand monitor across three servers

```json
{
  "instances": ["mastodon.social", "fosstodon.org", "hachyderm.io"],
  "hashtags": ["opensource", "selfhosted"],
  "keywords": ["nextcloud", "immich"],
  "onlyNew": true,
  "monitorId": "my-brand",
  "maxItems": 200
}
```

#### Example: an account with replies and trends

```json
{
  "accounts": ["Gargron@mastodon.social"],
  "includeReplies": true,
  "maxRepliesPerPost": 10,
  "includeTrends": true,
  "maxItems": 100
}
```

### Output

Every row has a `type`: `post`, `reply`, `trend_tag` or `trend_link`.

```json
{
  "type": "post",
  "id": "117571159409678569",
  "url": "https://social.example/@someone/117571158955182260",
  "text": "Plain text of the post ...",
  "html": "<p>Plain text of the post ...</p>",
  "createdAt": "2026-11-06T19:31:54Z",
  "language": "en",
  "author": "someone@social.example",
  "authorName": "Some One",
  "authorUrl": "https://social.example/@someone",
  "repliesCount": 2,
  "reblogsCount": 5,
  "favouritesCount": 11,
  "hashtags": ["python", "opensource"],
  "mediaUrls": [],
  "cardUrl": "https://example.org/article",
  "instance": "mastodon.social",
  "sourceHashtag": "python",
  "scrapedAt": "2026-11-06T20:00:00Z"
}
```

Replies carry the same fields plus `postId`, `postUrl` and `inReplyToId`. Account posts have `sourceAccount` instead of `sourceHashtag`. Trend rows have `name` or `title`, `url`, `uses`, `accounts` and a daily `history`. Values above are illustrative.

Only public fields from the post are saved (account name, display name, profile link). The actor does not visit profiles or collect follower lists.

### Monitor new posts (only-new mode)

1. Fill in instances, hashtags and (optional) keywords.
2. Turn on `onlyNew` and set a `monitorId` such as `my-brand`.
3. Save as a task and add a schedule (hourly or daily).
4. Every run returns only posts not returned before under that `monitorId`. Connect the dataset to Slack, email, Make, Zapier or a webhook.

Use a different `monitorId` for each search. If a run hits `maxItems` before the end of the list, the rest is still new and comes with the next run. Trend rows are a snapshot and are returned on every run.

### Call it from code

```bash
curl -X POST "https://api.apify.com/v2/acts/martin10291~mastodon-hashtag-monitor/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"instances": ["mastodon.social"], "hashtags": ["python"], "keywords": ["django"], "onlyNew": true, "monitorId": "my-brand", "maxItems": 50}'
```

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("martin10291/mastodon-hashtag-monitor").call(run_input={"instances": ["mastodon.social"], "hashtags": ["python"], "keywords": ["django"], "onlyNew": True, "monitorId": "my-brand", "maxItems": 50})
items = client.dataset(run["defaultDatasetId"]).list_items().items
```

Schedule it hourly or daily in Apify Console (Schedules) with `onlyNew` to get only new items each time, or use it as a tool for AI agents through the Apify MCP server.

### Pricing

$0.80 per 1000 results (posts, replies and trend rows), no start fee. Filters run before saving, so filtered-out posts are free. Use `maxItems` to cap a run.

### Limits (please read)

- **Keyword search is a filter, not a search engine.** Mastodon's full-text search for posts needs a login on most servers. Keywords therefore filter the posts fetched from your hashtags and accounts. A post is only found if it carries one of your hashtags or comes from one of your accounts. To monitor a brand, track its hashtags plus a few related ones, on several instances.
- Hashtag timelines show posts that the chosen server knows about. A small server sees fewer posts than a large one; list several instances for wider coverage.
- Hashtag timelines go back a limited time on busy tags (the API pages through roughly the latest 1200 posts per source).
- Local timelines and some other endpoints may need a login on certain servers. Those sources are skipped and the reason is in the run summary.
- Private and followers-only posts are not available. Servers can also rate-limit; the actor waits and retries, and long waits can make a run slower.
- `accounts` in trend rows is the sum of the daily account counts, so the same person can count on several days.
- Posts can contain personal data. Process them in line with GDPR and the rules of the servers you read.

The `RUN_SUMMARY` record shows posts, replies, skipped posts and errors per source, plus `lastError`.

### Use it as an integration (chain it after another actor)

This actor can run after any actor whose results contain Mastodon profile links.

1. Open the source actor in Apify Console and go to the **Integrations** tab.
2. Click **Add integration** -> **Actor**, pick this actor and set **Dataset** to `{{resource.defaultDatasetId}}` (leave `accounts` empty).
3. When the source run finishes, this actor reads its dataset and fetches the posts of those accounts. Set **Dataset field** if your column has another name.

### More Actors by Martin Petrov

- **[YouTube Channel Monitor (New Videos & Shorts)](https://apify.com/martin10291/youtube-channel-monitor)**: Only new videos, Shorts and streams from many channels.
- **[Google Trends Scraper](https://apify.com/martin10291/google-trends-explorer)**: Interest over time, regions and related queries for many keywords.
- **[Remote Jobs Scraper (8 Job Boards)](https://apify.com/martin10291/remote-jobs-aggregator-pro)**: Remote jobs from RemoteOK, Remotive, We Work Remotely and more, deduplicated.
- **[Local Business Leads Finder (Emails, Phones)](https://apify.com/martin10291/local-business-leads-osm)**: Local businesses by category and city with emails, phones and websites.

### FAQ

**How fresh is the data?** Live: every run reads the public Mastodon API of each server at run time.

**Can it search any word?** Full-text search needs a login on Mastodon, so `keywords` filters the posts fetched from your hashtags and accounts (see Limits).

**Does it need a login, key or proxy?** No. It uses the official public Mastodon API with a normal, honest client and respects rate limits.

**What if a server fails?** The run continues with the other sources and the error is in `RUN_SUMMARY.lastError`.

**Can AI agents use it?** Yes. Add it as a tool through the Apify MCP server (mcp.apify.com) and your AI agent can read hashtags, accounts and trends.

# Actor input Schema

## `instances` (type: `array`):

Mastodon servers to read from, for example mastodon.social or fosstodon.org. Hashtag posts are read from each instance's public timeline, so more instances give wider coverage. Accounts without a server use the first instance.

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

Hashtags to read, with or without the # sign, for example python or opensource. Each hashtag is read on every instance listed above.

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

Accounts whose public posts you want, as user@server (Gargron@mastodon.social) or a profile URL (https://mastodon.social/@Gargron). Boosts and replies are left out.

## `keywords` (type: `array`):

Optional. Keep only posts whose text contains any of these words or phrases (not case sensitive). Mastodon has no public full-text search, so keywords filter the posts fetched from your hashtags and accounts.

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

Optional. Keep only posts written in this language, for example en, de or bg. Empty = all languages.

## `maxItems` (type: `integer`):

Hard limit on rows saved (and paid for): posts, replies and trend rows together. Posts are shared equally between the hashtags and accounts.

## `includeTrends` (type: `boolean`):

Also save the trending hashtags and trending links of every instance, with their usage in the last days. Trend rows are a snapshot and are not affected by only-new mode.

## `includeLocalTimeline` (type: `boolean`):

Also read the public local timeline of every instance (posts by that server's own users). Many servers require a login for this and are then skipped with a note in the run summary.

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

Also save the public replies to each post. Each reply is one result.

## `maxRepliesPerPost` (type: `integer`):

Replies saved for each post that has replies.

## `onlyNew` (type: `boolean`):

Return only posts and replies not returned in earlier runs with the same monitor ID. Schedule the actor to track brands, keywords or hashtags.

## `monitorId` (type: `string`):

Name of the memory used by monitoring mode. Use a different ID for each search you track.

## `datasetId` (type: `string`):

Optional. Pick a dataset (or paste its ID) to read the input from, for example the result of Google Maps Scraper. When this actor runs as an integration, the dataset of the triggering run is used automatically (payload.resource.defaultDatasetId), so you can leave this empty. If set, the values found in the dataset replace the main input list.

## `datasetField` (type: `string`):

Optional. The item field that holds the value, for example website, url or videoUrl (dot paths like author.url work). Empty = detected automatically.

## `datasetMaxItems` (type: `integer`):

Upper limit of unique values taken from the dataset, to keep the cost under control.

## Actor input object example

```json
{
  "instances": [
    "mastodon.social"
  ],
  "hashtags": [
    "python"
  ],
  "maxItems": 50,
  "includeTrends": false,
  "includeLocalTimeline": false,
  "includeReplies": false,
  "maxRepliesPerPost": 20,
  "onlyNew": false,
  "monitorId": "default",
  "datasetMaxItems": 1000
}
```

# Actor output Schema

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

One row per post, reply, trending hashtag or trending link.

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

Per-source counts, skipped posts and errors.

# 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 = {
    "instances": [
        "mastodon.social"
    ],
    "hashtags": [
        "python"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("martin10291/mastodon-hashtag-monitor").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 = {
    "instances": ["mastodon.social"],
    "hashtags": ["python"],
}

# Run the Actor and wait for it to finish
run = client.actor("martin10291/mastodon-hashtag-monitor").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 '{
  "instances": [
    "mastodon.social"
  ],
  "hashtags": [
    "python"
  ]
}' |
apify call martin10291/mastodon-hashtag-monitor --silent --output-dataset

```

## MCP server setup

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

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/hHzSOGIOqsBLRaZzj/builds/djcGahELu3Ad0iAGg/openapi.json
