{
  "openapi": "3.0.3",
  "info": {
    "title": "endoflife.ai API",
    "version": "1.0.0",
    "description": "End-of-life dates and EOL Risk Scores for 460+ software products. Anonymous: 100 req/day. Free key (POST /v1/keys/free): 500 req/day. Starter $79/mo: 10,000 req/day. Pro $199/mo: unlimited.",
    "contact": {
      "email": "partners@endoflife.ai",
      "url": "https://endoflife.ai/api"
    }
  },
  "servers": [
    {
      "url": "https://api.endoflife.ai"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Score": {
        "type": "object",
        "properties": {
          "product": {
            "type": "string",
            "example": "nodejs"
          },
          "version": {
            "type": "string",
            "example": "18"
          },
          "latest_release": {
            "type": "string"
          },
          "release_date": {
            "type": "string",
            "format": "date"
          },
          "eol_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "approaching",
              "eol",
              "unknown"
            ]
          },
          "days_until_eol": {
            "type": "integer",
            "nullable": true
          },
          "days_past_eol": {
            "type": "integer",
            "nullable": true
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "EOL Risk Score (higher = riskier)"
          },
          "grade": {
            "type": "string",
            "example": "F"
          },
          "band": {
            "type": "string",
            "example": "Critical"
          },
          "factors": {
            "type": "object"
          },
          "extended_support_available": {
            "type": "boolean"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "docs": {
            "type": "string"
          }
        }
      }
    }
  },
  "security": [
    {},
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1/products": {
      "get": {
        "summary": "List all tracked product slugs",
        "responses": {
          "200": {
            "description": "Array of product slugs"
          }
        }
      }
    },
    "/v1/product/{slug}": {
      "get": {
        "summary": "All release cycles for a product",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "nodejs"
          }
        ],
        "responses": {
          "200": {
            "description": "Release cycles with EOL dates"
          },
          "404": {
            "description": "Unknown product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/score/{slug}": {
      "get": {
        "summary": "Highest-risk cycle score for a product",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "EOL Risk Score",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Score"
                }
              }
            }
          }
        }
      }
    },
    "/v1/score/{slug}/{version}": {
      "get": {
        "summary": "EOL Risk Score for a specific version",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "nodejs"
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "18"
          }
        ],
        "responses": {
          "200": {
            "description": "EOL Risk Score",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Score"
                }
              }
            }
          }
        }
      }
    },
    "/v1/status/{slug}/{version}": {
      "get": {
        "summary": "Lifecycle status for a specific version",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status object"
          }
        }
      }
    },
    "/v1/batch": {
      "post": {
        "summary": "Score multiple products in one request",
        "description": "Batch limits: anonymous/free key 5, Starter 25, Pro 50 products per request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "slug": {
                          "type": "string"
                        },
                        "version": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "slug"
                      ]
                    }
                  }
                },
                "required": [
                  "products"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Array of Score objects"
          },
          "403": {
            "description": "Batch limit exceeded for tier"
          }
        }
      }
    },
    "/v1/metrics": {
      "get": {
        "summary": "Prometheus metrics for a stack",
        "parameters": [
          {
            "name": "stack",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "nodejs:18,python:3.8"
          }
        ],
        "responses": {
          "200": {
            "description": "Prometheus text exposition format"
          }
        }
      }
    },
    "/v1/badge/{slug}/{version}": {
      "get": {
        "summary": "Shields.io endpoint badge JSON",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Shields.io endpoint schema"
          }
        }
      }
    },
    "/v1/keys/free": {
      "post": {
        "summary": "Get a free API key (500 req/day) emailed to you",
        "security": [
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Key emailed"
          },
          "400": {
            "description": "Invalid email"
          },
          "429": {
            "description": "Signup limit reached"
          }
        }
      }
    }
  }
}