# Mastodon Search API Documentation

Search any public Mastodon instance for accounts, hashtags, or statuses. Returns an object with accounts, hashtags, and statuses arrays. The resolve parameter is always false (no federation). Hashtags work anonymously on mastodon.social. Note: offset-based pagination may return 401 on some instances for unauthenticated use; only the first page is reliable.

- **Documentation:** [https://scrappa.co/docs/mastodon-api/mastodon_search](https://scrappa.co/docs/mastodon-api/mastodon_search)
- **API group:** Mastodon API
- **Endpoint:** `GET https://scrappa.co/api/mastodon/search`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `instance` | string | No | Public Mastodon hostname. Defaults to mastodon.social. |
| `q` | string | Yes | Search query string. |
| `type` | string | No | Filter by type: accounts, hashtags, or statuses. Omit for all. Hashtags work anonymously on mastodon.social. |
| `limit` | integer | No | Results per type, 1 to 40. Defaults to 20. |
| `offset` | integer | No | Result offset. Note: offset>0 may return 401 on some instances for unauthenticated use. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/mastodon/search?instance=mastodon.social&q=mastodon&type=accounts&resolve=0&limit=5"
```

## Example response

```json
{
    "success": true,
    "data": {
        "accounts": [
            {
                "id": "13179",
                "username": "Mastodon",
                "acct": "Mastodon",
                "display_name": "Mastodon",
                "note": "<p>Our mission is to connect the world.</p>",
                "note_text": "Our mission is to connect the world.",
                "followers_count": 878927
            }
        ],
        "statuses": [],
        "hashtags": []
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A public parameter or range is invalid. This response is not billable. |
| 502 | Invalid Source Response | Mastodon returned an unexpected response. This response is not billable. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
