{
  "openapi": "3.1.1",
  "info": {
    "title": "Sizewise Rate Counter API",
    "version": "1.0.0",
    "summary": "Turn “so much per year” into per second, project it, and embed a live counter.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://sizewiseratecounter.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Turn “so much per year” into per second, project it, and embed a live counter.",
        "description": "Converts a rate between seconds, minutes, hours, days, weeks, months and years, projects it over time, finds when it reaches a target and writes a small self-contained HTML counter (“since you opened this page …”) for your own site.\n\nMethodology:\n- Rate per second = amount ÷ the length of the chosen period: minute 60 s, hour 3 600 s, day 86 400 s, week 604 800 s, year 365.25 days (Julian year), month one twelfth of that.\n- Projections and the time to a target are rate × time and target ÷ rate; nothing compounds.\n- The embed is plain HTML with a 6-line script: it counts from the moment the page opened in the visitor’s browser, sends nothing anywhere and slows to one update per second for people who prefer reduced motion.\n\nA constant rate is a simplification: real rates (spending, births, traffic) change through the day and the year.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "sizewise_rate_counter",
        "x-owner-app": "sizewise",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SizewiseRateCounterInput"
              },
              "examples": {
                "example1": {
                  "summary": "Light to the Moon",
                  "value": {
                    "label": "Light travels",
                    "amount": 299792.458,
                    "per": "second",
                    "unit": "km",
                    "elapsedSeconds": 60,
                    "target": 384400
                  }
                },
                "example2": {
                  "summary": "Earth around the Sun",
                  "value": {
                    "label": "Earth moves around the Sun",
                    "amount": 29.78,
                    "per": "second",
                    "unit": "km",
                    "elapsedSeconds": 3600,
                    "target": 0
                  }
                },
                "example3": {
                  "summary": "A yearly budget per second",
                  "value": {
                    "label": "Budget spent",
                    "amount": 50000000,
                    "per": "year",
                    "unit": "EUR",
                    "elapsedSeconds": 86400,
                    "decimals": 2
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SizewiseRateCounterResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "SizewiseRateCounterInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "label": {
            "title": "What is counted",
            "type": "string",
            "maxLength": 80,
            "default": "Light travels"
          },
          "amount": {
            "title": "Amount",
            "type": "number",
            "minimum": 1e-12,
            "maximum": 1e+30,
            "default": 299792.458
          },
          "per": {
            "title": "Per",
            "type": "string",
            "enum": [
              "second",
              "minute",
              "hour",
              "day",
              "week",
              "month",
              "year"
            ],
            "default": "second"
          },
          "unit": {
            "title": "Unit of the amount",
            "type": "string",
            "maxLength": 30,
            "default": "km"
          },
          "elapsedSeconds": {
            "title": "Elapsed time",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000,
            "default": 60,
            "x-unit": "s"
          },
          "target": {
            "title": "Target (optional)",
            "type": "number",
            "minimum": 0,
            "maximum": 1e+30,
            "default": 0
          },
          "decimals": {
            "title": "Decimals in the counter",
            "type": "integer",
            "minimum": 0,
            "maximum": 6,
            "default": 0
          }
        },
        "required": []
      },
      "SizewiseRateCounterResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object"
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}