# Mastodon Posts Scraper: Hashtags, Profiles and Servers (`nanodata/mastodon-posts-scraper`) Actor

Collect public Mastodon posts by hashtag, from public profiles or from the local timeline of any server: text, links, media, counts, tags, mentions and public author details. Pay per post.

- **URL**: https://apify.com/nanodata/mastodon-posts-scraper.md
- **Developed by:** [nanodata](https://apify.com/nanodata) (community)
- **Categories:** Social media
- **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 post delivereds

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 Posts Scraper

Collect public Mastodon posts by hashtag, from public profiles, or from the local timeline of a server. Each row is one post with its text, links, media, counts, hashtags, mentions and the public details of its author. You pay per post delivered.

The data comes from the public API that [Mastodon](https://joinmastodon.org/) servers such as [mastodon.social](https://mastodon.social/) offer for their public posts. No account, no login and no API key are needed. Only public posts are read. Direct messages, followers-only posts and private profile data are not available and are not collected.

### What you get

For each post the actor returns one row with:

- `id`, `url`, `uri`: the post id on the server it was read from, its web address, and its global address (the same on every server)
- `created_at`, `edited_at`: times in UTC (`edited_at` is null when the post was never edited)
- `content`, `content_text`: the post body as HTML and as plain text
- `spoiler_text`, `sensitive`, `language`, `visibility`: content warning, sensitive flag, language code, and visibility (always `public`)
- `replies_count`, `reblogs_count`, `favourites_count`, `quotes_count`: the counts shown on the post
- `tags`: hashtags in the post, with their addresses
- `mentions`: accounts mentioned, with `acct` and profile address
- `media_attachments`: type, address, preview address and alt text of each image, video or audio file
- `card`: the link preview (address, title, description, provider, image)
- `poll`: the poll summary (options with vote counts, total votes, expiry)
- `is_reblog`, `reblog`: for a boost, the post that was boosted
- `in_reply_to_id`, `in_reply_to_account_id`: the post and account this one replies to
- `account_id`, `account_username`, `account_acct`, `account_display_name`, `account_url`, `account_avatar`, `account_header`, `account_note` (profile text as plain text)
- `account_followers_count`, `account_following_count`, `account_statuses_count`, `account_bot`, `account_locked`, `account_group`, `account_created_at`, `account_last_status_at`, `account_fields` (the public profile fields)
- `sourceInstance`, `sourceType`, `sourceTag`, `sourceAccount`, `scrapedAt`: where the row was read from and when

A value the server does not show is null. Lists with nothing in them are empty.

### Typical uses

- Follow what people say about a topic, a product or an event
- Count posts, boosts and likes per hashtag over time
- Build a list of active accounts around a topic, with their public profile text and follower counts
- Archive the public posts of a profile
- Feed a dashboard, a spreadsheet or a language model with fresh public text

### Pricing

You pay per post delivered, plus a small fee for each run.

| Event | Name | Price |
|---|---|---|
| Run start (charged once, together with the first delivered row) | `actor-start` | $0.001 per run |
| One post row | `post-result` | $0.001 per post ($1.00 per 1,000) |

A run that finds nothing is not charged. If you set a maximum cost for the run, the actor stops cleanly once the next row would go over it.

**New to Apify?** Every account gets a $5 free monthly platform credit, enough for a first test run before you pay anything.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `hashtags` | list | empty | Hashtags without the # sign, for example `marketing` or `python` |
| `instances` | list | `mastodon.social` | Servers to read the hashtags from. Every hashtag is read on every server. Names only, for example `fosstodon.org` |
| `accounts` | list | empty | Public profiles as `@user@mastodon.social` or a profile address such as `https://mastodon.social/@user`. A name without a server uses the first server in `instances` |
| `includeLocalTimeline` | yes/no | no | Also read the public local timeline of each server |
| `maxPostsPerSource` | number | 100 | Maximum posts for each hashtag on each server, each profile and each local timeline. Up to 5,000 |
| `onlyOriginal` | yes/no | no | Leave out boosts |
| `language` | list | empty | Keep only these languages, for example `en` or `de`. Posts without a language tag are left out when this is set |

With no hashtag, profile or local timeline given, the actor reads the hashtag `marketing` on `mastodon.social` (40 posts) as a sample. A run can read up to 40 sources (hashtags times servers, plus profiles, plus local timelines).

Example: two hashtags, 60 posts each

```json
{
  "hashtags": ["marketing", "python"],
  "instances": ["mastodon.social"],
  "maxPostsPerSource": 60
}
```

Example: public profile and one server's local timeline

```json
{
  "accounts": ["@example_user@mastodon.example"],
  "includeLocalTimeline": true,
  "instances": ["fosstodon.org"],
  "maxPostsPerSource": 50,
  "onlyOriginal": true,
  "language": ["en"]
}
```

How it works: the actor reads each source page by page (40 posts per page), newest first, and takes turns between sources. The same post that shows up twice (for example on two servers) is delivered once. Servers limit how often they can be asked. The actor reads the limits the server reports and waits for the window to reset before it continues.

### Output sample

```json
{
  "id": "117569101702930712",
  "url": "https://example.com/2026/11/06/brand-guide/",
  "uri": "https://example.com/?p=339",
  "created_at": "2026-11-06T10:47:31.000Z",
  "edited_at": "2026-11-06T10:58:26.000Z",
  "content": "<p><strong>A Brand Guide</strong></p>...",
  "content_text": "A Brand Guide\n\nA strong brand starts with ...",
  "spoiler_text": null,
  "sensitive": false,
  "language": "en",
  "visibility": "public",
  "replies_count": 0,
  "reblogs_count": 2,
  "favourites_count": 5,
  "tags": [{"name": "marketing", "url": "https://mastodon.social/tags/marketing"}],
  "mentions": [],
  "media_attachments": [{"id": "117569140522189719", "type": "image", "url": "https://files.mastodon.social/.../original/f0b5b2365b4d8799.jpg", "preview_url": "https://files.mastodon.social/.../small/f0b5b2365b4d8799.jpg", "remote_url": null, "description": null}],
  "card": {"url": "https://example.com/", "title": "Example", "description": "...", "type": "link", "provider_name": "Example", "author_name": null, "image": null},
  "poll": null,
  "is_reblog": false,
  "reblog": null,
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "account_acct": "example_user@mastodon.example",
  "account_display_name": "Example",
  "account_followers_count": 2,
  "account_bot": false,
  "account_note": "Expert services for ...",
  "account_fields": [{"name": "Powered by", "value": "WordPress", "verified_at": null}],
  "sourceInstance": "mastodon.social",
  "sourceType": "tag",
  "sourceTag": "marketing",
  "sourceAccount": null,
  "scrapedAt": "2026-11-09T12:00:00Z"
}
```

### Limitations

- Only public posts. Posts that are unlisted, followers-only or direct are not collected, even when a server lists them.
- Some servers hide their public posts from visitors who are not logged in. Those sources are skipped, and the run status says so.
- A hashtag timeline on a server shows the posts that server knows about. It is not every post on the network. Read the same hashtag on several servers to widen the view.
- Counts are the values the server reports at the time of the run. Servers differ in what they report, so some fields can be null.
- The search function of Mastodon needs a login and is not used.

### FAQ

**Do I need a Mastodon account or an API key?**
No. The actor reads the public timelines that servers show to anyone.

**Can I read private or followers-only posts?**
No. Only public posts are collected, and the public profile details that the server shows with them.

**Which servers work?**
Any server that offers the public Mastodon API for its hashtag and profile timelines. Enter the server name, for example `mastodon.social`. Only https addresses of servers are accepted.

**Why do I get fewer posts than I asked for?**
The hashtag or profile held fewer public posts, a language filter removed some, or the run reached the page limit for one source. The run status tells how many posts were delivered and how many were skipped by a filter.

**Does it collect email addresses or messages?**
No. Direct messages and email addresses are not part of the public data. The profile text and profile fields appear as the author wrote them for the public.

**What happens when a server asks to slow down?**
The actor waits for the time the server reports and then continues. If the wait would be longer than a few minutes, it stops and keeps what it has delivered.

**How do I limit cost?**
Set `maxPostsPerSource` and the maximum cost for the run. The actor stops cleanly when the next row would go over the limit.

### Use with AI agents (MCP)

Connect this actor to any MCP-compatible AI client, such as Claude Desktop, Cursor, VS Code, LangChain or LlamaIndex.

**MCP server URL:**

```
https://mcp.apify.com?tools=nanodata/mastodon-posts-scraper
```

**Example prompt once connected:**

> "Use `mastodon-posts-scraper` to collect 30 recent public posts with the hashtag opensource from mastodon.social. Return results as a table."

### Related Actors

- [Bluesky Profiles and Posts Scraper](https://apify.com/nanodata/bluesky-profiles-posts-scraper): Find Bluesky profiles by keyword and collect posts from any profile.
- [Threads Scraper: Search Posts & Profiles, No Login](https://apify.com/santamaria-automations/threads-search-scraper): Search Threads posts by keyword or download any public profile's posts: text, author, likes, replies, reposts and time.
- [Reddit Scraper - $0.75/1k](https://apify.com/santamaria-automations/reddit-scraper): Scrape Reddit posts and comments from any subreddit, search query, or user profile.

### Support

Found a problem or need a field added? Open an issue on the [Issues tab](https://apify.com/nanodata/mastodon-posts-scraper/issues). We usually reply within one business day. You can also email contact@nanoscrape.com.

# Actor input Schema

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

Hashtags to collect, one per line, without the # sign, for example marketing or python. Leave all sources empty to get a sample (marketing).

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

Mastodon servers to read the hashtags from, for example mastodon.social. Every hashtag is read on every server. Default mastodon.social. Names only, https is always used.

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

Optional. Public profiles to read, one per line, in the form @user@mastodon.social or a profile address such as https://mastodon.social/@user. A name without a server uses the first server above.

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

Read the public local timeline of each server (all public posts written on that server) as an extra source.

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

Maximum posts for each hashtag on each server, each profile and each local timeline. Default 100.

## `onlyOriginal` (type: `boolean`):

Leave out boosts (reposts of another post). Useful for profiles.

## `language` (type: `array`):

Optional. Keep only posts in these languages, for example en or de. Posts without a language tag are left out when this is set.

## Actor input object example

```json
{
  "hashtags": [
    "marketing"
  ],
  "instances": [
    "mastodon.social"
  ],
  "includeLocalTimeline": false,
  "maxPostsPerSource": 100,
  "onlyOriginal": false
}
```

# Actor output Schema

## `defaultDataset` (type: `string`):

One row per post

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

// Run the Actor and wait for it to finish
const run = await client.actor("nanodata/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": ["marketing"],
    "instances": ["mastodon.social"],
}

# Run the Actor and wait for it to finish
run = client.actor("nanodata/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": [
    "marketing"
  ],
  "instances": [
    "mastodon.social"
  ]
}' |
apify call nanodata/mastodon-posts-scraper --silent --output-dataset

```

## MCP server setup

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