# Mastodon Scraper: Profiles, Posts, Hashtags & Trends (`actor-forge/mastodon-scraper`) Actor

Scrape Mastodon and the fediverse from any instance's public API: profiles with follower counts and bio, posts with boosts, favourites, replies, hashtags, media and link cards, hashtag timelines, and trending tags, posts and links. Opt-outs honoured. No login. From $0.30 per 1,000 posts.

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

## Pricing

from $0.30 / 1,000 posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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: Profiles, Posts, Hashtags & Trends

Scrape Mastodon and the fediverse from any instance's public API: profiles with follower counts and bio, posts with boosts, favourites, replies, hashtags, media and link cards, hashtag timelines, and trending tags, posts and links. Opt-outs honoured. No login. From $0.30 per 1,000 posts.

**A Mastodon scraper for the whole fediverse, with no account.** Point it at any Mastodon (or Mastodon-compatible) server and get clean rows from the server's own public API: **profiles** with display name, bio, profile links (with verification), **follower, following and post counts**, last post date and bot/group flags; **posts** from accounts and **hashtag timelines** with text, content warning, language, **favourites, boosts, replies and quotes**, hashtags, mentions, media and link cards; and the server's **trending hashtags, posts and links** with daily and weekly usage. Filter by date, include or skip replies and boosts. Use it for **brand and topic monitoring**, open-source and tech community research, social listening beyond X, journalism and academic studies of the fediverse. **$0.30 per 1,000 posts or trends and $1 per 1,000 profiles**, with no compute bill on top; problems return a free status row instead of failing.

### What data does it return?

Every run outputs clean, schema-validated rows like these:

| type | handle | followersCount | text | name | authorHandle | usesToday |
| --- | --- | --- | --- | --- | --- | --- |
| profile | Mastodon@mastodon.social | 879015 |  |  |  |  |
| post |  |  | #Mastodon is getting a new look in our upcoming 5.0 release… |  | Mastodon@mastodon.social |  |
| trend |  |  |  | #VendrediLecture |  | 94 |

### How much does it cost?

Transparent pay-per-event pricing — you only pay for what you get, and the
actor **always respects your run budget**: set a maximum total charge and it
stops cleanly at the cap instead of overrunning.

| Event | Price | Charged | Worked example |
| --- | --- | --- | --- |
| `post` | $0.0003 | per post row | 1,000 posts = $0.30 |
| `profile` | $0.001 | per profile row | 100 profiles = $0.10 |
| `trend` | $0.0003 | per trending hashtag or link row | 20 trends = $0.006 |
| `apify-actor-start` | $0.00005 | per run per GB of memory (platform start fee) | One run at 256 MB = $0.00005 |

### Input options

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `instance` | string | no | `"mastodon.social"` | Mastodon server used for hashtags, trends and bare usernames, e.g. mastodon.social, fosstodon.org, mstdn.social. Accounts written as @user@server are read from their own server. |
| `accounts` | array | no | — | Accounts as @user@server, user@server or profile URLs (https://server/@user). Returns the profile and its latest posts. |
| `hashtags` | array | no | — | Hashtags (with or without #) whose public timeline on the instance you want, e.g. opensource, photography, rust. |
| `trends` | array | no | — | Optional: the instance's trending hashtags, posts and/or links. |
| `maxPostsPerSource` | integer | no | `40` | Newest posts to return per account and per hashtag. 0 returns profiles only. |
| `includeReplies` | boolean | no | `false` | Also return replies. |
| `includeBoosts` | boolean | no | `false` | Also return posts the account boosted (marked isBoost, with boostedBy). |
| `postedAfter` | string | no | — | Optional date (YYYY-MM-DD). Paging stops at the first older post. |
| `maxItems` | integer | no | `1000` | Upper limit on rows for the whole run. |

### Limits & honest notes

- **Responsible use:** posts and profiles are personal content. Follow each server's rules and data-protection law (GDPR/UK GDPR), use the data for research, monitoring and analytics, and never for spam or harassment. This actor is not affiliated with, endorsed by or sponsored by Mastodon gGmbH or any server.
- Consent is honoured: accounts that set noindex (asked not to be indexed) or did not opt in to searchable posts (indexable: false) are skipped together with their posts, and only public posts are returned. E-mail addresses and phone numbers are removed from bios and profile fields.
- It reads only each server's public REST API, checks robots.txt on every server, waits at least 1 s between requests per server and sends an honest user agent (ActorForge-Mastodon). There is no login, no cookies and no proxies. Requests to private or internal network addresses are refused.
- Some servers require a login for hashtag timelines or trends; those sources return a free status row and the run continues. Respects your run budget: set a maximum total charge and the run stops cleanly at the cap.

### Related ActorForge actors

- [Bluesky Profile Scraper](https://apify.com/actor-forge/bluesky-profile-scraper) — the same for Bluesky accounts
- [Dev Community Mentions](https://apify.com/actor-forge/dev-community-mentions) — keyword mentions across developer communities

### Changelog

- **2026-10-23** — Initial release: profiles, account posts, hashtag timelines, trending hashtags, posts and links on any instance; replies, boosts and date filters; noindex/indexable opt-outs honoured; free status rows.

***

*Built and maintained by **ActorForge**. Reliability first: every actor in the
portfolio is monitored by an automated nightly self-test, and breakages are
typically fixed the same day.*

# Actor input Schema

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

Mastodon server used for hashtags, trends and bare usernames, e.g. mastodon.social, fosstodon.org, mstdn.social. Accounts written as @user@server are read from their own server.

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

Accounts as @user@server, user@server or profile URLs (https://server/@user). Returns the profile and its latest posts.

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

Hashtags (with or without #) whose public timeline on the instance you want, e.g. opensource, photography, rust.

## `trends` (type: `array`):

Optional: the instance's trending hashtags, posts and/or links.

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

Newest posts to return per account and per hashtag. 0 returns profiles only.

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

Also return replies.

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

Also return posts the account boosted (marked isBoost, with boostedBy).

## `postedAfter` (type: `string`):

Optional date (YYYY-MM-DD). Paging stops at the first older post.

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

Upper limit on rows for the whole run.

## Actor input object example

```json
{
  "instance": "mastodon.social",
  "hashtags": [
    "opensource"
  ],
  "maxPostsPerSource": 20,
  "includeReplies": false,
  "includeBoosts": false,
  "maxItems": 1000
}
```

# Actor output Schema

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

Profiles (counts, bio, links), posts (text, engagement, hashtags, media, link card) and trending hashtags and links.

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

Rows delivered, requests made, whether the source refused a request, and billing.

# 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 = {
    "instance": "mastodon.social",
    "hashtags": [
        "opensource"
    ],
    "maxPostsPerSource": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("actor-forge/mastodon-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 = {
    "instance": "mastodon.social",
    "hashtags": ["opensource"],
    "maxPostsPerSource": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("actor-forge/mastodon-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 '{
  "instance": "mastodon.social",
  "hashtags": [
    "opensource"
  ],
  "maxPostsPerSource": 20
}' |
apify call actor-forge/mastodon-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,actor-forge/mastodon-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/EFZlgnfq0lAXXn3h2/builds/uwf7ZRMDUJbsDGm5T/openapi.json
