Make your first request
It's time to make your first API request. Maybe you've missed it, but we've explained how our API works on our Getting Started page. For your convenience, we've copied the content on this page as well. Already followed all these steps? Then let's get started by setting your own time zone.
Getting StartedSet your time zoneAuthentication
To make our first request, we’ll need a way to get authenticated first. Football API 2.0 utilizes API tokens for the authentication of requests. You can obtain your free API token and manage your API tokens Mysportmonks. For the sake of simplicity, we’ll be working with an API token from the free plan. The free plan only has the Danish Superliga (league id: 271) and the Scottish Premiership (league id: 501) included.
Example API token: [HdoiD312ND….]
The API token is only meant for your eyes and, as such, should be stored away safely.
Our tokens have no expiration date and will remain valid until you manually delete them yourself. Football API 2.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 shortlist of possible code responses:
Code number | Description |
| Successful request and data was returned |
| Part of the request is malformed; the exact reason can be found in the response |
| Request is not authenticated |
| Unauthorized request to access data from an ineligible plan |
| You have reached the response rate limit of your plan |
| Internal error with our servers |
With our token in hand, we can finally make the first request!
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
An example of a correctly authenticated request would be:
This request will return all of the leagues eligible for our free plan, which are the Danish Superliga (league id: 271) and the Scottish Premiership (league id: 501). You can view them by clicking on the second tab.
What can you do with the data?
The above example was the most basic of basic requests and our advanced and highly flexible football API 2.0 can handle much more than that.
With the data that our API provides you, you too will be able to create excellent applications. Below are two examples of SportMonks’ partners who have made brilliant applications. Throughout all our documentation pages you will find more examples, ranging from betting and odds websites to fantasy games and live score tracking websites.
Code libraries
There are various options as to how you’d like to send the request. Our API is compatible with an incredible number of developer languages
Last updated