# Mastodon Profile Scraper (`solid-scraper/mastodon-profile-scraper`) Actor

📣 Mastodon Profile Scraper extracts detailed user profiles from public Mastodon instances fast & accurately. Perfect for researchers, marketers, and agencies to build targeted audiences and grow insights. 🚀🔎 Save time, find leads, and scale smarter.

- **URL**: https://apify.com/solid-scraper/mastodon-profile-scraper.md
- **Developed by:** [SolidScraper](https://apify.com/solid-scraper) (community)
- **Categories:** Lead generation, Social media, Developer tools
- **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 and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

### Mastodon Profile Scraper 🔍

**Mastodon Profile Scraper** is a tool that extracts metadata from Mastodon profiles—including display names, bios, follower counts, and more—so you can quickly turn public Fediverse profiles into structured data. If you’re looking for a *Mastodon profile scraper*, a *Mastodon scraper tool*, or *Fediverse profile scraper* workflows, this actor helps automate profile lookup and data extraction at scale. Whether you’re a marketer, recruiter, or data enthusiast, Mastodon Profile Scraper saves you hours of manual work by fetching profile metadata for the handles you provide.

---

### Why choose Mastodon Profile Scraper?

| Feature | Benefit |
|---|---|
| ✅ **Profile metadata extraction** | Extracts profile details from Mastodon accounts in one run |
| ✅ **Input accepts Mastodon handles** | Lets you submit handles like `Mastodon` or `dataforleads@gmail.com` directly |
| ✅ **Instance detection + fallback lookup** | Improves success when accounts are on different instances by falling back when needed |
| ✅ **Structured output you can use immediately** | Produces JSON objects that are easy to analyze or import into other tools |
| ✅ **Reliable scraping with proxy support** | Uses built-in proxy support for more dependable requests |
| ✅ **Real-time saving per profile** | Pushes each result as it’s processed so you don’t lose all progress |

---

### Key features

- 📊 **Structured JSON profile metadata**: Returns account profile JSON for each provided handle.
- 🌐 **Mastodon handle support**: Accepts both plain handles (e.g., `Mastodon`) and handle-with-instance format (e.g., `dataforleads@gmail.com`).
- 🧭 **Cross-instance lookup support**: Detects the instance from `dataforleads@gmail.com` and includes a fallback lookup to improve coverage.
- 🛡️ **Proxy support for resilient runs**: Uses built-in proxy support to help with reliable fetching across batches.
- 🔄 **Resilient processing flow**: Includes error handling so failures are returned as result objects instead of breaking the entire run.
- 💾 **Incremental result pushing**: Saves each profile result immediately as it’s scraped, not only at the end.
- 🤖 **Automation-friendly**: Designed for automated Mastodon account scraping and data pipelines using the handles list as input.

---

### Input

Provide input via an `input.json` file. Example structure:

```json
{
  "profile_ids": [
    "Mastodon",
    "warandpeas"
  ]
}
````

#### Input Fields

| Field | Required | Description |
|---|---|---|
| `profile_ids` | Yes | A list of Mastodon handles to scrape. You can use a plain handle like `Mastodon` or an instance-qualified handle like `dataforleads@gmail.com`. |

***

### Output

The actor saves each profile’s data in JSON format by pushing results as they’re processed.

Sample output for one profile (success or failure object is returned):

```json
{
  "id": "1055539",
  "username": "mastodon",
  "acct": "mastodon@mastodon.social",
  "display_name": "Mastodon",
  "note": "Hello Fediverse!",
  "followers_count": 12345,
  "following_count": 678,
  "avatar_static": "https://example.com/avatar.jpg",
  "url": "https://mastodon.social/@mastodon"
}
```

If a lookup fails for a given handle, the actor pushes an error object shaped like this:

```json
{
  "error": "Failed to fetch user@instance.social: Status 404",
  "profile_id": "user@instance.social"
}
```

#### Output Fields

| Field | Type | Description |
|---|---|---|
| `id` | string | Account id from the profile metadata response (when successful). |
| `username` | string | The account username (when successful). |
| `acct` | string | The account handle in `username@instance` form (when successful). |
| `display_name` | string | Profile display name (when successful). |
| `note` | string | Profile bio text (when successful). |
| `followers_count` | number | Number of followers (when successful). |
| `following_count` | number | Number of accounts the user is following (when successful). |
| `avatar_static` | string | URL to the static avatar image (when successful). |
| `url` | string | Canonical profile URL (when successful). |
| `error` | string | Error message when the lookup fails or an exception occurs. |
| `profile_id` | string | The input handle that produced the error object. |

**Note:** On success, the actor returns the full JSON from the Mastodon `accounts/lookup` endpoint for each profile id. On failure, it returns an error object containing `error` and `profile_id`.

***

### How to use Mastodon Profile Scraper (via Apify Console)

1. **Open Apify Console**\
   Log in at https://console.apify.com and navigate to the **Actors** page.

2. **Find the actor**\
   Search for **Mastodon Profile Scraper** and open the actor details page.

3. **Go to the INPUT tab**\
   Use the built-in input form and set `profile_ids` to the list of Mastodon handles you want to scrape (e.g., `Mastodon` or `dataforleads@gmail.com`).

4. **Review proxy behavior (if shown in your console UI)**\
   The actor uses built-in proxy support for more dependable requests during runs.

5. **Click Run**\
   Start the run. You’ll see logs indicating which profile is being fetched.

6. **Monitor progress in real time**\
   The actor pushes each profile result as it’s processed (so you can track outcomes per handle).

7. **Open the OUTPUT / Dataset**\
   After the run completes, open the dataset created by the actor and inspect the JSON results (success objects or error objects).

8. **Export as needed**\
   Export your dataset (e.g., JSON) for analysis, enrichment, or downstream processing.

No coding required—get structured Mastodon profile metadata in minutes.

***

### Advanced features & SEO optimization

- 🔎 **Engineered for Mastodon profile scraping**: Uses profile lookup and structured output, making it a strong Mastodon profile scraper tool for automated Mastodon profile harvesting.
- 🌐 **Supports instance-qualified handles**: Great for Mastodon username to profile scraper workflows where you want correct instance targeting from `dataforleads@gmail.com`.
- 🧰 **Designed for resilience**: Includes fallback lookup and error handling so you get per-handle results even when some profiles fail.
- 💾 **Built for data pipelines**: Works well as a Fediverse profile scraper step in research, enrichment, or ActivityPub profile scraper workflows—especially when you need consistent JSON records.

***

### Best use cases

- 📈 **Lead generation enrichment**: Quickly build a structured list of profile metadata for outreach targeting based on publicly visible bios and follower counts.
- 🧪 **Fediverse research**: Export Mastodon data extraction results for analysis of communities, branding, and account characteristics across instances.
- 🗞️ **Brand monitoring**: Track and compare profile bios and display names over time for competitors or collaborators.
- 🎯 **Recruiting & community discovery**: Use a Mastodon account scraping workflow to identify relevant creators, communities, and experts by profile metadata.
- 🧾 **Data analyst projects**: Feed structured JSON into your analysis pipeline to model relationships using followers and profile descriptions.
- 💻 **Automation via API pipeline**: Integrate Mastodon profile crawler output into ETL jobs and CRM-like systems for repeatable Mastodon profile export tasks.
- 🧠 **Hashtag and bio studies**: Use scraped bios as a basis for categorization when you’re scraping Mastodon bios and hashtags-related signals (from the profile note content).

***

### Technical specifications

- **Supported Input Formats**
  - ✅ `profile_ids` as an array of Mastodon handles
  - ✅ Handles can be plain (e.g., `Mastodon`) or instance-qualified (e.g., `dataforleads@gmail.com`)

- **Proxy Support**
  - ✅ Built-in proxy support for more reliable fetching during runs

- **Retry Mechanism**
  - ✅ Includes resilience via fallback lookup and exception handling (implementation details are handled internally)

- **Dataset Structure**
  - ✅ One pushed JSON result per profile id while processing the list

- **Rate Limits & Performance**
  - ✅ Uses a lightweight request flow with a small delay between profiles when scraping multiple accounts to improve run stability

- **Limitations**
  - ❌ If a profile lookup fails for a handle, you’ll receive an error object for that handle
  - ❌ Only publicly available profile metadata from the Mastodon lookup endpoint is returned

***

### FAQ

#### What does Mastodon Profile Scraper return?

✅ It returns JSON profile metadata for each handle you provide. The actor pushes the successful account lookup JSON per `profile_ids` entry, and for failures it pushes an error object containing `error` and `profile_id`.

#### Can I scrape profiles from different Mastodon instances?

✅ Yes. The actor accepts `dataforleads@gmail.com`-style handles. It detects the instance from your input and also includes a fallback lookup approach to improve coverage when initial fetches don’t succeed.

#### Do I need to provide full URLs or just handles?

✅ You can provide handles. Use plain handles like `Mastodon` or instance-qualified handles like `dataforleads@gmail.com` in `profile_ids`.

#### Is this suitable for automated Mastodon profile harvesting in bulk?

✅ Yes. You can pass a list of handles in `profile_ids`, and the actor pushes results incrementally as it processes them, which is useful for larger batches.

#### How do I use it in my own workflow?

💻 You can run it from Apify Console and export the resulting dataset. For programmatic use, you can integrate the actor into your pipeline and consume the JSON records it outputs.

#### What happens if a specific handle can’t be fetched?

✅ The actor pushes an error object for that handle with an `error` message and the original `profile_id` value, while continuing to process the remaining handles.

#### Is the scraped data publicly accessible?

✅ The actor is intended for extracting profile metadata from publicly available sources returned by the Mastodon API lookup. You should still verify your usage complies with applicable laws and platform terms.

#### Does it include email addresses?

❌ This actor extracts profile metadata returned by the Mastodon `accounts/lookup` response. It does not specifically extract or guarantee email fields.

***

### Support & feature requests

If you’re using Mastodon Profile Scraper for Mastodon data extraction, we’d love to hear what would make it better.

- 💡 **Feature Requests**: For example, enhancements like additional output shaping, pagination controls, or more dataset-friendly export options.
- 📧 **Contact**: Reach out at <dataforleads@gmail.com>.

Your feedback helps shape the roadmap for future Mastodon scraper tool improvements.

***

### *Mastodon Profile Scraper* — final thoughts

*If you need a reliable Mastodon profile scraper for automated account lookups and structured JSON export, this is an excellent, SEO-optimized choice for your next Fediverse profile scraper workflow.*

***

### Disclaimer

**This tool only accesses publicly accessible sources.** It does not access private profiles, authenticated data, or password-protected content.

You are responsible for ensuring your use complies with applicable laws (for example, GDPR or CCPA), spam regulations, and the platforms’ Terms of Service. For data removal requests, contact <dataforleads@gmail.com>.

Use Mastodon Profile Scraper responsibly, ethically, and for legitimate purposes only.

# Actor input Schema

## `profile_ids` (type: `array`):

List of Mastodon handles (e.g. 'Mastodon' or 'user@instance.social') to scrape.

## Actor input object example

```json
{
  "profile_ids": [
    "Mastodon",
    "warandpeas"
  ]
}
```

# 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 = {
    "profile_ids": [
        "Mastodon",
        "warandpeas"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("solid-scraper/mastodon-profile-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 = { "profile_ids": [
        "Mastodon",
        "warandpeas",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("solid-scraper/mastodon-profile-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "profile_ids": [
    "Mastodon",
    "warandpeas"
  ]
}' |
apify call solid-scraper/mastodon-profile-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=solid-scraper/mastodon-profile-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Mastodon Profile Scraper",
        "description": "📣 Mastodon Profile Scraper extracts detailed user profiles from public Mastodon instances fast & accurately. Perfect for researchers, marketers, and agencies to build targeted audiences and grow insights. 🚀🔎 Save time, find leads, and scale smarter.",
        "version": "0.1",
        "x-build-id": "CT2kyWD6t2IyDQtOf"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/solid-scraper~mastodon-profile-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-solid-scraper-mastodon-profile-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/solid-scraper~mastodon-profile-scraper/runs": {
            "post": {
                "operationId": "runs-sync-solid-scraper-mastodon-profile-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/solid-scraper~mastodon-profile-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-solid-scraper-mastodon-profile-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "profile_ids"
                ],
                "properties": {
                    "profile_ids": {
                        "title": "Profile IDs",
                        "type": "array",
                        "description": "List of Mastodon handles (e.g. 'Mastodon' or 'user@instance.social') to scrape.",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
