{
  "openapi": "3.1.1",
  "info": {
    "title": "SMILES to Formula, Molar Mass \u0026 Properties API",
    "version": "1.0.0",
    "summary": "Formula, molar mass, exact mass, rings and H-bond counts from SMILES, MOL or XYZ.",
    "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://prooflinesmilesinfo.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Formula, molar mass, exact mass, rings and H-bond counts from SMILES, MOL or XYZ.",
        "description": "Paste a SMILES string, a MOL/SDF block or XYZ coordinates and get the molecular formula, the molar mass from the IUPAC standard atomic weights with its uncertainty, the exact (monoisotopic) mass, ring and aromatic-ring counts, hydrogen-bond donors and acceptors, rotatable bonds, a canonical SMILES, a 2-D structure drawing and a MOL file. Part of the Proofline math notebook and its Molecule Lab.\n\nMethodology:\n- The structure is read by Proofline’s own parsers: SMILES (OpenSMILES subset), MDL MOL/SDF V2000 (first record) or XYZ (bonds from covalent radii, double bonds guessed from valences). Hydrogens that are not written follow the SMILES valence rules; Kekulé rings with six π electrons are perceived as aromatic.\n- Molar mass = Σ atoms × CIAAW standard atomic weight, with the combined uncertainty (the same calculation as the molar-mass tool). The exact mass adds the most abundant isotope of every element (AME2020) and corrects ions by the electron mass.\n- Rings are the smallest set of smallest rings (bonds − atoms + parts of them). H-bond donors and acceptors use Lipinski’s counting (O–H and N–H bonds; all N and O atoms). Rotatable bonds are single, non-ring bonds between two atoms that each have another heavy neighbour.\n- The canonical SMILES ranks atoms by their element, connections and charges, refined over the neighbours until stable; ties are broken one at a time. The MOL file has 2-D coordinates from Proofline’s layout and a Kekulé structure for aromatic rings.\n\nCounts follow simple published rules (Lipinski) and are not predictions of drug-likeness; stereochemistry is not handled. Nothing here is advice on handling chemicals safely.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "proofline_smiles_info",
        "x-owner-app": "proofline",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProoflineSmilesInfoInput"
              },
              "examples": {
                "example1": {
                  "summary": "Aspirin (acetylsalicylic acid)",
                  "value": {
                    "structure": "CC(=O)Oc1ccccc1C(=O)O"
                  }
                },
                "example2": {
                  "summary": "Caffeine",
                  "value": {
                    "structure": "CN1C=NC2=C1C(=O)N(C(=O)N2C)C"
                  }
                },
                "example3": {
                  "summary": "Ethanol",
                  "value": {
                    "structure": "CCO"
                  }
                },
                "example4": {
                  "summary": "Glycine zwitterion",
                  "value": {
                    "structure": "[NH3+]CC(=O)[O-]"
                  }
                },
                "example5": {
                  "summary": "Benzene as a Kekulé structure (perceived as aromatic)",
                  "value": {
                    "structure": "C1=CC=CC=C1"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProoflineSmilesInfoResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "ProoflineSmilesInfoInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "structure": {
            "title": "Structure",
            "description": "A SMILES string (CCO, c1ccccc1, [NH4+]), a MOL/SDF V2000 block or XYZ coordinates. SMILES subset: organic atoms B C N O P S F Cl Br I and aromatic b c n o p s, bracket atoms with isotope, hydrogens and charge, bonds - = # :, branches, ring numbers and %nn, dots between parts. Stereo marks are read but not used.",
            "type": "string",
            "maxLength": 200000,
            "default": "CC(=O)Oc1ccccc1C(=O)O"
          },
          "format": {
            "title": "Format",
            "type": "string",
            "enum": [
              "auto",
              "smiles",
              "mol",
              "xyz"
            ],
            "default": "auto"
          }
        },
        "required": [
          "structure"
        ]
      },
      "ProoflineSmilesInfoResult": {
        "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": [
              "format",
              "canonicalSmiles",
              "formula",
              "formulaInput",
              "charge",
              "atoms",
              "heavyAtoms",
              "hydrogens",
              "bonds",
              "molarMass",
              "molarMassUncertainty",
              "molarMassRounded",
              "uncertaintyRounded",
              "exactMass",
              "rings",
              "ringSizes",
              "aromaticRings",
              "hBondDonors",
              "hBondAcceptors",
              "rotatableBonds",
              "fragments",
              "composition",
              "molfile"
            ],
            "properties": {
              "format": {
                "type": "string",
                "enum": [
                  "smiles",
                  "mol",
                  "xyz",
                  "pdb"
                ]
              },
              "canonicalSmiles": {
                "type": "string"
              },
              "formula": {
                "type": "string"
              },
              "formulaInput": {
                "type": "string"
              },
              "charge": {
                "type": "integer"
              },
              "atoms": {
                "type": "integer"
              },
              "heavyAtoms": {
                "type": "integer"
              },
              "hydrogens": {
                "type": "integer"
              },
              "bonds": {
                "type": "integer"
              },
              "molarMass": {
                "type": "number"
              },
              "molarMassUncertainty": {
                "type": "number"
              },
              "molarMassRounded": {
                "type": "string"
              },
              "uncertaintyRounded": {
                "type": "string"
              },
              "exactMass": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "rings": {
                "type": "integer"
              },
              "ringSizes": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "aromaticRings": {
                "type": "integer"
              },
              "hBondDonors": {
                "type": "integer"
              },
              "hBondAcceptors": {
                "type": "integer"
              },
              "rotatableBonds": {
                "type": "integer"
              },
              "fragments": {
                "type": "integer"
              },
              "composition": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "element",
                    "count",
                    "massPercent"
                  ],
                  "properties": {
                    "element": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "massPercent": {
                      "type": "number"
                    }
                  }
                }
              },
              "molfile": {
                "type": "string"
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}