# Statshub — 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 football match statistics including xG, xGA, and possession metrics across multiple leagues, plus retrieve fixtures by date and current league standings. Get comprehensive season-level and match-level performance data to analyze team and player statistics in depth.

**Category:** Sports | **Website:** [statshub.com/](https://statshub.com/) | **Docs:** [parse.bot/marketplace/36da3238-d122-45d2-b20f-366a66fcd5bc/statshub-com-api](https://parse.bot/marketplace/36da3238-d122-45d2-b20f-366a66fcd5bc/statshub-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-statshub-com-api-36da3238/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_fixtures_by_date

Get all football fixtures/matches for a specific date. Returns match IDs, teams, scores, tournament info, and status. Each fixture includes event_id, home_team.id, and away_team.id needed to query match-level xG stats via get_match_stats. Covers 120+ leagues worldwide.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `date` | string | No | Date in YYYY-MM-DD format. If omitted, defaults to today's date (UTC). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-statshub-com-api-36da3238/get_fixtures_by_date \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"date":"<string>"}'
```

### get_league_standings

Get league standings with season-level xG, xGA, possession, and detailed team statistics. Automatically fetches the latest season if season_id is not provided. Returns all teams in the league with full statistical breakdown including expected goals, shots, big chances, and corners.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `season_id` | string | No | Season ID. If omitted, uses the latest available season for the tournament. |
| `tournament_id` | string | No | Tournament ID. 1=Premier League, 406=Peru Liga 1. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-statshub-com-api-36da3238/get_league_standings \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"season_id":"<string>","tournament_id":"<string>"}'
```

### get_match_stats

Get xG (expected goals), xGA (expected goals against), and per-player shot statistics for a specific match. Aggregates shot-level xG data from the match shotmap for both teams. Use event_id, home_team.id, and away_team.id from get_fixtures_by_date results. Only matches with shotmap data available will return player-level stats; others return zero xG and empty player arrays.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `away_team_id` | string | Yes | Away team ID from get_fixtures_by_date results (fixtures[*].away_team.id). |
| `event_id` | string | Yes | Match event ID from get_fixtures_by_date results (fixtures[*].event_id). |
| `home_team_id` | string | Yes | Home team ID from get_fixtures_by_date results (fixtures[*].home_team.id). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-statshub-com-api-36da3238/get_match_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"away_team_id":"<string>","event_id":"<string>","home_team_id":"<string>"}'
```

### get_team_statistics

Get aggregated team-level statistics from StatsHub for a specific team. Returns season-level stats organized by category (overview, attack, defence, possession, duels, cards, corners, other) in a single API call. No player-level or fixture-level data is included. If competition_id is omitted, defaults to the team's primary competition. If season_id is omitted, defaults to the latest season. The period, home_away, and half filters are passed to the source.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `competition_id` | string | No | Competition/tournament unique ID (e.g. '17' for Premier League, '7' for Champions League). If omitted, defaults to the team's primary competition. |
| `half` | string | No | Match half filter. |
| `home_away` | string | No | Filter by match location. |
| `period` | string | No | Match period filter. |
| `season_id` | string | No | Season ID. If omitted, defaults to the latest available season for the team's competition. |
| `team_id` | string | Yes | Internal team ID from StatsHub (e.g. '42' for Arsenal). Use team IDs returned by get_fixtures_by_date (fixtures[*].home_team.id or away_team.id) or get_league_standings (standings[*].team_id). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-statshub-com-api-36da3238/get_team_statistics \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"competition_id":"<string>","half":"<string>","home_away":"<string>","period":"<string>","season_id":"<string>","team_id":"<string>"}'
```

### get_team_stats

Get comprehensive team statistics from StatsHub for a specific team. Returns season-level aggregate stats organized by category (attack, defence, possession, duels, cards, corners), recent match fixtures, and per-player performance summaries. Uses 4 internal API calls. If competition_id is omitted, defaults to the team's primary competition. If season_id is omitted, defaults to the latest season. The period, home_away, and half filters apply to the fixtures and player stats sections.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `competition_id` | string | No | Competition/tournament unique ID to filter stats by (e.g. '8' for LaLiga, '7' for Champions League). If omitted, defaults to the team's primary competition. |
| `half` | string | No | Match half filter for fixtures data. |
| `home_away` | string | No | Filter by match location for fixtures and player stats. |
| `period` | string | No | Match period filter for fixtures and player stats sections. |
| `season_id` | string | No | Season ID. If omitted, defaults to the latest available season for the team's competition. |
| `team_id` | string | Yes | Internal team ID from StatsHub (e.g. '2814' for Espanyol, '42' for Arsenal). Use team IDs returned by get_fixtures_by_date (fixtures[*].home_team.id or away_team.id) or get_league_standings (standings[*].team_id). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-statshub-com-api-36da3238/get_team_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"competition_id":"<string>","half":"<string>","home_away":"<string>","period":"<string>","season_id":"<string>","team_id":"<string>"}'
```
