{
  "openapi": "3.1.1",
  "info": {
    "title": "Electron Configuration \u0026 Orbital Diagram API",
    "version": "1.0.0",
    "summary": "Electron configuration of any element or ion: orbital boxes, unpaired electrons, exceptions.",
    "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://prooflineelectronconfig.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Electron configuration of any element or ion: orbital boxes, unpaired electrons, exceptions.",
        "description": "Type an element or an ion — Fe, Fe3+, Cu+, O2-, 26 or “iron” — and get its ground-state electron configuration in full and in noble-gas shorthand, the orbital box diagram drawn with Hund’s rule, the number of unpaired electrons (paramagnetic or diamagnetic), the electrons per shell and the quantum numbers of the last electron. The 20 elements whose measured ground state breaks the Aufbau rule, such as chromium, copper, palladium and gold, use the NIST configuration and say what the rule would have predicted. Part of the Proofline math notebook.\n\nMethodology:\n- Subshells fill in Madelung order (increasing n + l, then n): 1s 2s 2p 3s 3p 4s 3d 4p 5s 4d 5p 6s 4f 5d 6p 7s 5f 6d 7p. For Cr, Cu, Nb, Mo, Ru, Rh, Pd, Ag, La, Ce, Gd, Pt, Au, Ac, Th, Pa, U, Np, Cm and Lr the measured ground state of the NIST Atomic Spectra Database replaces the prediction.\n- Cations lose electrons from the subshell with the highest n first (for equal n the highest l), so transition metals lose their s electrons before d electrons (Fe²⁺ = [Ar] 3d⁶). Anions add electrons in Madelung order.\n- Orbital boxes follow Hund’s rule: within a subshell each orbital (mℓ = −l … +l, left to right) receives one spin-up electron before any is paired. Unpaired electrons = Σ min(e, 2(2l + 1) − e) over the subshells.\n- Verified against the PubChem/NIST configurations of all 118 elements (the only difference is lawrencium, where NIST gives 7p¹ and PubChem still 6d¹).\n\nConfigurations are for free atoms and ions in the gas phase; in compounds ligands can pair electrons (low-spin complexes). Configurations beyond meitnerium are theoretical predictions.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "proofline_electron_config",
        "x-owner-app": "proofline",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProoflineElectronConfigInput"
              },
              "examples": {
                "example1": {
                  "summary": "Iron",
                  "value": {
                    "species": "Fe"
                  }
                },
                "example2": {
                  "summary": "The iron(III) ion: five unpaired d electrons",
                  "value": {
                    "species": "Fe3+"
                  }
                },
                "example3": {
                  "summary": "Chromium, an exception to the Aufbau rule",
                  "value": {
                    "species": "Cr"
                  }
                },
                "example4": {
                  "summary": "Copper(I): a filled d shell",
                  "value": {
                    "species": "Cu+"
                  }
                },
                "example5": {
                  "summary": "Oxide ion with all subshells",
                  "value": {
                    "species": "O2-",
                    "diagram": "full"
                  }
                },
                "example6": {
                  "summary": "Gadolinium: eight unpaired electrons",
                  "value": {
                    "species": "Gd"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProoflineElectronConfigResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "ProoflineElectronConfigInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "species": {
            "title": "Element or ion",
            "description": "A symbol, name or atomic number, optionally with a charge: Fe3+, Fe^3+, Fe+3, O2-, Cl-.",
            "type": "string",
            "maxLength": 40,
            "default": "Fe"
          },
          "diagram": {
            "title": "Orbital boxes",
            "type": "string",
            "enum": [
              "valence",
              "full"
            ],
            "default": "valence"
          }
        },
        "required": [
          "species"
        ]
      },
      "ProoflineElectronConfigResult": {
        "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": [
              "element",
              "charge",
              "electrons",
              "configuration",
              "configurationPretty",
              "shorthand",
              "shorthandPretty",
              "aufbauPrediction",
              "exception",
              "predicted",
              "core",
              "electronsOutsideCore",
              "subshells",
              "shells",
              "unpaired",
              "magnetism",
              "outerShell",
              "lastElectron",
              "block",
              "period",
              "group"
            ],
            "properties": {
              "element": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "z",
                  "symbol",
                  "name"
                ],
                "properties": {
                  "z": {
                    "type": "integer"
                  },
                  "symbol": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              "charge": {
                "type": "integer"
              },
              "electrons": {
                "type": "integer"
              },
              "configuration": {
                "type": "string"
              },
              "configurationPretty": {
                "type": "string"
              },
              "shorthand": {
                "type": "string"
              },
              "shorthandPretty": {
                "type": "string"
              },
              "aufbauPrediction": {
                "type": "string"
              },
              "exception": {
                "type": "boolean"
              },
              "predicted": {
                "type": "boolean"
              },
              "core": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "electronsOutsideCore": {
                "type": "integer"
              },
              "subshells": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "label",
                    "n",
                    "l",
                    "electrons",
                    "capacity",
                    "unpaired"
                  ],
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "n": {
                      "type": "integer"
                    },
                    "l": {
                      "type": "integer"
                    },
                    "electrons": {
                      "type": "integer"
                    },
                    "capacity": {
                      "type": "integer"
                    },
                    "unpaired": {
                      "type": "integer"
                    }
                  }
                }
              },
              "shells": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "unpaired": {
                "type": "integer"
              },
              "magnetism": {
                "type": "string",
                "enum": [
                  "paramagnetic",
                  "diamagnetic"
                ]
              },
              "outerShell": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "n",
                  "electrons"
                ],
                "properties": {
                  "n": {
                    "type": "integer"
                  },
                  "electrons": {
                    "type": "integer"
                  }
                }
              },
              "lastElectron": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "n",
                  "l",
                  "ml",
                  "ms",
                  "subshell"
                ],
                "properties": {
                  "n": {
                    "type": "integer"
                  },
                  "l": {
                    "type": "integer"
                  },
                  "ml": {
                    "type": "integer"
                  },
                  "ms": {
                    "type": "number"
                  },
                  "subshell": {
                    "type": "string"
                  }
                }
              },
              "block": {
                "type": "string",
                "enum": [
                  "s",
                  "p",
                  "d",
                  "f"
                ]
              },
              "period": {
                "type": "integer"
              },
              "group": {
                "type": [
                  "integer",
                  "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"
              }
            }
          }
        }
      }
    }
  }
}