> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# X community

> Read an X community page as JSON with the x-community parser. $1 per 1,000 calls. Send the page to scrape. Examples in cURL, TypeScript and Python.

Reads an X community page, like x.com/i/communities/`<id>`, and returns one profile as JSON.

## Make a request

Send the page's URL to [scrape](https://docs.stophy.dev/api-reference/endpoint/scrape.md) with a `json` format that names the parser. This parser works without an API key when you send no options, up to 10 calls a minute and 50 calls a day per IP address. See [Rate limits](https://docs.stophy.dev/production/rate-limits.md). To lift the limits, get an API key in the [Quickstart](https://docs.stophy.dev/quickstart).

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://x.com/i/communities/1699807431709041070","formats":[{"type":"json","parser":"x-community"}]}'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://x.com/i/communities/1699807431709041070",
    formats: [{ type: "json", parser: "x-community" }],
  }),
});
console.log(await response.json());
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={
        "url": "https://x.com/i/communities/1699807431709041070",
        "formats": [{"type": "json", "parser": "x-community"}],
    },
)
print(response.json())
```

## Read the response

The parser's data is in `data.json`. Its fields include `id`, `url`, `handle`, `name`, `bio`, `avatarUrl`, `isVerified`, `followers`, `following`, `posts`, `website`, `location` and `category`. This sample is cut to the first items.

```json theme={null}
{
  "success": true,
  "data": {
    "json": {
      "id": "1699807431709041070",
      "url": "https://x.com/i/communities/1699807431709041070",
      "handle": null,
      "name": "Software Engineering",
      "bio": "A community for software engineers and aspiring ones.",
      "avatarUrl": null,
      "isVerified": null,
      "followers": null,
      "following": null,
      "posts": null,
      "website": null,
      "location": null,
      "category": "Software",
      "memberCount": 248525,
      "joinPolicy": "open",
      "isNsfw": false,
      "createdAt": "2023-09-07T15:30:47.275Z",
      "bannerUrl": "https://pbs.twimg.com/community_banner_img/2007469232632537090/QrvFh1PE?format=jpg&name=orig",
      "rules": [
        {
          "name": "Be kind and respectful.",
          "description": "This will all be way more fun if everyone is nice to each other. You can disagree on something while not making it…"
        }
      ]
    }
  }
}
```

## Options

Send options in the `options` object of the `json` format.

| Option | What it does |
| - | - |
| `view` | Picks one of the answers this parser can give: `posts`. |
| `limit` | With `view` `posts`: return at most this many posts. You pay \$0.001 for each 10 returned. |

## Price

$1 per 1,000 calls. Works without an API key, within the free limits. The `posts` view costs $0.001 per 10 posts and needs an API key. See [Pricing](https://docs.stophy.dev/account/pricing.md).

## Limits and errors

* The URL must be an X community page, like x.com/i/communities/`<id>`. Send options view posts for the community's top posts, with no cursor for more. Any other URL fails with `invalidRequest`.
* The answer comes back in `data.json`. If the page cannot be read, the call fails with an error code from [Errors](https://docs.stophy.dev/api-reference/errors.md).

## Related

* [Pre-built parsers](https://docs.stophy.dev/scrape/prebuilt-parsers) lists every parser.
* [Scrape](https://docs.stophy.dev/scrape/overview) has the options every scrape takes.
* [X profile](https://docs.stophy.dev/scrape/prebuilt-parsers/social/x-profile.md)
* [X post](https://docs.stophy.dev/scrape/prebuilt-parsers/social/x-post.md)
* [Reddit search](https://docs.stophy.dev/scrape/prebuilt-parsers/social/reddit-search.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.