# OpenDota — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Access detailed Dota 2 match statistics, player performance metrics, hero win rates, and professional tournament data to analyze gameplay trends and competitive performance. Search for specific players, explore custom data queries through SQL, and retrieve comprehensive match histories to improve your understanding of the game.

**Category:** Sports | **Website:** [opendota.com/](https://opendota.com/) | **Docs:** [parse.bot/marketplace/88a62cfc-1e6b-47f8-a892-7db7aa7e50bb/opendota-com-api](https://parse.bot/marketplace/88a62cfc-1e6b-47f8-a892-7db7aa7e50bb/opendota-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_explorer

Execute SQL queries against the OpenDota PostgreSQL database. Supports SELECT queries on tables like matches, players, heroes, leagues, and teams. Returns rows as an array of objects plus metadata about the query execution.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `sql` | string | Yes | SQL SELECT query to execute against the OpenDota database. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_explorer \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sql":"<string>"}'
```

### get_hero_stats

Get comprehensive hero performance statistics including pick/win rates across all rank brackets, pro matches, and turbo mode. Returns every hero with base attributes, roles, and aggregate statistics.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_hero_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_match

Retrieve comprehensive match data including duration, scores, players, and advanced statistics for a specific match. Each player entry contains hero, items, kills/deaths/assists, gold/xp rates, benchmarks, and more.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `match_id` | integer | Yes | Numeric match ID to retrieve data for. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_match \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"match_id":"<integer>"}'
```

### get_player

Get player profile data including Steam info, rank tier, and leaderboard position. Returns profile sub-object with Steam details (personaname, avatar, country), rank_tier as an integer encoding medal and star, and leaderboard_rank for top players.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `account_id` | integer | Yes | Steam account ID of the player. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_player \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"account_id":"<integer>"}'
```

### get_player_win_loss

Get player win/loss count with optional filters for hero, game mode, lobby type, region, patch, and date. Returns aggregate win and lose counts for the filtered set of matches.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `account_id` | integer | Yes | Steam account ID of the player. |
| `date` | integer | No | Number of days to look back from current date. |
| `game_mode` | integer | No | Filter by game mode. |
| `hero_id` | integer | No | Filter by hero ID. |
| `lobby_type` | integer | No | Filter by lobby type. |
| `patch` | integer | No | Filter by patch number. |
| `region` | integer | No | Filter by region. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_player_win_loss \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"account_id":"<integer>","date":"<integer>","game_mode":"<integer>","hero_id":"<integer>","lobby_type":"<integer>","patch":"<integer>","region":"<integer>"}'
```

### get_pro_matches

Get recent professional matches ordered by match_id descending. Use less_than_match_id for pagination to retrieve older matches. Each entry includes teams, league, duration, and result.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `less_than_match_id` | integer | No | Get matches with match_id less than this value for pagination. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_pro_matches \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"less_than_match_id":"<integer>"}'
```

### get_pro_players

Get list of professional players with their team affiliations and profile details. Returns all registered pro players with Steam info, team name/tag, country, and last match time.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_pro_players \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_team_players

Get the list of players who have played for a specific team, including games played, wins, and current membership status. Results are ordered by games_played descending.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `team_id` | integer | Yes | Numeric team ID. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/get_team_players \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"team_id":"<integer>"}'
```

### search_players

Search for players by personaname. Returns an array of matching player summaries ordered by relevance, each containing account_id, avatar, display name, and last match time.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | Search query matching player personaname. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-opendota-com-api-88a62cfc/search_players \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```
