# Lemmy Search API Documentation

<p><strong>Lemmy Search API</strong> searches a Lemmy instance as JSON and returns a single envelope with posts, communities, users and comments arrays. Filter by type_ to narrow the result. A valid empty result (no matches) is a successful response.</p>

- **Documentation:** [https://scrappa.co/docs/lemmy-api/lemmy_search](https://scrappa.co/docs/lemmy-api/lemmy_search)
- **API group:** Lemmy API
- **Endpoint:** `GET https://scrappa.co/api/lemmy/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 |
| --- | --- | --- | --- |
| `q` | string | Yes | Search query. Example: technology. |
| `type_` | string | No | Result type filter. One of: All, Posts, Communities, Users, Comments. Defaults to All. |
| `sort` | string | No | Sort order. One of: Active, Hot, New, Old, TopDay, TopWeek, TopMonth, TopYear, TopAll, MostComments, NewComments, TopHour, TopSixHour, TopTwelveHour, TopThreeMonths, TopSixMonths, TopNineMonths, Controversial, Scaled. Defaults to TopMonth. |
| `limit` | integer | No | Results per page. Server caps at 50. Defaults to 20. |
| `page` | integer | No | 1-based page number. Defaults to 1. |
| `instance` | string | No | Lemmy instance hostname. Defaults to lemmy.world. The hostname must resolve to a public address; private, loopback and unresolvable hosts are rejected without charge. |

## Example response

```json
{
    "data": {
        "type": "Posts",
        "posts": [
            {
                "id": 53070436,
                "score": 42,
                "title": "A technology post title",
                "creator": {
                    "id": 3100864,
                    "name": "EatingPies"
                },
                "community": {
                    "id": 2478,
                    "name": "technology",
                    "title": "Technology"
                },
                "published": "2026-10-10T14:30:00.000000Z",
                "comments_count": 167
            }
        ],
        "users": [],
        "comments": [],
        "has_more": true,
        "communities": []
    },
    "meta": {
        "billable": true,
        "endpoint_family": "search"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | The q parameter is missing or a parameter value is invalid. This response is not billable. |
| 422 | Invalid Parameter | Lemmy rejected one or more parameter values (for example an unknown sort). This response is not billable. |
| 503 | Upstream Unavailable | The Lemmy API is temporarily unavailable. 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)
