{
  "openapi": "3.1.0",
  "info": {
    "title": "Marathon Scout race data API",
    "version": "1.0.0",
    "summary": "Marathons, half marathons and ultras: next race dates, registration status, and official registration, results and live tracking links.",
    "description": "Read-only race data checked against each race's own pages. Use it to look races up as your users need them, not to copy the directory.\n\nDefault limits per key: 200 calls a day and 20 a minute (shared with the MCP server), and up to 150 different races a day. The X-RateLimit-Remaining-Day header shows what's left today.\n\nCredit \"Race data from Marathon Scout (marathonscout.com)\" wherever you show the data and link the race's guide_url. Send runners to official pages for entry, and don't cache responses for more than 24 hours.\n\nRegistration status applies to the edition named in registration.edition_year. unknown means not confirmed, never closed.\n\nLinks under marathonscout.com/go open the race's current official page when clicked and end in ?via=api; give them to runners as returned. official_url names the destination.\n\nGet a free key at https://marathonscout.com/developers. An MCP server with the same data is at https://marathonscout.com/api/mcp (https://marathonscout.com/developers/mcp).",
    "termsOfService": "https://marathonscout.com/developers#terms",
    "contact": {
      "name": "Marathon Scout",
      "email": "marathonscout@agentmail.to",
      "url": "https://marathonscout.com/developers"
    }
  },
  "externalDocs": {
    "description": "API reference",
    "url": "https://marathonscout.com/developers/api"
  },
  "servers": [
    {
      "url": "https://marathonscout.com/api/v1"
    }
  ],
  "security": [
    {
      "bearerKey": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "paths": {
    "/races": {
      "get": {
        "operationId": "searchRaces",
        "summary": "Search races",
        "description": "Filter by name, place, distance, ultra type, date window, Boston qualifying or distance from a place. Results are ordered by query relevance, then nearest (for near with no dates), otherwise by next race date. Races whose next date isn't announced but whose last edition falls in the window are included with next_race null and a next_race_note.",
        "parameters": [
          {
            "in": "query",
            "required": false,
            "name": "query",
            "description": "Race name or place, e.g. chicago or big sur. Words like 2027 or registration are ignored; longer than 100 characters is cut.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "distance",
            "description": "Race distance category.",
            "schema": {
              "type": "string",
              "enum": [
                "marathon",
                "half_marathon",
                "ultramarathon"
              ]
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "ultra_type",
            "description": "One kind of ultra: 50k, 50-mile, 100k, 100-mile, 200-mile, other (fixed distances outside those ranges), timed or backyard. Each fixed type includes races close to the standard (a 55K is in 50k). A race matches only once its distance is recorded, so leave it out to see every ultra. Unknown values are a 400.",
            "schema": {
              "type": "string",
              "enum": [
                "50k",
                "50-mile",
                "100k",
                "100-mile",
                "200-mile",
                "other",
                "timed",
                "backyard"
              ]
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "country",
            "description": "ISO 3166-1 alpha-2 code or English name, e.g. US or Japan.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "region",
            "description": "State or region as written locally, e.g. Ohio or Bavaria.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "from",
            "description": "Start of the next-race-date window, YYYY-MM-DD.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "to",
            "description": "End of the next-race-date window, YYYY-MM-DD.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "boston_qualifier",
            "description": "true for Boston qualifying courses only; false for courses confirmed not to qualify.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "looking_for",
            "description": "What the runner needs next. Each race then also carries that link: registration, latest_results or live_tracking. Unknown values are ignored.",
            "schema": {
              "type": "string",
              "enum": [
                "registration",
                "results",
                "live_tracking"
              ]
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "near",
            "description": "A place to search around, e.g. Austin, Texas. Results add distance_miles; with no date window they come nearest first.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "radius_miles",
            "description": "Search radius around near, in miles (default 100, up to 500; out-of-range values are clamped, not rejected). Requires near.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "radius_km",
            "description": "The same radius in kilometres, if radius_miles isn't given. Requires near.",
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "limit",
            "description": "How many races to return. Out-of-range values are clamped, not rejected.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 20
            }
          },
          {
            "in": "query",
            "required": false,
            "name": "offset",
            "description": "Skip this many matches. Pass the previous response's next_offset to get the next page. Out-of-range values are clamped, not rejected.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching races.",
            "headers": {
              "X-RateLimit-Remaining-Day": {
                "schema": {
                  "type": "integer"
                },
                "description": "Calls left on this key today."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter, e.g. a bad date or an unknown place for near.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or inactive key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "A daily, per-minute or distinct-race limit was reached, or too many requests came from one network. The error explains which and when it resets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/races/{slug}": {
      "get": {
        "operationId": "getRace",
        "summary": "One race",
        "description": "Every stored date, the next edition's registration status with when it was checked, Boston-qualifier status, and registration, results and live tracking links.",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "description": "Race slug from a search result, e.g. new-york-city-marathon.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]{1,120}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The race.",
            "headers": {
              "X-RateLimit-Remaining-Day": {
                "schema": {
                  "type": "integer"
                },
                "description": "Calls left on this key today."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RaceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or inactive key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No race with that slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "A daily, per-minute or distinct-race limit was reached, or too many requests came from one network.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer msk_... Get a free key at https://marathonscout.com/developers."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "The same key in an X-API-Key header, if Bearer is awkward."
      }
    },
    "schemas": {
      "Attribution": {
        "type": "object",
        "required": [
          "text",
          "required"
        ],
        "properties": {
          "text": {
            "type": "string",
            "const": "Race data from Marathon Scout (marathonscout.com)"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The race's Marathon Scout guide (per race)."
          },
          "terms": {
            "type": "string",
            "format": "uri",
            "description": "API terms (per response)."
          },
          "required": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "Registration": {
        "type": "object",
        "required": [
          "edition_year",
          "status",
          "methods",
          "checked_at",
          "official_url",
          "register_url",
          "note"
        ],
        "properties": {
          "edition_year": {
            "type": "integer",
            "description": "The edition this status applies to."
          },
          "status": {
            "type": "string",
            "enum": [
              "unknown",
              "not_open",
              "open",
              "limited",
              "waitlist",
              "sold_out",
              "closed",
              "no_public_entry"
            ]
          },
          "methods": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "open_entry",
                "lottery",
                "time_qualifier",
                "charity",
                "tour_operator",
                "guaranteed_entry",
                "invitation",
                "other"
              ]
            },
            "description": "How entry works, separate from whether it's available."
          },
          "checked_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "When the status was last checked on the race's own pages."
              },
              {
                "type": "null"
              }
            ]
          },
          "official_url": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "description": "The official registration page."
              },
              {
                "type": "null"
              }
            ]
          },
          "register_url": {
            "oneOf": [
              {
                "type": "string",
                "format": "uri",
                "description": "Stable marathonscout.com/go link to the official registration page. Give runners this one."
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": "string",
            "description": "Plain-language reading of the status."
          },
          "last_known": {
            "type": "object",
            "description": "An older checked status, when the current check is out of date.",
            "properties": {
              "year": {
                "oneOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string"
              },
              "checked_at": {
                "oneOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      },
      "ResultsLink": {
        "type": "object",
        "required": [
          "year",
          "url",
          "official_url",
          "race_completed"
        ],
        "properties": {
          "year": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Stable marathonscout.com/go link to that year's official results."
          },
          "official_url": {
            "type": "string",
            "format": "uri",
            "description": "The official results page."
          },
          "race_completed": {
            "type": "boolean"
          }
        }
      },
      "LiveTracking": {
        "type": "object",
        "required": [
          "year",
          "url",
          "official_url",
          "note"
        ],
        "properties": {
          "year": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Stable marathonscout.com/go link to the official tracker."
          },
          "official_url": {
            "type": "string",
            "format": "uri",
            "description": "The official tracker."
          },
          "note": {
            "type": "string"
          }
        }
      },
      "RaceSummary": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "distance",
          "format",
          "distance_label",
          "ultra_type",
          "race_distance_km",
          "race_distance_miles",
          "duration_hours",
          "time_limit_hours",
          "location",
          "city",
          "region",
          "country",
          "country_name",
          "next_race",
          "held_every_years",
          "championships",
          "registration_status",
          "guide_url"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "distance": {
            "type": "string",
            "enum": [
              "marathon",
              "half_marathon",
              "ultramarathon"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "fixed_distance",
              "timed",
              "backyard"
            ],
            "description": "For timed and backyard races, dates are start dates."
          },
          "distance_label": {
            "oneOf": [
              {
                "type": "string",
                "description": "How the race names its distance: 50K, 100 mile, 24 hour, 6 day or Backyard. Show runners this, never a converted number. Null when not recorded (marathons and halves, and ultras whose distance isn't recorded yet)."
              },
              {
                "type": "null"
              }
            ]
          },
          "ultra_type": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "50k",
                  "50-mile",
                  "100k",
                  "100-mile",
                  "200-mile",
                  "other",
                  "timed",
                  "backyard"
                ],
                "description": "The ultra type used by ultra_type searches; null when not known."
              },
              {
                "type": "null"
              }
            ]
          },
          "race_distance_km": {
            "oneOf": [
              {
                "type": "number",
                "description": "The race's distance in kilometres, for comparing and sorting only."
              },
              {
                "type": "null"
              }
            ]
          },
          "race_distance_miles": {
            "oneOf": [
              {
                "type": "number",
                "description": "The race's distance in miles, for comparing and sorting only. Not the same as distance_miles, which is the distance from near."
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_hours": {
            "oneOf": [
              {
                "type": "number",
                "description": "Timed races: the set duration in hours."
              },
              {
                "type": "null"
              }
            ]
          },
          "time_limit_hours": {
            "oneOf": [
              {
                "type": "number",
                "description": "Official course time limit for this distance in hours (6.5 = 6:30). Null when not published or not yet checked."
              },
              {
                "type": "null"
              }
            ]
          },
          "held_every_years": {
            "oneOf": [
              {
                "type": "integer",
                "description": "Years between editions when the race isn't held every year (2 = every other year, 4 = the U.S. Olympic Team Trials). Null for an annual race."
              },
              {
                "type": "null"
              }
            ]
          },
          "championships": {
            "type": "array",
            "description": "Championships this race hosts, by edition year (a USATF, European or World Athletics title race). Empty for most races. A label applies to its year only.",
            "items": {
              "type": "object",
              "required": [
                "year",
                "name",
                "source"
              ],
              "properties": {
                "year": {
                  "type": "integer"
                },
                "name": {
                  "type": "string",
                  "description": "As the championship body names it, e.g. USATF Marathon Championships."
                },
                "source": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "The championship body's page naming this race as host."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "location": {
            "type": "string"
          },
          "city": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "region": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2."
          },
          "country_name": {
            "type": "string"
          },
          "next_race": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "year",
                  "date",
                  "status"
                ],
                "properties": {
                  "year": {
                    "type": "integer"
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "status": {
                    "type": "string",
                    "description": "confirmed, tbd, canceled or another stored date status."
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "last_race": {
            "type": "object",
            "properties": {
              "year": {
                "type": "integer"
              },
              "date": {
                "type": "string",
                "format": "date"
              }
            },
            "description": "Present when the next date isn't announced."
          },
          "next_race_note": {
            "type": "string",
            "description": "Present when the next date isn't announced. Don't present last_race as the next date."
          },
          "registration_status": {
            "type": "string",
            "enum": [
              "unknown",
              "not_open",
              "open",
              "limited",
              "waitlist",
              "sold_out",
              "closed",
              "no_public_entry"
            ]
          },
          "guide_url": {
            "type": "string",
            "format": "uri",
            "description": "The race's Marathon Scout guide. Link it when you credit the data."
          },
          "distance_miles": {
            "type": "integer",
            "description": "Straight-line miles from near, when given."
          },
          "registration": {
            "$ref": "#/components/schemas/Registration",
            "description": "With looking_for=registration."
          },
          "latest_results": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ResultsLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "With looking_for=results."
          },
          "live_tracking": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LiveTracking"
              },
              {
                "type": "null"
              }
            ],
            "description": "With looking_for=live_tracking."
          }
        }
      },
      "RaceDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RaceSummary"
          },
          {
            "type": "object",
            "required": [
              "dates",
              "registration",
              "official_website",
              "live_tracking",
              "results",
              "results_page_url",
              "boston_qualifier",
              "updated_at",
              "attribution"
            ],
            "properties": {
              "dates": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "year",
                    "date",
                    "status"
                  ],
                  "properties": {
                    "year": {
                      "type": "integer"
                    },
                    "date": {
                      "type": "string",
                      "format": "date"
                    },
                    "status": {
                      "type": "string",
                      "description": "confirmed, tbd, canceled or another stored date status."
                    }
                  }
                }
              },
              "registration": {
                "$ref": "#/components/schemas/Registration"
              },
              "official_website": {
                "oneOf": [
                  {
                    "type": "string",
                    "format": "uri",
                    "description": "The race's own website."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "live_tracking": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/LiveTracking"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ResultsLink"
                },
                "description": "Newest first."
              },
              "results_page_url": {
                "type": "string",
                "format": "uri",
                "description": "The race's Marathon Scout results page."
              },
              "boston_qualifier": {
                "type": "string",
                "enum": [
                  "yes",
                  "no",
                  "unknown"
                ]
              },
              "updated_at": {
                "oneOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "attribution": {
                "$ref": "#/components/schemas/Attribution"
              }
            }
          }
        ]
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "count",
          "total",
          "next_offset",
          "races",
          "attribution"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "total": {
            "type": "integer",
            "description": "All matches, across pages."
          },
          "next_offset": {
            "oneOf": [
              {
                "type": "integer",
                "description": "Pass as offset for the next page; null on the last page."
              },
              {
                "type": "null"
              }
            ]
          },
          "near": {
            "type": "object",
            "description": "Present with near: the place searched around.",
            "properties": {
              "place": {
                "type": "string"
              },
              "radius_miles": {
                "type": "integer"
              },
              "other_places_with_this_name": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "races": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RaceSummary"
            }
          },
          "tip": {
            "type": "string",
            "description": "Present when a named search finds nothing: which filter (country, region, distance, ultra type, dates) left out the races the name alone finds, and a few of them."
          },
          "attribution": {
            "$ref": "#/components/schemas/Attribution"
          }
        }
      },
      "RaceResponse": {
        "type": "object",
        "required": [
          "race",
          "attribution"
        ],
        "properties": {
          "race": {
            "$ref": "#/components/schemas/RaceDetail"
          },
          "attribution": {
            "$ref": "#/components/schemas/Attribution"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "docs"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "docs": {
            "type": "string",
            "format": "uri",
            "description": "Developer page."
          },
          "get_more": {
            "type": "object",
            "description": "On 429: how to ask for higher limits.",
            "properties": {
              "email": {
                "type": "string"
              },
              "how": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}