# Mastodon Posts Scraper - Hashtags, Accounts, Timelines (`pinkish_gallop/mastodon-posts-scraper`) Actor

Scrape public Mastodon posts from any instance via the official REST API: hashtag timelines, account statuses and the public/local timeline, with text, engagement counts, tags, media and author stats. Since-date for incremental monitoring. No login, no proxy.

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

## Pricing

Pay per event

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 - Hashtags, Accounts, Timelines

Scrape public Mastodon posts from any instance via the official REST API: hashtag timelines, account statuses and the public/local timeline, with text, engagement counts, tags, media and author stats. Since-date for incremental monitoring. No login, no proxy.

### What does this Actor do?

Mastodon and the wider fediverse host millions of developers, journalists, scientists and open-source communities who left X/Twitter. Every Mastodon server exposes a public **REST API**, and this Actor uses it to collect public posts from hashtag timelines, specific accounts and the public timeline - with clean text, engagement counts, hashtags, mentions, media and author stats. No account, token or browser is needed.

Key features:

- Plain HTTP against official public endpoints - no browser, no proxy, no login, runs on 128 MB memory.
- Pay only for results: one charge per row saved; your maximum charge per run is always respected.
- `maxItems` hard cap (default 100) and bounded pagination - runs can never loop forever.
- Incremental mode via a since-date so scheduled runs only fetch new data.
- Polite rate limiting, retries with exponential backoff and `Retry-After` support.
- Clean, flat, consistently named JSON fields ready for Excel, Google Sheets, BigQuery or your API.

### Who is it for?

- **Brand and keyword monitoring** - follow hashtags about your product, open-source project or industry.
- **Developer relations** - see what the tech crowd on fosstodon.org, hachyderm.io or infosec.exchange is saying.
- **Academic research** - collect public posts for discourse and network analysis.
- **Lead discovery** - find active accounts posting about a topic and their follower counts.
- **Cross-posting archives** - back up your own account's public posts.

### How it works

Each source is paged with Mastodon's `max_id` cursor, 40 posts per request. Requests are spaced by `delayMs` (1 s default, well under the 300 requests per 5 minutes per-IP limit) and retried on 429/5xx honouring `Retry-After`. Posts are deduplicated across sources. With `sinceDate`, pagination stops as soon as older posts appear, so scheduled runs only fetch what is new.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `instance` | string | "mastodon.social" | Mastodon server domain, e.g. mastodon.social, fosstodon.org, hachyderm.io. |
| `hashtags` | array | - | Without # (e.g. opensource). |
| `accounts` | array | \[] | user, user@instance or profile URL. |
| `searchQueries` | array | \[] | Full-text status search only works where the instance allows anonymous search; single words fall back to the hashtag timeline. |
| `includePublicTimeline` | boolean | false | Also scrape the federated (or local) public timeline. |
| `localOnly` | boolean | false | Restrict tag/public timelines to posts from this instance. |
| `maxItems` | integer | 100 | Hard cap on posts saved and charged. |
| `maxItemsPerSource` | integer | 0 | 0 = no per-source cap. |
| `sinceDate` | string | - | ISO date/time; pagination stops once older posts appear. |
| `excludeReplies` | boolean | false | Exclude replies |
| `excludeReblogs` | boolean | true | Exclude boosts |
| `language` | string | "" | ISO 639-1 code filter, e.g. en. Empty = all. |
| `delayMs` | integer | 1000 | Mastodon default limit is 300 req / 5 min per IP. |

#### Example input

```json
{
  "instance": "fosstodon.org",
  "hashtags": [
    "rust",
    "selfhosted"
  ],
  "accounts": [
    "Gargron@mastodon.social"
  ],
  "maxItems": 300,
  "sinceDate": "2026-10-20",
  "excludeReblogs": true
}
```

### Output

Each result is one row in the default dataset. You can download it as JSON, CSV, Excel, XML or HTML, or read it through the Apify API. A real row from a test run on 26 October 2026:

```json
{
  "postId": "117503344276979464",
  "url": "https://mastodon.social/@inautilo/117503344276979464",
  "source": "tag:opensource",
  "instance": "mastodon.social",
  "createdAt": "2026-10-25T20:05:44.469Z",
  "content": "#Development #Satires\nThat’s what I call technical debt · 15 hits about unpaid maintainers and overconfident AI agents https://ilo.im/16gxw7\n_____\n#Maintenance #OpenSource #AI #TechDebt #DevOps #WebDev #Frontend #Backend",
  "spoilerText": null,
  "language": "en",
  "visibility": "public",
  "isReblog": false,
  "isReply": false,
  "inReplyToId": null,
  "repliesCount": 0,
  "reblogsCount": 0,
  "favouritesCount": 0,
  "tags": [
    "development",
    "satires",
    "maintenance",
    "opensource",
    "ai",
    "techdebt",
    "devops",
    "webdev",
    "frontend",
    "backend"
  ],
  "mentions": [],
  "media": [],
  "cardUrl": "https://ilo.im/16gxw7",
  "accountAcct": "inautilo",
  "accountName": "Inautilo",
  "accountUrl": "https://mastodon.social/@inautilo",
  "accountFollowers": 556,
  "accountBot": false
}
```

### Tips

- Hashtag timelines on a big instance (mastodon.social) include federated posts from many servers.
- Use `localOnly` to focus on one community's own members.
- Accounts can be given as `user`, `user@server` or a profile URL.
- Combine `language` with hashtags to filter noisy multilingual tags.

### Pricing

This Actor uses pay-per-event pricing: about **$0.50 per 1,000 results**. There is no monthly rental fee. Platform usage is minimal because the Actor runs on 128 MB with plain HTTP requests. Set **Maximum cost per run** in the run options and the Actor stops cleanly as soon as the limit is reached - you are never charged beyond it.

### Scheduling and integrations

Create an Apify Schedule (for example daily at 08:00) and pass a since-date to get only new items each time. Connect the dataset to Google Sheets, Slack, Zapier, Make, n8n or a webhook to receive results automatically, or call the Actor from Python or JavaScript using the Apify API client.

### Limitations

Only public posts are returned. Most instances disable anonymous full-text status search; single-word queries automatically fall back to the hashtag timeline. Some instances restrict public timelines to logged-in users - choose another instance in that case.

### FAQ

**Do I need an account or API key on the source site?** No. Only public, unauthenticated endpoints are used.

**Do I need proxies?** No. The Actor makes a small number of well-spaced requests to official APIs, so datacenter IPs work fine.

**Why did my run return fewer items than maxItems?** The source simply had no more items matching your filters and date range, or your maximum cost per run was reached.

**Is this legal?** The Actor only reads publicly available data through documented public endpoints. You are responsible for using the data in line with the source's terms and applicable laws such as GDPR, especially for personal data.

**Something broke?** Open an issue on the Actor's Issues tab with your run ID and we will fix it quickly.

# Actor input Schema

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

Mastodon server domain, e.g. mastodon.social, fosstodon.org, hachyderm.io.

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

Without # (e.g. opensource).

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

user, user@instance or profile URL.

## `searchQueries` (type: `array`):

Full-text status search only works where the instance allows anonymous search; single words fall back to the hashtag timeline.

## `includePublicTimeline` (type: `boolean`):

Also scrape the federated (or local) public timeline.

## `localOnly` (type: `boolean`):

Restrict tag/public timelines to posts from this instance.

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

Hard cap on posts saved and charged.

## `maxItemsPerSource` (type: `integer`):

0 = no per-source cap.

## `sinceDate` (type: `string`):

ISO date/time; pagination stops once older posts appear.

## `excludeReplies` (type: `boolean`):

No description

## `excludeReblogs` (type: `boolean`):

No description

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

ISO 639-1 code filter, e.g. en. Empty = all.

## `delayMs` (type: `integer`):

Mastodon default limit is 300 req / 5 min per IP.

## Actor input object example

```json
{
  "instance": "mastodon.social",
  "hashtags": [
    "opensource"
  ],
  "accounts": [],
  "searchQueries": [],
  "includePublicTimeline": false,
  "localOnly": false,
  "maxItems": 100,
  "maxItemsPerSource": 0,
  "excludeReplies": false,
  "excludeReblogs": true,
  "language": "",
  "delayMs": 1000
}
```

# Actor output Schema

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

No description

## `resultsView` (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("pinkish_gallop/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("pinkish_gallop/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 pinkish_gallop/mastodon-posts-scraper --silent --output-dataset

```

## MCP server setup

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