# Mastodon Profile Posts Scraper (`zerobreak/mastodon-profile-posts-scraper`) Actor

Mastodon Profile Posts Scraper is a Python tool to extract public statuses, author bios, follower counts, timestamps, and engagement metrics from Mastodon user profile endpoints. It exports normalized decentralized social media data into clean CSV or JSON formats

- **URL**: https://apify.com/zerobreak/mastodon-profile-posts-scraper.md
- **Developed by:** [ZeroBreak](https://apify.com/zerobreak) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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 Profile and Posts Scraper — Account Information and Recent Public Posts

![Mastodon Profile and Posts Scraper cover](https://images.bigibyte.com/cdn-cgi/image/width=1260,height=540,fit=cover,format=webp/apify-actors-covers/mastodon-profile-posts-scraper-cover.png)

### Overview

Look up Mastodon accounts and optionally collect their recent public posts from any supported Mastodon instance. Provide an instance hostname, enter one or more usernames, and choose whether to include posts.

Collect structured profile information such as account IDs, usernames, display names, follower counts, and profile links. Export the results as JSON, CSV, Excel, or other supported Apify dataset formats.

### Features

- Look up multiple Mastodon accounts in one run.
- Collect account IDs, usernames, and display names.
- Retrieve account creation dates and bot indicators.
- Extract follower, following, and status counts.
- Collect public profile links.
- Optionally retrieve recent public posts.
- Deduplicate collected records.
- Control the total number of output records.
- Support different Mastodon instance hosts.

### Collection Mode

| Mode | Description |
|---|---|
| `profileLookup` | Looks up account profiles using the supplied usernames. Optionally collects recent public posts when `includePosts` is enabled. |

### Input Parameters

| Parameter | Description | Example |
|---|---|---|
| `mode` | Collection mode. | `profileLookup` |
| `instance` | Mastodon instance hostname. | `mastodon.social` |
| `accounts` | Array of Mastodon usernames to look up. | `["Gargron"]` |
| `includePosts` | Whether to collect recent public posts for each account. | `false` |
| `maxItems` | Maximum number of records to collect. | `50` |
| `requestDelaySecs` | Delay between requests in seconds. | `1` |

### Example Input

```json
{
  "mode": "profileLookup",
  "instance": "mastodon.social",
  "accounts": ["Gargron"],
  "includePosts": false,
  "maxItems": 50,
  "requestDelaySecs": 1
}
```

To collect recent public posts as well, set `includePosts` to `true`.

### What Data Does This Actor Extract?

The actor produces profile records and, when enabled, public post records.

**Profile records**

| Field | Description |
|---|---|
| `recordType` | Identifies the record as a profile. |
| `accountId` | Unique Mastodon account identifier. |
| `username` | Account username. |
| `acct` | Mastodon account handle. |
| `displayName` | Account display name. |
| `bot` | Indicates whether the account is marked as a bot. |
| `createdAt` | Account creation date. |
| `followersCount` | Number of followers. |
| `followingCount` | Number of accounts followed. |
| `statusesCount` | Number of statuses published by the account. |
| `url` | Public profile link. |
| `scraped_at` | Date and time the record was collected. |

When `includePosts` is enabled, the actor also collects recent public statuses. Post records contain post information returned by the selected Mastodon instance.

### Example Output

```json
{
  "recordType": "profile",
  "accountId": "1",
  "username": "Gargron",
  "acct": "Gargron",
  "displayName": "Eugen Rochko",
  "bot": false,
  "createdAt": "2016-03-16T00:00:00.000Z",
  "followersCount": 383119,
  "followingCount": 748,
  "statusesCount": 82482,
  "url": "https://mastodon.social/@Gargron",
  "scraped_at": "2026-10-26T00:00:00+00:00"
}
```

### Use Cases

- **Creator research:** Review profile information and follower counts for selected Mastodon accounts.
- **Social listening:** Collect recent public posts for content and topic analysis.
- **Instance research:** Compare account information across different Mastodon instances.
- **Community analysis:** Examine account activity and public posting patterns.
- **Research exports:** Save profile and post records in spreadsheets or structured datasets.
- **Social media monitoring:** Refresh selected account information periodically.

### Working with Your Dataset

Export collected records as JSON, CSV, Excel, or another supported Apify dataset format.

You can use the results to:

- Build Mastodon account directories.
- Compare follower and following counts.
- Organize profiles by instance and username.
- Analyze recent public posts.
- Import account and post information into research databases.

### FAQ

**Who is this actor for?**

It is designed for researchers, journalists, marketers, and developers who need structured public Mastodon account information and recent posts.

**What can I export?**

You can export records as JSON, CSV, Excel, and other supported Apify dataset formats.

**Can I collect posts as well as profile information?**

Yes. Set `includePosts` to `true` to collect recent public posts for the selected accounts.

**Can I look up accounts on different Mastodon instances?**

Yes. Enter the desired instance hostname in the `instance` field.

**How many records can it collect per run?**

You can collect up to 1,000 records per run. Use `maxItems` to control the collection size.

**Can I run it on a schedule?**

Yes. You can configure an Apify schedule to refresh account information and collect recent posts periodically.

### Disclaimer

This is an independent data collection tool and is not affiliated with, endorsed by, sponsored by, or officially associated with Mastodon. It collects publicly available account information and posts. Users are responsible for respecting instance rules, applicable privacy laws, and copyright requirements when accessing, storing, or reusing collected content.

### Is Web Scraping Legal?

Collecting information that is already public is generally legal. There is no single law that bans all forms of web scraping. The limits are the usual ones: do not break into accounts, do not take private or confidential data, and be careful with personal data and copyrighted works. A site's terms can also restrict how you access it. Facts such as a public name, price, or rating are not the same thing as republishing someone's article or photo.

This actor collects information from public pages. It does not log in and it does not bypass access controls.

For a longer explanation, see Apify's article [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

# Actor input Schema

## `mode` (type: `string`):

What to fetch. Profile lookup resolves each account via the public accounts/lookup API.

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

Mastodon instance hostname without protocol (for example mastodon.social).

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

Usernames or acct handles to look up, one per line (for example Gargron or user@other.social).

## `includePosts` (type: `boolean`):

Also fetch recent statuses for each looked-up account (statuses endpoint is less battle-tested).

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

Stop after this many successful rows. Hard max is 1000.

## `requestDelaySecs` (type: `number`):

Seconds to wait between requests. Raise if you see HTTP 429.

## `userAgent` (type: `string`):

User-Agent header sent with each request.

## `timeoutSecs` (type: `integer`):

Overall run budget in seconds.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

## `proxyConfiguration` (type: `object`):

Optional proxy. Leave off unless you need it.

## Actor input object example

```json
{
  "mode": "profileLookup",
  "instance": "mastodon.social",
  "accounts": [
    "Gargron"
  ],
  "includePosts": false,
  "maxItems": 100,
  "requestDelaySecs": 1,
  "userAgent": "ActorResearch/1.0",
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset rows in the overview table.

## `dataset` (type: `string`):

Full dataset for this run.

## `items` (type: `string`):

Dataset items as JSON.

# 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",
    "accounts": [
        "Gargron"
    ]
};

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

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

```

## MCP server setup

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