{
  "openapi": "3.1.1",
  "info": {
    "title": "Ledgerly Is It Peanuts? Relative Scale API",
    "version": "1.0.0",
    "summary": "A billionaire’s gift as a share of their fortune, scaled to your own money and working hours.",
    "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://ledgerlyrelativescale.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "A billionaire’s gift as a share of their fortune, scaled to your own money and working hours.",
        "description": "Compares a big amount — a donation, a fine, a bonus or a price — with the wealth of whoever pays it and scales the same share to your net worth, your hourly income and a median household. The reverse check scales your own gift up to their fortune. Part of Ledgerly’s Reality Check.\n\nMethodology:\n- Share = amount ÷ their net worth. Your equivalent = share × your net worth; working hours = that equivalent ÷ (your net income ÷ working hours per year).\n- Years to earn the full amount = amount ÷ your net income per year; per person = amount ÷ population.\n- Reverse check: your gift ÷ your net worth × their net worth. The optional median household uses the ECB survey’s median net wealth (euro only).\n\nPublished fortunes are estimates; pledges paid over years or through foundations are not the same as cash from personal wealth.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ledgerly_relative_scale",
        "x-owner-app": "ledgerly",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerlyRelativeScaleInput"
              },
              "examples": {
                "example1": {
                  "summary": "$100 million gift from a $50 billion fortune",
                  "value": {
                    "currency": "USD",
                    "amount": 100000000,
                    "theirWealth": 50000000000,
                    "yourWealth": 120000,
                    "yourIncome": 52000,
                    "workHoursPerYear": 1800
                  }
                },
                "example2": {
                  "summary": "€1 billion pledge vs a median German household",
                  "value": {
                    "currency": "EUR",
                    "amount": 1000000000,
                    "theirWealth": 30000000000,
                    "yourWealth": 80000,
                    "yourIncome": 38000,
                    "population": 83500000,
                    "country": "DE"
                  }
                },
                "example3": {
                  "summary": "Reverse: your €50 gift at a €200 billion scale",
                  "value": {
                    "currency": "EUR",
                    "amount": 5000000,
                    "theirWealth": 200000000000,
                    "yourWealth": 60000,
                    "yourIncome": 35000,
                    "yourGift": 50
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerlyRelativeScaleResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "LedgerlyRelativeScaleInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "currency": {
            "title": "Currency",
            "type": "string",
            "maxLength": 3,
            "default": "EUR"
          },
          "amount": {
            "title": "The big amount (gift, fine, price …)",
            "type": "number",
            "minimum": 0.01,
            "maximum": 1000000000000000,
            "default": 100000000
          },
          "theirWealth": {
            "title": "Net worth of the giver or payer",
            "type": "number",
            "minimum": 1,
            "maximum": 1000000000000000,
            "default": 50000000000
          },
          "yourWealth": {
            "title": "Your net worth",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "default": 120000
          },
          "yourIncome": {
            "title": "Your net income per year",
            "type": "number",
            "minimum": 0,
            "maximum": 10000000000000,
            "default": 42000
          },
          "workHoursPerYear": {
            "title": "Your working hours per year",
            "type": "number",
            "minimum": 1,
            "maximum": 5000,
            "default": 1700
          },
          "population": {
            "title": "Population to share it among (0 = skip)",
            "type": "number",
            "minimum": 0,
            "maximum": 10000000000,
            "default": 0
          },
          "yourGift": {
            "title": "Your own gift for the reverse check (0 = skip)",
            "type": "number",
            "minimum": 0,
            "maximum": 10000000000000,
            "default": 0
          },
          "country": {
            "title": "Also compare with a typical household in",
            "type": "string",
            "enum": [
              "none",
              "EA",
              "AT",
              "BE",
              "HR",
              "CY",
              "CZ",
              "EE",
              "FI",
              "FR",
              "DE",
              "GR",
              "HU",
              "IE",
              "IT",
              "LV",
              "LT",
              "LU",
              "MT",
              "NL",
              "PT",
              "SK",
              "SI",
              "ES"
            ],
            "default": "none"
          }
        },
        "required": []
      },
      "LedgerlyRelativeScaleResult": {
        "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",
            "additionalProperties": false,
            "required": [
              "currency",
              "amount",
              "theirWealth",
              "share",
              "sharePercent",
              "yourEquivalent",
              "hourlyIncome",
              "workHoursEquivalent",
              "yearsOfIncomeForAmount",
              "perPerson",
              "reverseGift",
              "typicalHousehold"
            ],
            "properties": {
              "currency": {
                "type": "string"
              },
              "amount": {
                "type": "number"
              },
              "theirWealth": {
                "type": "number"
              },
              "share": {
                "type": "number"
              },
              "sharePercent": {
                "type": "number"
              },
              "yourEquivalent": {
                "type": "number"
              },
              "hourlyIncome": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "workHoursEquivalent": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "yearsOfIncomeForAmount": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "perPerson": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "reverseGift": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "typicalHousehold": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "country",
                  "medianWealth",
                  "equivalent"
                ],
                "properties": {
                  "country": {
                    "type": "string"
                  },
                  "medianWealth": {
                    "type": "number"
                  },
                  "equivalent": {
                    "type": "number"
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}