# GET /markets - Fetch Market Metadata
URL: https://sockodds.com/docs/endpoints/getMarkets/

# GET /markets - Fetch Market Metadata [#get-markets---fetch-market-metadata]

Get a list of Markets

`GET https://api.sockodds.com/v2/markets/`

Retrieve metadata about markets, keyed by oddID: identifiers, display names, classification (main markets, props, prop type, sub-periods) and which leagues and bookmakers currently price each one.

## Query parameters [#query-parameters]

| Parameter | Type | Description |
| --- | --- | --- |
| `oddID` | `string` | A single oddID or comma-separated list of oddIDs. Used to specify specific Markets to return. |
| `sportID` | `string` | A single sportID or comma-separated list of sportIDs to filter Markets by |
| `leagueID` | `string` | A single leagueID or comma-separated list of leagueIDs to filter Markets by |
| `bookmakerID` | `string` | A single bookmakerID or comma-separated list of bookmakerIDs to filter Markets by |
| `statID` | `string` | A single statID or comma-separated list of statIDs to filter Markets by |
| `statEntityID` | `string` | A single statEntityID or comma-separated list of statEntityIDs to filter Markets by |
| `periodID` | `string` | A single periodID or comma-separated list of periodIDs to filter Markets by |
| `betTypeID` | `string` | A single betTypeID or comma-separated list of betTypeIDs to filter Markets by |
| `sideID` | `string` | A single sideID or comma-separated list of sideIDs to filter Markets by |
| `isMainMarket` | `boolean` | Filter to only include main markets (main period moneyline, spread, and over/under) |
| `isProp` | `boolean` | Filter by whether it is any type of prop bet market |
| `isSubPeriod` | `boolean` | Filter by whether it tracks a sub/non-main period |
| `propType` | `string` | Filter by prop type (game_prop, team_prop, player_prop, other_prop) |
| `isSupported` | `boolean` | Filter whether this market is priced by at least 1 bookmaker in at least 1 league. Defaults to true if not specified. |
| `limit` | `number` | The maximum number of Markets to return (default: 100, max: 10000) |
| `cursor` | `string` | The cursor for the request. Used to get the next group of results. This is an opaque token — pass the nextCursor value from the prior response unchanged. |

## Response [#response]

Paginated: `{ "success": true, "data": Market[], "nextCursor": string | null }`

### Market [#market]

Contains information about a betting market, including its classification and support data across leagues and bookmakers

| Field | Type | Description |
| --- | --- | --- |
| `oddID` | `string` | The unique identifier for this market |
| `statID / statEntityID / periodID / betTypeID / sideID` | `string` | The decomposed grammar |
| `playerID / teamID` | `string` | Set for player props and tournament team markets |
| `marketGroupID / marketGroupName` | `string` | The group (all sides of the market) this market belongs to, and its display name |
| `isMainMarket` | `boolean` | True for the full-game moneyline, spread and total |
| `isMainDerivative` | `boolean` | True for a sub-period of a main market |
| `isSubPeriod` | `boolean` | True when the market tracks a non-main period |
| `isProp` | `boolean` | True if this is a prop bet |
| `propType` | `string` | game_prop, team_prop, player_prop or other_prop |
| `isSupported` | `boolean` | True if at least one bookmaker prices it in at least one league |
| `activeEvents` | `number` | Unique events with this market priced right now |
| `support` | `object` | leagueID → { bookmakerID → true } |
| `bookmakers` | `string[]` | SockOdds extension: the flat list of bookmakers pricing it |

### Status codes [#status-codes]

| Status | Body |
| --- | --- |
| `200` | `Success` |
| `400` | `{"success":false,"error":"Invalid params"}` |
| `401` | `{"success":false,"error":"Invalid API key"}` |
| `403` | `{"success":false,"error":"Inactive API key"}` |
| `429` | `{"success":false,"error":"Rate limit exceeded"} (Retry-After header)` |
| `500` | `{"success":false,"error":"Query failed"}` |

## Code samples [#code-samples]

**cURL** · **JavaScript** · **Python** · **Go** · **Java** · **C#**

```bash
curl -X GET "https://api.sockodds.com/v2/markets/?leagueID=AFL&isMainMarket=true" \
  -H "x-api-key: YOUR_API_KEY"
```

```javascript
const r = await fetch("https://api.sockodds.com/v2/markets/?leagueID=AFL&isMainMarket=true", { headers: { "x-api-key": "YOUR_API_KEY" } });
const { success, data, nextCursor, notice } = await r.json();
```

```python
import requests
r = requests.get("https://api.sockodds.com/v2/markets/", params=dict(leagueID="AFL", isMainMarket="true"), headers={"x-api-key": "YOUR_API_KEY"})
body = r.json()
```

```go
req, _ := http.NewRequest("GET", "https://api.sockodds.com/v2/markets/?leagueID=AFL&isMainMarket=true", nil)
req.Header.Set("x-api-key", "YOUR_API_KEY")
res, err := http.DefaultClient.Do(req)
```

```java
HttpRequest req = HttpRequest.newBuilder().uri(URI.create("https://api.sockodds.com/v2/markets/?leagueID=AFL&isMainMarket=true"))
    .header("x-api-key", "YOUR_API_KEY").GET().build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
```

```csharp
using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");
var body = await http.GetStringAsync("https://api.sockodds.com/v2/markets/?leagueID=AFL&isMainMarket=true");
```

## Try it [#try-it]

> Need help?[FAQ](https://sockodds.com/docs/faq/) · [Email](mailto:api@sockodds.com) · [Contact](https://sockodds.com/contact-us/)
