# Getting Started

{% hint style="danger" %}
**This version of the API is deprecated. Please visit the** [**docs**](https://app.gitbook.com/o/-MJWE53IpT91aRTPjruo/s/FnlmCoPQl0hTWxA9V938/) **of our brand new Motorsport API v3**&#x20;
{% endhint %}

Before you are able to call our API you need a SportMonks account. [Register now.](https://my.sportmonks.com/register)

To make our first request, we’ll need a way to get authenticated first. Cricket API 2.0 utilizes API tokens for the authentication of requests. You can obtain and manage your API tokens in [Mysportmonks](https://my.sportmonks.com/login).\
\
For the sake of simplicity, we’ll be working with an API token from the free plan.

Example API token: **\[HdoiD312ND….]**

The API token is only meant for your eyes and, as such, should be stored away safely.

{% hint style="info" %}
Our tokens have no expiration date and will remain valid until you manually delete it yourself.
{% endhint %}

Formula One API V1.0 utilizes response codes to indicate successful and failed API requests.\
\
When making a request, a code response will always be returned. See below for a short list of possible code responses:

| Code number | Description                                                                         |
| ----------- | ----------------------------------------------------------------------------------- |
| `200`       | **Successful request and data was returned**                                        |
| `400`       | **Part of the request is malformed; the exact reason can be found in the response** |
| `401`       | **Request is not authenticated**                                                    |
| `403`       | **Unauthorized request to access data from an ineligible plan**                     |
| `429`       | **You have reached the response rate limit of your plan**                           |
| `500`       | **Internal error with our servers**                                                 |

\
With our token in hand, we can finally make the first request!

{% hint style="info" %}
We recommend you submit your requests with Postman since we have already prepared the request for you there! Hit the button below to import our Formula One API collection.\
&#x20;                                                             [![Run in Postman](https://run.pstmn.io/button.svg)](https://formulaone-postman.sportmonks.com/)
{% endhint %}

## Your first request

Now that all prerequisites have been fulfilled, we’re ready to send our first request to the API!

### Build the request

The request consists of the following components:

* The base URL
* A path parameter, in this example, we use \[leagues]
* A query string parameter, this is optional, so we leave this out for now
* And finally, your API token

{% tabs %}
{% tab title="Base URL" %}

```javascript
https://f1.sportmonks.com/api/
```

{% endtab %}
{% endtabs %}

An example of a correctly authenticated request would be:

{% tabs %}
{% tab title="Request" %}

```javascript
 	https://f1.sportmonks.com/api/v1.0/seasons?api_token={API_TOKEN}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "data": [
        {
            "id": 6,
            "name": "2021"
        },
        {
            "id": 7,
            "name": "2022"
        }
    ],
```

{% endtab %}
{% endtabs %}

This request will return all of the seasons eligible for our free plan.
