{
  "openapi": "3.1.1",
  "info": {
    "title": "Half-Life, Activity \u0026 Decay Chain Calculator API",
    "version": "1.0.0",
    "summary": "Radioactive decay: remaining amount and activity, time to a level, half-life fits and chains.",
    "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://prooflinehalflife.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Radioactive decay: remaining amount and activity, time to a level, half-life fits and chains.",
        "description": "Work out radioactive decay the way textbooks and labs do: how much of a nuclide is left after a time and what its activity is (Bq or Ci, from a percentage, an activity, a mass or a number of atoms), how long it takes to fall to a given level, which half-life fits your measured count rates, and how the members of a decay chain such as Mo-99 → Tc-99m or radon and its progeny grow in and decay (Bateman equations with branching). Nineteen preset nuclides carry evaluated half-lives from ENSDF/NUBASE2020. Part of the Proofline math notebook.\n\nMethodology:\n- N(t) = N₀·2^(−t/T½) = N₀·e^(−λt) with λ = ln 2 / T½; activity A = λ·N in becquerel (1 Ci = 3.7 × 10¹⁰ Bq); atoms from a mass via the molar mass of the nuclide (AME2020 where Proofline’s chemistry engine has it, otherwise the mass number) and the exact Avogadro constant. Time to a level: t = ln(N₀/N)/λ.\n- Half-life fits: least squares of ln(value) against time with Proofline’s QR fitter gives λ and its standard error; two points give the half-life directly.\n- Chains: the Bateman equations Nₖ(t) = N₁(0)·Πbᵢλᵢ·Σ e^(−λᵢt)/Π(λⱼ − λᵢ) with branching fractions bᵢ; the time of the daughter maximum is ln(λ₂/λ₁)/(λ₂ − λ₁).\n- Verified: 1 g of Ra-226 has 0.989 Ci (the historical curie), C-14 has a specific activity of 166 GBq/g, the Tc-99m activity of a Mo-99 generator peaks after 22.85 h, and radon progeny reach secular equilibrium within hours.\n\nDecay is a statistical law: small samples fluctuate around these averages. No dose, shielding or exposure calculation is made. Nothing here is advice on handling chemicals or radioactive material safely.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "proofline_half_life",
        "x-owner-app": "proofline",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProoflineHalfLifeInput"
              },
              "examples": {
                "example1": {
                  "summary": "Iodine-131: 100 MBq after 30 days",
                  "value": {
                    "mode": "decay",
                    "nuclide": "i131",
                    "initial": "100 MBq",
                    "elapsed": "30 d"
                  }
                },
                "example2": {
                  "summary": "Carbon-14: how long until 25 % is left?",
                  "value": {
                    "mode": "time",
                    "nuclide": "c14",
                    "initial": "100 %",
                    "target": "25 %"
                  }
                },
                "example3": {
                  "summary": "Activity of 1 g of radium-226 (about 1 curie)",
                  "value": {
                    "mode": "decay",
                    "nuclide": "ra226",
                    "initial": "1 g",
                    "elapsed": "0 y"
                  }
                },
                "example4": {
                  "summary": "Half-life from count rates",
                  "value": {
                    "mode": "fit",
                    "measurements": "0 h 1000\n6 h 501\n12 h 250\n18 h 126\n24 h 62"
                  }
                },
                "example5": {
                  "summary": "Mo-99 → Tc-99m generator over a week",
                  "value": {
                    "mode": "chain",
                    "chainPreset": "mo99-tc99m",
                    "initial": "10 GBq"
                  }
                },
                "example6": {
                  "summary": "Radon-222 and its progeny reach equilibrium",
                  "value": {
                    "mode": "chain",
                    "chainPreset": "rn222",
                    "initial": "1000 Bq"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProoflineHalfLifeResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "ProoflineHalfLifeInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "title": "Calculation",
            "type": "string",
            "enum": [
              "decay",
              "time",
              "fit",
              "chain"
            ],
            "default": "decay"
          },
          "nuclide": {
            "title": "Nuclide",
            "type": "string",
            "enum": [
              "custom",
              "h3",
              "c14",
              "f18",
              "p32",
              "k40",
              "co60",
              "sr90",
              "mo99",
              "tc99m",
              "i131",
              "cs137",
              "po210",
              "rn222",
              "ra226",
              "th232",
              "u235",
              "u238",
              "pu239",
              "am241"
            ],
            "default": "custom"
          },
          "halfLife": {
            "title": "Half-life (own nuclide)",
            "description": "A number with a time unit: s, min, h, d or y (365.2422 days).",
            "type": "string",
            "maxLength": 40,
            "default": ""
          },
          "initial": {
            "title": "Starting amount",
            "description": "A percentage, an activity (Bq, kBq, MBq, GBq, Ci, mCi, µCi), a mass (g, mg; preset nuclides only) or a number of atoms. Empty: 100 % (chains: 1 MBq).",
            "type": "string",
            "maxLength": 60,
            "default": ""
          },
          "elapsed": {
            "title": "Elapsed time",
            "type": "string",
            "maxLength": 40,
            "default": ""
          },
          "target": {
            "title": "Remaining level (time mode)",
            "description": "A percentage, or an activity or mass in the same kind of unit as the start.",
            "type": "string",
            "maxLength": 60,
            "default": ""
          },
          "measurements": {
            "title": "Measurements (fit mode)",
            "description": "One measurement per line: the time with its unit and the measured count rate or activity.",
            "type": "string",
            "maxLength": 20000,
            "default": ""
          },
          "chainPreset": {
            "title": "Decay chain",
            "type": "string",
            "enum": [
              "custom",
              "mo99-tc99m",
              "sr90-y90",
              "rn222",
              "ra226"
            ],
            "default": "custom"
          },
          "chain": {
            "title": "Chain members (own chain)",
            "description": "One member per line: name, half-life (or “stable” for the last) and optionally the share of the previous member’s decays that feeds it.",
            "type": "string",
            "maxLength": 2000,
            "default": ""
          },
          "duration": {
            "title": "Follow the chain for",
            "description": "Empty: the preset chain’s own period.",
            "type": "string",
            "maxLength": 40,
            "default": ""
          }
        },
        "required": []
      },
      "ProoflineHalfLifeResult": {
        "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": [
              "mode",
              "nuclide",
              "halfLifeS",
              "lambda",
              "meanLifeS",
              "timeS",
              "halfLives",
              "start",
              "now",
              "molarMass",
              "specificActivityBqPerG",
              "chain",
              "fit"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "decay",
                  "time",
                  "fit",
                  "chain"
                ]
              },
              "nuclide": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "halfLifeS": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "lambda": {
                "type": "number"
              },
              "meanLifeS": {
                "type": "number"
              },
              "timeS": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "halfLives": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "start": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "now": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "molarMass": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "specificActivityBqPerG": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "chain": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "fit": {
                "type": [
                  "object",
                  "null"
                ]
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}