{
  "openapi": "3.1.0",
  "info": {
    "title": "Time to Stable API",
    "version": "2.0.0",
    "description": "Programmatic API for measuring cross-browser web platform stability velocity, Kaplan-Meier survival estimates, Baseline momentum, and individual feature timelines.",
    "contact": {
      "name": "Paul Kinlan",
      "url": "https://paul.kinlan.me/"
    }
  },
  "servers": [
    {
      "url": "https://timetostable.com"
    }
  ],
  "paths": {
    "/api/meta": {
      "get": {
        "operationId": "getMetadata",
        "summary": "Get active BCD and web-features versions, data source, sync status, and release history.",
        "responses": {
          "200": {
            "description": "Dataset metadata and snapshot history"
          }
        }
      }
    },
    "/api/compare": {
      "get": {
        "operationId": "compareBrowsers",
        "summary": "Compare cross-browser time-to-stable statistics across browsers and specification categories.",
        "parameters": [
          {
            "name": "browsers",
            "in": "query",
            "description": "Comma-separated browser IDs (e.g. chrome,firefox,safari)",
            "schema": {
              "type": "string",
              "default": "chrome,firefox,safari"
            }
          },
          {
            "name": "categories",
            "in": "query",
            "description": "Comma-separated categories: api,css,html,http,javascript,webassembly",
            "schema": {
              "type": "string",
              "default": "api,css,html,javascript"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bcd",
                "web-features"
              ],
              "default": "bcd"
            }
          },
          {
            "name": "exclude-partial",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "on"
              ]
            }
          },
          {
            "name": "include-prefixed",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "on"
              ]
            }
          },
          {
            "name": "include-flagged",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "on"
              ]
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Minimum first-landing year filter",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Statistical summary, survival curve, cross-tab, and top sample rows"
          },
          "400": {
            "description": "Invalid browser or category selection"
          }
        }
      }
    },
    "/api/stats": {
      "get": {
        "operationId": "getStats",
        "summary": "Compute full statistical summary using either browser-*/feature-* or comma-separated query parameters.",
        "responses": {
          "200": {
            "description": "Full AnalysisSummary JSON"
          },
          "400": {
            "description": "Invalid parameters"
          }
        }
      }
    },
    "/api/features": {
      "get": {
        "operationId": "listFeatures",
        "summary": "Search, filter, sort, and paginate evaluated web features or BCD keys.",
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "stable",
                "not-stable",
                "when-stable",
                "experimental",
                "deprecated",
                "removed",
                "all"
              ]
            }
          },
          {
            "name": "browsers",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categories",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bcd",
                "web-features"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cat",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "baseline",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "high",
                "low",
                "limited"
              ]
            }
          },
          {
            "name": "first",
            "in": "query",
            "description": "Filter by first browser to ship",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "last",
            "in": "query",
            "description": "Filter by last browser to ship",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "has",
            "in": "query",
            "description": "Filter not-stable features already shipped in browser",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "missing",
            "in": "query",
            "description": "Filter not-stable features missing from browser",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "api",
                "days",
                "limbo",
                "firstDate",
                "lastDate"
              ]
            }
          },
          {
            "name": "dir",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated feature evaluations"
          }
        }
      }
    },
    "/api/feature/{id}": {
      "get": {
        "operationId": "lookupFeature",
        "summary": "Look up browser support timeline and Baseline status by Web Feature ID or MDN BCD key.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Feature details and browser timeline"
          },
          "404": {
            "description": "Feature not found"
          }
        }
      }
    },
    "/api/stories": {
      "get": {
        "operationId": "listStories",
        "summary": "List all seven pre-computed empirical web platform data stories.",
        "responses": {
          "200": {
            "description": "Story list with metrics and takeaways"
          }
        }
      }
    },
    "/api/stories/{slug}": {
      "get": {
        "operationId": "getStory",
        "summary": "Retrieve full charts, metrics, takeaways, and tables for a specific story.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full story payload"
          },
          "404": {
            "description": "Story not found"
          }
        }
      }
    }
  }
}