{
  "openapi": "3.0.3",
  "info": {
    "title": "RunDida API",
    "description": "Free JSON API for running & marathon data — 300+ marathon events (course, weather, registration), 102 calculator references and 68 training guides. No auth, CORS enabled. Live calculations (pace, heart-rate zones, race predictions) via the companion MCP server: npx @rundida/mcp-server",
    "version": "1.1.0",
    "contact": {
      "name": "RunDida",
      "url": "https://rundida.com"
    },
    "license": {
      "name": "MIT"
    }
  },
  "servers": [
    {
      "url": "https://rundida.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/tools.json": {
      "get": {
        "summary": "List all running tools",
        "description": "Returns metadata for all 102 running calculators and tools.",
        "operationId": "listTools",
        "tags": ["Tools"],
        "responses": {
          "200": {
            "description": "Tool list with metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total": { "type": "integer" },
                        "generated": { "type": "string", "format": "date" }
                      }
                    },
                    "tools": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/ToolSummary" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/tools/{slug}.json": {
      "get": {
        "summary": "Get tool details",
        "description": "Returns full details for a specific tool including FAQs, related tools, and sources.",
        "operationId": "getTool",
        "tags": ["Tools"],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "Tool slug, e.g. pace-calculator"
          }
        ],
        "responses": {
          "200": {
            "description": "Tool detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tool": { "$ref": "#/components/schemas/ToolDetail" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/marathons.json": {
      "get": {
        "summary": "List all marathons",
        "description": "Returns all active and archived marathon events with dates and locations.",
        "operationId": "listMarathons",
        "tags": ["Marathons"],
        "responses": {
          "200": {
            "description": "Marathon list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "totalActive": { "type": "integer" },
                        "totalArchived": { "type": "integer" }
                      }
                    },
                    "active": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/MarathonSummary" }
                    },
                    "archived": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/MarathonSummary" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/guides.json": {
      "get": {
        "summary": "List all running guides",
        "description": "Returns metadata for all 68 running guides and educational articles.",
        "operationId": "listGuides",
        "tags": ["Guides"],
        "responses": {
          "200": {
            "description": "Guide list with metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total": { "type": "integer" },
                        "generated": { "type": "string", "format": "date" }
                      }
                    },
                    "guides": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/GuideSummary" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/marathons/{id}.json": {
      "get": {
        "summary": "Get marathon details",
        "description": "Returns full details for a specific marathon including Schema.org SportsEvent data.",
        "operationId": "getMarathon",
        "tags": ["Marathons"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "Marathon ID, e.g. tokyo2026"
          }
        ],
        "responses": {
          "200": {
            "description": "Marathon detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "marathon": { "$ref": "#/components/schemas/MarathonDetail" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ToolSummary": {
        "type": "object",
        "properties": {
          "slug": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "category": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "apiUrl": { "type": "string", "format": "uri" },
          "keywords": { "type": "array", "items": { "type": "string" } },
          "printable": { "type": "boolean" },
          "featured": { "type": "boolean" }
        }
      },
      "ToolDetail": {
        "type": "object",
        "properties": {
          "slug": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "category": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "keywords": { "type": "array", "items": { "type": "string" } },
          "relatedTools": { "type": "array", "items": { "type": "string" } },
          "relatedMarathons": { "type": "array", "items": { "type": "string" } },
          "faqs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "question": { "type": "string" },
                "answer": { "type": "string" }
              }
            }
          },
          "sources": { "type": "array" }
        }
      },
      "GuideSummary": {
        "type": "object",
        "properties": {
          "slug": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "category": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "keywords": { "type": "array", "items": { "type": "string" } },
          "relatedTools": { "type": "array", "items": { "type": "string" } }
        }
      },
      "MarathonSummary": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "object" },
          "date": { "type": "string", "format": "date" },
          "city": { "type": "string" },
          "country": { "type": "string" },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "MarathonDetail": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "object" },
          "date": { "type": "string", "format": "date" },
          "timezone": { "type": "string" },
          "city": { "type": "string" },
          "country": { "type": "string", "description": "Country or region" },
          "theme": { "type": "string" },
          "weather": {
            "type": "object",
            "properties": {
              "avgTempC": { "type": "number" },
              "avgTempF": { "type": "number" },
              "humidity": { "type": "integer" },
              "windKmh": { "type": "number" },
              "precipPct": { "type": "integer" },
              "conditions": { "type": "string" }
            }
          },
          "course": {
            "type": "object",
            "properties": {
              "type": { "type": "string" },
              "elevationGain": { "type": "integer" },
              "profile": { "type": "string" },
              "terrain": { "type": "string" }
            }
          },
          "links": {
            "type": "object",
            "properties": {
              "page": { "type": "string", "format": "uri" },
              "countdown": { "type": "string", "format": "uri" },
              "api": { "type": "string", "format": "uri" }
            }
          }
        }
      }
    }
  }
}
