Top Assist Providers
Learn how to get the top assists providers for a league or cup.
We'll cover the following
An assist provider is a player who creates the pass that gets converted into a goal. Using Api-Football, we can get a list of these unsung heroes for different leagues.
We use the Top Assists endpoint to get the 20 best assist providers for a league or a cup. This endpoint provides the players’ information and their statistics, including the number of appearances, the number of key passes provided, and the number of assists provided. The base URI for this endpoint is https://v3.football.api-sports.io/players/topassists
.
This endpoint is updated several times a week.
If the players have a similar number of assists, the players are ranked based on the following criteria:
- The player that has scored more goals.
- The player that has scored fewer penalties.
- The player that provided assists in a higher number of matches.
- The player that played fewer minutes.
- The player that received fewer red cards.
- The player that received fewer yellow cards.
Request parameters
We can use the following query parameters with the top assists endpoint:
Parameters | Type | Category | Description |
| Integer | Required | This is the ID of the league whose top assisters we want. We can get the ID of the league using the Leagues endpoint. |
| Integer | Required | This is the year we want to see the top assisters for. The format for this input is "YYYY." |
We use the league
and season
parameters with the Top Assists endpoint to get the top assists providers of a league for the specified season.
const date = new Date();const endpointUrl = new URL('https://v3.football.api-sports.io/players/topassists');const queryParameters = new URLSearchParams({league:'61', // 61 is the league id for France's League 1season: date.getFullYear()});headerParameters = {'x-rapidapi-host': 'v3.football.api-sports.io','x-rapidapi-key': '{{API_KEY}}'}const options = {method: 'GET',headers: headerParameters};async function fetchTopAssisters() {try {endpointUrl.search = queryParameters;const response = await fetch(endpointUrl, options);printResponse(response);}catch (error) {printError(error);}}fetchTopAssisters();
Following is a brief explanation of the code:
Line 2: We set the URL to
https://v3.football.api-sports.io/players/topassists
.Lines 4–12: We define the query parameters and header parameters. We can change the league ID in line 5 to get top assist providers from a different league. To get the top assist providers for a different season, we will change the year in line 6.
Lines 14–17: We set the request type and appropriate header.
Lines 19–28: We define a function,
fetchTopAssisters()
, that calls the endpoint and prints the response.
Note: We can get the league ID using the Leagues endpoint, as explained in the Support Endpoints lesson in the Appendix.
Response fields
The table below contains some important response fields of this endpoint:
Response Fields | Type | Description |
| Object | This contains information about the top assist providers by rank. |
| Object | This contains stats related to the player. |
Note: The detail about the elements in these objects is discussed in the Response Elements lesson in the Appendix.