Skip to content

Race Data

Read a race's course line and elevation profile

The official course as GeoJSON, the GPX file it is drawn from, measured distance and climb, and the elevation profile. No key. Published races only; 403 open_data_off when the organizer has turned open data off.

Method

GET

Path

/api/public/v1/events/{idOrSlug}/course

Authentication

None. Served from https://www.endurancehq.app with open CORS.

Caching

CDN 5 minutes, purged when the organizer edits the course; 30 seconds while building.

Request

curl "https://www.endurancehq.app/api/public/v1/events/{idOrSlug}/course"

Path parameters

idOrSlugstring, required

Query schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "raceOptionId": {
      "description": "The distance. Without it, the event's only distance, else the event level.",
      "type": "string"
    }
  },
  "additionalProperties": false
}

Response

Success status: 200

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "event": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "timezone": {
          "description": "IANA zone the race's wall-clock times are stated in.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "slug",
        "name",
        "timezone"
      ],
      "additionalProperties": false
    },
    "raceOption": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "The distance this answer is for; null for the event level."
    },
    "raceOptions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "distance": {
            "type": [
              "number",
              "null"
            ]
          },
          "distanceUnit": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "distance",
          "distanceUnit"
        ],
        "additionalProperties": false
      },
      "description": "Every distance of the event, to ask per distance with raceOptionId."
    },
    "status": {
      "type": "string",
      "enum": [
        "ready",
        "building"
      ],
      "description": "building: the file's stats are being computed; line and profile are null, ask again in a minute."
    },
    "course": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "gpxUrl": {
              "description": "The GPX file the course is drawn from.",
              "type": [
                "string",
                "null"
              ]
            },
            "courseMapUrl": {
              "type": [
                "string",
                "null"
              ]
            },
            "distanceMiles": {
              "description": "Measured along the track.",
              "type": [
                "number",
                "null"
              ]
            },
            "elevationGainFt": {
              "description": "Null when the file carries no usable elevation.",
              "type": [
                "number",
                "null"
              ]
            },
            "elevationLossFt": {
              "type": [
                "number",
                "null"
              ]
            },
            "statedDistance": {
              "description": "As the organizer wrote it.",
              "type": [
                "string",
                "null"
              ]
            },
            "statedElevationGain": {
              "type": [
                "string",
                "null"
              ]
            },
            "statedElevationLoss": {
              "type": [
                "string",
                "null"
              ]
            },
            "start": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "lat": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "lon": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "lat",
                    "lon",
                    "name"
                  ],
                  "additionalProperties": false,
                  "description": "A stated place: its name, and its pin when it has one."
                },
                {
                  "type": "null"
                }
              ]
            },
            "finish": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "lat": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "lon": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "lat",
                    "lon",
                    "name"
                  ],
                  "additionalProperties": false,
                  "description": "A stated place: its name, and its pin when it has one."
                },
                {
                  "type": "null"
                }
              ]
            },
            "computedAt": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "gpxUrl",
            "courseMapUrl",
            "distanceMiles",
            "elevationGainFt",
            "elevationLossFt",
            "statedDistance",
            "statedElevationGain",
            "statedElevationLoss",
            "start",
            "finish",
            "computedAt"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "components": {
      "description": "A challenge bundle's distances; the first with a route is drawn.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "raceOptionId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "gpxUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "raceOptionId",
          "name",
          "gpxUrl"
        ],
        "additionalProperties": false
      }
    },
    "line": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "FeatureCollection"
            },
            "features": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "Feature"
                  },
                  "properties": {
                    "type": "object",
                    "properties": {
                      "trackIndex": {
                        "type": "number"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "primary": {
                        "type": "boolean"
                      },
                      "distanceMiles": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "trackIndex",
                      "name",
                      "primary",
                      "distanceMiles"
                    ],
                    "additionalProperties": false
                  },
                  "geometry": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "LineString"
                      },
                      "coordinates": {
                        "type": "array",
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "number"
                          }
                        },
                        "description": "[longitude, latitude, elevation in metres]; elevation only when known."
                      }
                    },
                    "required": [
                      "type",
                      "coordinates"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "properties",
                  "geometry"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "type",
            "features"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "GeoJSON (RFC 7946), simplified to a 2 m tolerance."
    },
    "elevationProfile": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "elevationKnown": {
              "type": "boolean"
            },
            "elevationSource": {
              "type": "string",
              "enum": [
                "gpx",
                "terrain"
              ]
            },
            "minFt": {
              "type": "number"
            },
            "maxFt": {
              "type": "number"
            },
            "totalMiles": {
              "type": "number"
            },
            "points": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "mile": {
                    "type": "number"
                  },
                  "elevationFt": {
                    "type": "number"
                  },
                  "gradePercent": {
                    "type": "number"
                  },
                  "gainFt": {
                    "type": "number"
                  },
                  "lossFt": {
                    "type": "number"
                  },
                  "lat": {
                    "type": "number"
                  },
                  "lon": {
                    "type": "number"
                  }
                },
                "required": [
                  "mile",
                  "elevationFt",
                  "gradePercent",
                  "gainFt",
                  "lossFt",
                  "lat",
                  "lon"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "elevationKnown",
            "elevationSource",
            "minFt",
            "maxFt",
            "totalMiles",
            "points"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "At most 1,200 points, keeping summits and valley floors."
    },
    "attribution": {
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "const": "Endurance HQ"
        },
        "eventUrl": {
          "type": "string",
          "description": "The race's official site; link it wherever the data is shown."
        },
        "contributors": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "standing": {
                "description": "What they are to the race, such as \"2025 finisher, Sunlight aid station volunteer\".",
                "type": [
                  "string",
                  "null"
                ]
              },
              "credit": {
                "type": "string",
                "description": "The credit line to show: \"Course notes by Jackson Strand, 2025 finisher, Sunlight aid station volunteer\"."
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Fields their published corrections changed, such as crewNotes or durationMinutes."
              }
            },
            "required": [
              "name",
              "standing",
              "credit",
              "fields"
            ],
            "additionalProperties": false,
            "description": "Someone whose correction the race organizer reviewed and published."
          },
          "description": "Everyone whose course corrections the organizer published for this race."
        }
      },
      "required": [
        "provider",
        "eventUrl",
        "contributors"
      ],
      "additionalProperties": false,
      "description": "Who to credit wherever this data is shown."
    }
  },
  "required": [
    "event",
    "raceOption",
    "raceOptions",
    "status",
    "course",
    "line",
    "elevationProfile",
    "attribution"
  ],
  "additionalProperties": false
}