Using the API
Everything the pages show is available as JSON. The API is described in OpenAPI 3.1, with an interactive console:
| Resource | Address |
|---|---|
| Interactive reference (Swagger UI) | /api/docs (also /api/swagger) |
| OpenAPI 3.1 document | /api/openapi.json |
All requests and responses are JSON (Content-Type: application/json), except /api/render-svg, which returns an SVG. Request bodies are limited to 32 kB; molecules to 120 heavy atoms by default (--max-atoms). Errors come back as {"error": "…"} with status 400 (bad input), 401/503 (render authentication) or 404 (unknown path).
Endpoints
| Method | Path | Returns |
|---|---|---|
| POST | /api/model | conformer, bonds, local orbitals and the full chemistry block |
| POST | /api/pi-model | π system, ionisable sites with acid/base forms and pKa forecasts |
| POST | /api/site | a protein site: motif occurrences, metal sites, the capped fragment's orbitals in the protein's frame (Protein sites) |
| POST | /api/render-svg | standalone SVG of the orbital model (bearer token) |
| POST | /api/sequence-to-smiles | peptide SMILES from a one-letter sequence |
| POST | /api/smiles-to-sequence | sequence from a linear peptide SMILES |
| POST | /api/iupac-to-smiles | SMILES from a systematic name (OPSIN; optional) |
| GET | /api/health | service status, RDKit and orbital-layer versions |
| GET | /api/catalogue-health, /api/viewer-health, /api/pi-density-health, /api/site-health | deployment checks per page |
The orbital model: POST /api/model
curl -sS -X POST https://app.lcserve.com/api/model \
-H "Content-Type: application/json" \
-d '{"smiles": "Oc1ccc(cc1)[N+](=O)[O-]"}'The response keeps every field of earlier versions (atoms, bonds, orbitals, pi_overlaps, molblock, warnings, …), so existing clients keep working. Since version 16 the values come from the orbital layer:
- each σ orbital carries
hybridization_label(for examplesp^3.99) anddeviation_deg, the angle between hybrid and bond (non-zero in small rings); - lone pairs are split into σ and π (
pi_role), and each atom reportselectronic_role,lone_pairs: {sigma, pi},pi_charge; - bonds report their Hückel
pi_bond_order; pi_field(16.1) is the molecule's π layer in the field-engine payload, in the same centred frame asatoms[].position; the 3D viewer draws π density, interference, orbitals and potential from it;- each atom's
radial_modellists its valence radial functions as Slater terms[N, ζ, c](fitted Hartree–Fock, 16.1); - the new
chemistryblock holds the complete layer: hybrids, π components, protonation, Hammett substituents, acceptor orbitals, normalisation notes, sanity checks and a provenance hash; orbital_modelnames the schema (qo-chem/16.1).
The π model: POST /api/pi-model
curl -sS -X POST https://app.lcserve.com/api/pi-model \
-H "Content-Type: application/json" \
-d '{"smiles": "CC(=O)Oc1ccccc1C(=O)O", "ph": 7.4}'| Field | Meaning |
|---|---|
molecule | the π system of the molecule as given, in the field engine's payload |
sites[] | each ionisable site: family, reference group_pka, forms.acid and forms.base, descriptors (Q_site, V_probe, dE_deloc) and pi_forecast |
calibration | the forecast lines with R², leave-one-out RMSE and the set they were fitted on |
protonation | dominant form at ph (only when ph is sent, 0–14) |
tautomers, badges, warnings | context and the model's own caveats |
provenance | inputs, versions and a SHA-256 of the result |
Acid and base are built on the same geometry: only the proton moves. The browser draws the fields from this payload; the server never computes grids. At most six sites are returned per molecule.
Rendering an SVG: POST /api/render-svg
This endpoint is protected with a bearer token so the server cannot be used as a free rendering farm. See SVG render API for the token set-up and examples. In Swagger UI, use Authorize and paste the token; it is never stored in the OpenAPI file.
Conversions
curl -sS -X POST https://app.lcserve.com/api/sequence-to-smiles \
-H "Content-Type: application/json" -d '{"sequence": "ACDEFGHIK"}'
curl -sS -X POST https://app.lcserve.com/api/iupac-to-smiles \
-H "Content-Type: application/json" -d '{"name": "2,4-dimethoxybenzaldehyde"}'The name parser needs py2opsin and Java on the server. Its presence in the OpenAPI document does not mean it is installed; without it the endpoint answers 400 with an error that says what is missing.
Swagger UI assets
The OpenAPI document has no runtime dependency. Swagger UI is static browser code: ./install_swagger_ui.sh self-hosts the pinned 5.17.14 build; until then the page loads the same version from unpkg.