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

# API Reference

> Complete API reference for web scraping and Twitter data. 50+ endpoints for scraping any website and accessing Twitter data.

## Base URL

```
https://scrapebadger.com/v1
```

All API endpoints are prefixed with this base URL. Authentication is required for all requests.

## Authentication

Include your API key in the `x-api-key` header with every request:

```bash theme={null}
curl -X POST "https://scrapebadger.com/v1/web/scrape" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://scrapebadger.com", "format": "markdown"}'
```

See the [Authentication guide](/authentication) for more details.

## Endpoint Categories

### Web Scraping

| Category                                                    | Endpoints | Description                                                              |
| ----------------------------------------------------------- | --------- | ------------------------------------------------------------------------ |
| [Web Scraping](/api-reference/endpoint/web-scraping/scrape) | 2         | Scrape any website with anti-bot bypass, JS rendering, and AI extraction |

### Twitter

| Category                                                                 | Endpoints | Description                                                                            |
| ------------------------------------------------------------------------ | --------- | -------------------------------------------------------------------------------------- |
| [Tweets](/api-reference/endpoint/tweets/get-tweet-detail)                | 11        | Get tweet details, replies, retweets, likes, edit history, community notes, and search |
| [Users](/api-reference/endpoint/users/get-user-by-username)              | 11        | Fetch user profiles, followers, following, mentions, articles, and batch lookups       |
| [Lists](/api-reference/endpoint/lists/get-list-details)                  | 3         | Access Twitter lists, their tweets, and search within lists                            |
| [Communities](/api-reference/endpoint/communities/get-community-details) | 3         | Explore communities, their members, and content                                        |
| [Trends](/api-reference/endpoint/trends/get-trending-topics)             | 2         | Get trending topics globally or for specific locations                                 |
| [Geo](/api-reference/endpoint/geo/search-places)                         | 2         | Search and retrieve geographic place information                                       |
| [Spaces](/api-reference/endpoint/spaces/get-space-details)               | 2         | Access Twitter Spaces and live broadcasts                                              |

## Common Patterns

### Pagination

Most list endpoints support cursor-based pagination. The response includes a `next_cursor` field that you can pass to the `cursor` parameter to fetch the next page.

```bash theme={null}
# First request
curl "https://scrapebadger.com/v1/twitter/users/elonmusk/followers" \
  -H "x-api-key: YOUR_API_KEY"

# Response includes next_cursor
# { "data": [...], "next_cursor": "abc123" }

# Next page
curl "https://scrapebadger.com/v1/twitter/users/elonmusk/followers?cursor=abc123" \
  -H "x-api-key: YOUR_API_KEY"
```

### Error Handling

All errors return a JSON object with a `detail` field:

```json theme={null}
{
  "detail": "User not found"
}
```

### Credits

All endpoints cost **1 credit per request**. Failed requests (4xx/5xx) do not consume credits. See [Credits & Pricing](/credits-and-pricing) for details.
