---
id: example-curl
title: Sport Line API — cURL Request Examples
description: Ready-to-use cURL requests for core Sport Line API methods with access-key authentication.
version: v1
language: en
---

# Sport Line API — cURL Request Examples

## Before You Start

Replace the following values in every example:

| Value | Replace with |
|---|---|
| `https://YOUR_API_DOMAIN` | Base URL received from the SportAPI manager |
| `YOUR_API_KEY` | Personal Sport Line API key |
| `SPORT_ID_FROM_MENU` | Current sport ID from `menu` or `sports` |
| `COUNTRY_ID_FROM_MENU` | Current country ID from `menu` or `countries` |
| `TOURNAMENT_ID_FROM_MENU` | Current tournament ID from `menu` or `tournaments` |
| `SPORT_ID_FROM_SPORTS` | Current sport ID from the `sports` response |
| `COUNTRY_ID_FROM_COUNTRIES` | Current country ID from the `countries` response |
| `TOURNAMENT_ID_FROM_TOURNAMENTS` | Current tournament ID from the `tournaments` response |
| `GAME_ID_FROM_EVENTS` | Current match `game_id` from `events` |
| `SUBGAME_ID_FROM_EVENT` | Submatch ID from `event.body.sub_games` |

Send the API key only in the `Package` HTTP header:

```http
Package: YOUR_API_KEY
```

Do not add the key to the URL or store an active key in a public repository,
documentation, or error message.

## Minimal Live Request

Retrieve the current Live menu:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/menu/live/en' \
  --header 'Package: YOUR_API_KEY' \
  --header 'Accept: application/json'
```

The `Package` header is required. `Accept: application/json` is optional, but it makes
the expected response format explicit.

## Recommended Integration Flow

The standard sequence consists of three requests:

```text
menu
  ↓ current sportId and tournamentId
events
  ↓ current game_id
event
```

Do not replace this sequence with statically stored IDs. The API returns only sports
and tournaments that currently have matches in the selected `live` or `line` type.

### Step 1: Retrieve the Current Menu

Live:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/menu/live/en' \
  --header 'Package: YOUR_API_KEY'
```

Prematch:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/menu/line/en' \
  --header 'Package: YOUR_API_KEY'
```

Select a sport and tournament present in the current hierarchy:

```text
body[].id                         → sportId
body[].sub[].id                   → countryId
body[].sub[].sub[].id             → tournamentId
```

Detailed documentation: [`menu`](../api-reference/menu.md).

### Step 2: Retrieve the Match List

All matches from all available tournaments for the selected Live sport:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/events/SPORT_ID_FROM_MENU/0/sub/50/live/en' \
  --header 'Package: YOUR_API_KEY'
```

`tournamentId=0` means all available tournaments for the selected sport. You must still
take `SPORT_ID_FROM_MENU` from the current `menu` response.

Only one selected Live tournament:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/events/SPORT_ID_FROM_MENU/TOURNAMENT_ID_FROM_MENU/sub/50/live/en' \
  --header 'Package: YOUR_API_KEY'
```

All Prematch matches for the selected sport:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/events/SPORT_ID_FROM_MENU/0/sub/50/line/en' \
  --header 'Package: YOUR_API_KEY'
```

For `events`, use only:

- the `sub` format;
- the technical `count=50` value.

The match-count limit has been removed. The API returns the entire available result
set.

Detailed documentation: [`events`](../api-reference/events.md).

### Step 3: Retrieve a Specific Match

Take `game_id` from the current `events` response.

Live match:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/event/GAME_ID_FROM_EVENTS/group/live/en' \
  --header 'Package: YOUR_API_KEY'
```

Prematch match:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/event/GAME_ID_FROM_EVENTS/group/line/en' \
  --header 'Package: YOUR_API_KEY'
```

The `event` method uses only the `group` format. It returns the complete available list
of betting markets and odds for the selected match.

Use the same sports line type from which `game_id` was retrieved. A Prematch ID cannot
be requested as a Live ID.

Detailed documentation: [`event`](../api-reference/event.md).

## Requesting a Submatch

First, request the main match through `event` and find the required item in
`body.sub_games`:

```json
{
  "game_id": 746147010,
  "game_name": "Corners"
}
```

Then make a separate request using the submatch's `game_id`:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/event/SUBGAME_ID_FROM_EVENT/group/live/en' \
  --header 'Package: YOUR_API_KEY'
```

The returned odds apply only to the selected submatch. For example, a “Corners, 1st
Half” request returns odds only for first-half corners.

Detailed documentation:
[Additional Matches and Submatches](../data-models/sub-events.md).

## Step-by-step Navigation Without `menu`

Using `menu` is generally more convenient because it returns sports, countries, and
tournaments in one request. If the interface needs step-by-step loading, follow the
sequence below.

These navigation methods are optional and do not replace the core
`menu → events → event` flow.

### 1. Sports

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/sports/live/en' \
  --header 'Package: YOUR_API_KEY'
```

### 2. Countries for the Selected Sport

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/countries/SPORT_ID_FROM_SPORTS/live/en' \
  --header 'Package: YOUR_API_KEY'
```

### 3. Tournaments for the Selected Country

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/tournaments/SPORT_ID_FROM_SPORTS/COUNTRY_ID_FROM_COUNTRIES/live/en' \
  --header 'Package: YOUR_API_KEY'
```

### 4. Matches for the Selected Tournament

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/events/SPORT_ID_FROM_SPORTS/TOURNAMENT_ID_FROM_TOURNAMENTS/sub/50/live/en' \
  --header 'Package: YOUR_API_KEY'
```

Take each ID directly from the preceding current response. Do not skip levels in the
chain or insert stored static values.

Detailed documents:

- [`sports`](../api-reference/optional-methods/sports.md);
- [`countries`](../api-reference/optional-methods/countries.md);
- [`tournaments`](../api-reference/optional-methods/tournaments.md).

## Esports Data

Pass `cybersport=true` to methods that support this parameter.

Esports Live menu:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/menu/live/en?cybersport=true' \
  --header 'Package: YOUR_API_KEY'
```

Esports Live matches:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/events/SPORT_ID_FROM_MENU/0/sub/50/live/en?cybersport=true' \
  --header 'Package: YOUR_API_KEY'
```

Use IDs from the esports menu retrieved with the same `cybersport=true` parameter.

## Top Matches

The top-match methods are optional. Use them only when the client interface needs a
separate top-match selection.

### All Sports

Short Live summaries:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/topmatches/live/en' \
  --header 'Package: YOUR_API_KEY'
```

Extended Live summaries with a short odds list:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/topmatches/live/en?full=true' \
  --header 'Package: YOUR_API_KEY'
```

For Prematch, replace `live` with `line`.

`full=true` extends the match object but does not return the complete list of all odds.
Request `event` for the full list.

Detailed documentation:
[`topmatches`](../api-reference/optional-methods/topmatches.md).

### One Sport

`toplist` works only with Prematch and has no `type` parameter:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/toplist/SPORT_ID_FROM_MENU/en' \
  --header 'Package: YOUR_API_KEY'
```

Take `SPORT_ID_FROM_MENU` from the current Prematch `menu/line` response, not from the
Live menu.

Extended summaries:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/toplist/SPORT_ID_FROM_MENU/en?full=true' \
  --header 'Package: YOUR_API_KEY'
```

Detailed documentation: [`toplist`](../api-reference/optional-methods/toplist.md).

## Match Search

Search is an optional method. The search text is part of the URL and must be encoded.

Search for `Perth` in Live matches:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/search/live/en/Perth' \
  --header 'Package: YOUR_API_KEY'
```

Search for `Manchester` in Prematch matches:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/search/line/en/Manchester' \
  --header 'Package: YOUR_API_KEY'
```

Search Live and Prematch separately.

Detailed documentation: [`search`](../api-reference/search.md).

## Using Another Language

To retrieve names in another language, replace the final `en` segment with an enabled
SportAPI language code. For example, Russian uses `ru`:

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/menu/live/ru' \
  --header 'Package: YOUR_API_KEY'
```

The requested language must be included in the API key's subscription.

## Viewing Formatted JSON

If the `jq` utility is installed, format the response immediately:

```bash
curl --silent --show-error \
  --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/menu/live/en' \
  --header 'Package: YOUR_API_KEY' \
  | jq .
```

`jq` is not part of Sport Line API and must be installed separately.

## Saving a Response to a File

```bash
curl --request GET \
  --url 'https://YOUR_API_DOMAIN/v1/menu/live/en' \
  --header 'Package: YOUR_API_KEY' \
  --output 'sportapi-menu-live.json'
```

Do not store the API key inside the JSON file or next to the response in a public
directory.

## Checking the Response Format

Successful response:

```json
{
  "status": 1,
  "page": "/v1/menu",
  "body": []
}
```

API error:

```json
{
  "error_code": 100,
  "error_message": "Invalid Package"
}
```

`event` service message:

```json
{
  "status": 1,
  "page": "/v1/event",
  "body": {
    "message": "Game id finished"
  }
}
```

When checking a response:

1. First check `error_code` and `error_message`.
2. Then check `body.message`.
3. Treat an empty `body` array as no data, not as a system error.
4. Only then parse data according to the specific method.

For details, see:

- [Response Format](../data-models/response-format.md);
- [Error Handling](../getting-started/error-handling.md).

## Full Verification Responses

Saved unabridged responses are available in
[Full JSON Responses](json-responses/README.md).

The files do not contain an API key.

## What This Document Does Not Provide

These examples show individual HTTP requests. They do not implement:

- a SportAPI SDK or library;
- automatic data updates;
- application-state storage;
- a complete user interface;
- automatic retries;
- a bet placement and settlement system.

These tasks depend on the client's project architecture and will be covered separately.

## Related Documents

- [Quick Start](../getting-started/quick-start.md)
- [Core Concepts](../getting-started/core-concepts.md)
- [Data Update Guidelines](../getting-started/update-guidelines.md)
- [Sport Line API Methods](../api-reference/README.md)
- [Field Reference](../data-models/field-reference.md)
