The F1 Circuits API, by example
F1 Circuits serves the layout of every Formula 1 circuit, one per period the track was raced in, traced by GPS: as an SVG drawing, a PNG image and the GeoJSON trace itself. On top of the layouts it renders race and season posters, session thumbnails and a Kometa metadata file for a Formula 1 library in Plex.
The public address is https://f1-circuits.zurag.be. Every route is a
plain GET, needs no key, and allows any origin (CORS), so a page anywhere can call it from the browser.
Each page below makes real calls and shows the exact URL it sends next to the answer: copy it into a terminal
(curl -O <url>) or a page of your own.
The examples
Circuit browser
Walk the catalogue: countries, their cities, the circuits there and each circuit’s layouts, with every layout’s track image.
/circuits/circuits/{country}/circuits/{country}/{city}/circuits/{country}/{city}/{circuit}/circuits/{country}/{city}/{circuit}/layout/{layout}
Track images
One layout’s file in SVG, PNG or GeoJSON, chosen by its layout or by a year the circuit was raced.
/circuits/{country}/{city}/{circuit}/layout/{layout}/{format}/tracks/{country}/{city}/{circuit}/year/{year}/{format}
GPS traces on a map
Draw a layout’s GeoJSON trace on an OpenStreetMap or satellite map, with its length and start point.
/circuits/{country}/{city}/{circuit}/layout/{layout}/geojson
Grand prix lookup
Name a race and a season; the API finds the circuit and the layout raced that year.
/grand-prix/{race name}/{season}/{format}
Posters
Race posters on five backgrounds, season posters and a thumbnail per session of a race weekend, rendered on request.
/posters/race/{race name}/{season}.png?bg={aerial|osm|dark|light|none}/posters/season/{season}.png/posters/session/{race name}/{season}/{session}.png
Kometa metadata
The metadata file that gives a Plex Formula 1 library every poster and thumbnail above, and how Kometa uses it.
/kometa/formula-1-metadata.yml
Library
Browse a Formula 1 library as Plex or Emby shows it: seasons, race weekends and sessions, from the Kometa file and the posters.
/kometa/formula-1-metadata.yml/posters/season/{season}.png/posters/race/{race name}/{season}.png/posters/session/{race name}/{season}/{session}.png
Choosing which API a page calls
One helper (site.js) picks the address for every page, in this order:
?api=<base>in the page’s address wins, such as?api=http://127.0.0.1:8000. Links between the pages keep it.- A page opened from disk (
file://) calls the public service,https://f1-circuits.zurag.be. - A page served over http(s), as the API serves these pages at
/examples/, calls its own origin with relative URLs.
The address in use is in the header, top right; open it to change it.
The API’s own index
The root route lists the routes and where these examples live.
Words used here
| Country, city, circuit | Slugs in lower case with hyphens, as the /circuits routes list them (belgium, spa, circuit-de-spa-francorchamps). A slug may hold accented letters; encode it in a URL. |
|---|---|
| Layout | One shape of a circuit, named by the years it was raced: 1950-1970, 1983- (1983 until today), or a single year. |
| Format | svg, png or geojson. |
| Race name | The race’s name exactly as Jolpica (the Ergast successor) writes it, such as Belgian Grand Prix; the API reads the season’s schedule there. |