Quickstart: your first MotoGP API call
Subscribe on RapidAPI, send two headers and read the current MotoGP championship standings in curl, JavaScript or Python.
5 min read
This guide takes you from zero to a working request in about five minutes. You need a RapidAPI account and a terminal.
1. Subscribe and copy your key
- Open the MotoGP API on RapidAPI and pick a plan.
- In the RapidAPI playground, copy the value of X-RapidAPI-Key. That key identifies your subscription; RapidAPI meters your quota against it.
Store the key in an environment variable instead of pasting it into code:
export RAPIDAPI_KEY="paste-your-key-here"
2. Send your first request
Every request needs two headers: your key and the API host.
curl -s "https://motogp-api-championship-data-statistics.p.rapidapi.com/standings/seasons/2026/riders?category=MOTOGP" \
-H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
-H "X-RapidAPI-Host: motogp-api-championship-data-statistics.p.rapidapi.com"
The response is the 2026 MotoGP riders’ championship, already ordered by position:
{
"data": [
{
"position": 1,
"total_points": 365,
"wins": 6,
"podiums": 6,
"season_year": 2026,
"rider_name": "Marc Márquez",
"rider_number": 93,
"team_name": "Ducati Lenovo Team",
"category": "MOTOGP"
}
],
"meta": { "total": 32, "page": null, "size": null, "total_pages": null }
}
3. Don’t hard-code the season
GET /seasons/latest returns the most recent season, so your code keeps working when a new
championship starts. Chain it with the standings call:
JavaScript (Node.js 18+)
const HOST = "motogp-api-championship-data-statistics.p.rapidapi.com";
const headers = {
"X-RapidAPI-Key": process.env.RAPIDAPI_KEY,
"X-RapidAPI-Host": HOST,
};
async function get(path) {
const res = await fetch(`https://${HOST}${path}`, { headers });
const body = await res.json();
if (!res.ok) throw new Error(`${res.status} ${body.message ?? res.statusText}`);
return body.data;
}
const season = await get("/seasons/latest");
const standings = await get(`/standings/seasons/${season.year}/riders?category=MOTOGP`);
for (const row of standings.slice(0, 5)) {
console.log(`${row.position}. ${row.rider_name} (#${row.rider_number}) – ${row.total_points} pts`);
}
Python
import os
import requests
HOST = "motogp-api-championship-data-statistics.p.rapidapi.com"
HEADERS = {"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST}
def get(path: str, **params):
res = requests.get(f"https://{HOST}{path}", headers=HEADERS, params=params, timeout=10)
res.raise_for_status()
return res.json()["data"]
season = get("/seasons/latest")
standings = get(f"/standings/seasons/{season['year']}/riders", category="MOTOGP")
for row in standings[:5]:
print(f"{row['position']}. {row['rider_name']} (#{row['rider_number']}) – {row['total_points']} pts")
Output:
1. Marc Márquez (#93) – 365 pts
2. Jorge Martín (#89) – 355 pts
3. Marco Bezzecchi (#72) – 315 pts
...
Next steps
- Read Conventions for categories, paging, errors and caching.
- Build a standings table for your site.
- Browse every endpoint in the MotoGP API reference.