# GET /players - Fetch Player Data
URL: https://sockodds.com/docs/endpoints/getPlayers/

# GET /players - Fetch Player Data [#get-players---fetch-player-data]

Get a list of Players for a specific Team or Event

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

Retrieve player information including names, team and identifiers. Filter by playerID, teamID or eventID. Supports pagination.

## Query parameters [#query-parameters]

| Parameter | Type | Description |
| --- | --- | --- |
| `teamID` | `string` | TeamID to get Players data for |
| `eventID` | `string` | EventID to get Players data for |
| `playerID` | `string` | PlayerID to get data for e.g. `SONNY_GRAY_1_MLB` |
| `leagueID` note | `string` | SockOdds extension: a leagueID or comma-separated list to scope the player listSockOdds-only parameter. |
| `limit` | `number` | The maximum number of Players to return (default 50, max 250) |
| `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": Player[], "nextCursor": string | null }`

### Player [#player]

Contains information on a player

| Field | Type | Description |
| --- | --- | --- |
| `playerID` | `string` | e.g. SONNY_GRAY_1_MLB — the production SportsGameOdds id format, unique across teams in a league |
| `teamID` | `string` |  |
| `sportID` | `string` |  |
| `leagueID` | `string` |  |
| `name / firstName / lastName` | `string` |  |
| `position / jerseyNumber` | `string \| number` | Where the source carries them |

### 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/players/?leagueID=MLB&limit=5" \
  -H "x-api-key: YOUR_API_KEY"
```

```javascript
const r = await fetch("https://api.sockodds.com/v2/players/?leagueID=MLB&limit=5", { 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/players/", params=dict(leagueID="MLB", limit="5"), headers={"x-api-key": "YOUR_API_KEY"})
body = r.json()
```

```go
req, _ := http.NewRequest("GET", "https://api.sockodds.com/v2/players/?leagueID=MLB&limit=5", 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/players/?leagueID=MLB&limit=5"))
    .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/players/?leagueID=MLB&limit=5");
```

## Try it [#try-it]

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