FAQ

Ask additional questions using the comments box.

How do the current, last and next shortcuts behave?

For the purposes of the API, a season is assumed to begin when results become available for the first race of the season. This transition will be seen if the <season> field in URLs is set to "current".

In a similar way, the changeover point for the "last" and "next" round shortcuts occurs when a new set of race results become available. After the last race of a season the URL:

http://ergast.com/current/next/...

will refer to the first race of the following season.

Is there any restriction on how qualifiers can be combined?

A query can include any combination of the following qualifiers unless otherwise stated:

/circuits/<circuitId>
/constructors/<constructorId>
/drivers/<driverId>
/grid/<position>
/results/<position>
/fastest/<rank>
/status/<statusId>

For example:

/drivers/alonso/constructors/renault/results/1

The order of the qualifiers has no effect except that the last one determines the result type.

Season, Driver, Constructor and Standings queries can include the following qualifiers, subject to certain restrictions:

/constructorStandings/<position>
/driverStandings/<position>

The last qualifier in a query determines the type of data returned.

What happens if a round is not specified?

For Standings queries and queries which include a standings qualifier the round value defaults to the last round of each season (i.e. the final standings). Otherwise a query covers all rounds of a season.

What is the purpose of the attributes in the table elements?

All responses contain a table of some kind. The attributes of the table element define the scope of the table and reproduce the criteria specified in the original query. If a specific attribute is omitted the scope concerns all entities of that type e.g. if there is no driverId attribute the scope of the table is all drivers who match the specified criteria.

How soon after a race will data become available?

Usually in 3 – 6 hrs.

137 Responses to “FAQ”

  1. anon says:

    Hey,

    Is it possible to get the total amount of points for a driver/constructor?

    Thanks

  2. Anon 2 says:

    It is possible to rise the limit of 30 results? Thanks!

  3. Admin says:

    Yes, you can add a limit field to queries with a value up to 1000 e.g.
    http://ergast.com/api/f1/drivers?limit=100
    Use the smallest value possible for good performance.

  4. Admin says:

    It is possible to get all the points in one query but it’s slow and you need to add up the points for each year in the results e.g.
    http://ergast.com/api/f1/drivers/alonso/driverStandings

  5. John Doe says:

    The time for Vietnam Grand Prix is wrong. Also you can constantly check the time and date for other Grand Prix because COVID virus can cause some changes in the times.

  6. Admin says:

    Hi John,
    I’ve updated the calendar to reflect decisions. I’ll watch for further changes but if you spot anything let me know.
    Thanks,
    Chris

  7. Brendan Wall says:

    HI,
    I am trying to use the api to get a JSON response but keep getting XML how can i specify to get a JSON response?
    Thanks

  8. Admin says:

    Hi Brendan,
    JSON is obtained by appending “.json” to the URLs e.g.

    http://ergast.com/api/f1/current/last/results.json

    For more information see the Response formats section here:

    http://ergast.com/mrd/

    Chris
    Chris

  9. AnonB says:

    Does this also cover fp1,fp2,fp3 and qualifying? And if so how long after those sessions will the data be available

  10. Admin says:

    Hi AnonB,
    Qualifying is available from 2003 onwards. It’s usually available within 2-6 hours of the session ending. I don’t have time to process the FP data as it’s on a working day.
    Chris

  11. Malcoln says:

    Hi, thanks for the API, i’m gonna use it to build a website to study python+flask.. I’m just curious, where do you get the data from? Do you scrap f1.com?

    Thanks

  12. Peter says:

    Hi Chris,

    Is there a way to get the time the qualifying session and the actual race is? Would be great to be able to retrieve those.

  13. Admin says:

    Hi Peter,
    The race start time is in the race table.
    http://ergast.com/api/f1/current.json
    It is quite difficult to find the time of the other sessions at the time the race schedule is published. Potentially, it could be added later.
    Chris

  14. Bob says:

    Hi Chris,

    Awesome website here! I’m trying to learn getting the whole proces automated from API till BI dashboard. I was wondering whether you know about any official data accessible on;
    – pitstop insights. Like the stop duration (e.g. 2.6 sec) and changed tires, nose, etc.
    – circuit data (turns, elevation, length, etc).

    Would be great to get any of this for the analyses part. Doesn’t have to be integrated on your side.

    Bob

  15. Admin says:

    Hi Bob,
    It’s a long time since I had a look to see what was available. I recommend the FIA website – each race has a “Timing & Information” page e.g. https://www.fia.com/events/fia-formula-one-world-championship/season-2020/formula-1-70th-anniversary-grand-prix
    Chris

  16. Steve says:

    Hi Chris,

    Fantastic API you have here! Does it include live timings and intervals during the race, or is this available on the F1 website only? I am looking for this data on the web but seems it is only provided by the official page.

    Thanks!
    Steve

  17. Admin says:

    Hi Steve,
    Unfortunately we aren’t able to provide live data. It would be a reasonable thing for a sport to provide for its fans.
    Chris

  18. Bruno Freitas says:

    I’m using this URL to get all races listing https://ergast.com/api/f1/current.json on the current season, but how can I know which one of those are the last race that occurred? Do I have to compare its time with current Date()?

  19. Admin says:

    Hi Bruno,
    The last race is always: https://ergast.com/api/f1/current/last.json
    And the next race is: https://ergast.com/api/f1/current/next.json
    Cheers,
    Chris

  20. Bruno Freitas says:

    But thats not my problem, When I ping only https://ergast.com/api/f1/current.json there is no way to know which of those are the last one, So I need to ping 2 API’s just to know which races have already occurred or not. A simple way to solve that, was just adding a key like “lastRound”: 6;

    I’m missing something? Thanks a lot for your effort, this service is Awesome!!!

  21. Admin says:

    Hi Bruno,
    That’s true – but if the current/next logic was added to the schedule query it would be slower.
    Chris

  22. Aymar Tissedre says:

    Hi,

    Is it possible to retrieve the time of free practices sessions and qualifications ?

    Thanks

  23. Admin says:

    Hi Aymar,
    No – the API doesn’t include that data. It’s hard to find these times early in the season when they would be needed.
    Chris

  24. Aymar Tissedre says:

    I see. I understand the problematic.

    Thank you for the hard work though !

  25. AG says:

    Hi, just wondering if the actual queries run by the endpoints are documented anywhere? I’m trying to work out in particular the logic for a query to return the final or latest season standings and the query to return all championship winners

  26. Admin says:

    Hi AG,
    If you mean the SQL queries they’re in the runtime source code here: https://github.com/jcnewell/ergast-f1-api/tree/master/webroot/php/api
    If you mean the REST API then create your query with the web form and examine the URL it loads here: http://ergast.com/mrd/query/
    Cheers,
    Chris

  27. FCB says:

    Hi,

    Is there a way to fetch a flat table from the API?
    like the standings table?
    to get just the foreign keys id’s and not the whole related tables data?

    Thanks!

  28. Admin says:

    Hi FCB,
    Not from the API – but you can download the CSV files here: http://ergast.com/mrd/db/
    There’s one file per table.
    Chris

  29. Sergey says:

    Hello, I have a couple of questions.
    1. how do you get your data? parse the f1 website?
    2. will information on tire types and sectors Be available?
    3. If not, where can I find this information?

  30. Admin says:

    Hi Sergey,
    The data is from various public sources. IIRC the sector times are available from https://www.fia.com but I’ve never found a reliable source of tyre data.
    Chris

  31. Ian says:

    Hello,

    Firstly, thank you for the API, it’s fantastic.

    I noticed a possible issue with the Alpha Tauri constructor id. It seems that the constructor id changes from “alphatauri” to “alpha_tauri” in the API return for qualifying since round 12 of the current season.

    Is this something that can be fixed or should I adjust my system to account for the possibility?

    Thanks,

    Ian

  32. Admin says:

    Hi Ian,
    Thanks for the warning. It was an error – now corrected.
    Chris

  33. Stefano says:

    Hi,
    I’m programming in javascript, how can I get the identification code to access the API ??
    Example:
    xhttp.setRequestHeader (“X-Auth-Token”, “identification code”);
    Thanks

  34. arek says:

    Hello,
    data in the API is available in few hours after the race, but what with the .csv files? how much time it take to make .csv file up to date?
    Thanks for great job
    Arek

  35. Admin says:

    Hi Stefano,
    You don’t need any authentication code to access the API. Can you explain a little more about the issue you are experiencing?
    Chris

  36. Admin says:

    Hi Arek,
    All the database dumps are available around the time the data becomes available unless there are technical issues.
    Chris

  37. Stefano says:

    Fixed thanks anyway

Add a Comment: