Skip to content

Using the API

Everything the pages show is available as JSON. The API is described in OpenAPI 3.1, with an interactive console:

ResourceAddress
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, except for /api/site and /api/batch, which carry structure files (28 MB on the public server). Molecules are limited to 120 heavy atoms (--max-atoms; 250 on a lab server, see the lab server). Errors come back as {"error": "…"} with status 400 (bad input), 401/503 (render authentication) or 404 (unknown path).

Endpoints

MethodPathReturns
POST/api/modelconformer, bonds, local orbitals and the full chemistry block
POST/api/pi-modelπ system, ionisable sites with acid/base forms and pKa forecasts
POST/api/sitea protein site: motif occurrences, metal sites, the capped fragment's orbitals in the protein's frame (Protein sites)
POST/api/batch17.0, lab servers: survey the ligands of many structures at once (Ligands)
POST/api/render-svgstandalone SVG of the orbital model (bearer token)
POST/api/sequence-to-smilespeptide SMILES from a one-letter sequence
POST/api/smiles-to-sequencesequence from a linear peptide SMILES
POST/api/iupac-to-smilesSMILES from a systematic name (OPSIN; optional)
GET/api/healthservice status, RDKit and orbital-layer versions
GET/api/catalogue-health, /api/viewer-health, /api/pi-density-health, /api/site-healthdeployment checks per page
GET/api/server-status17.0: the runtime profile and its limits, the machine, the worker pool and the caches (?ping=1: memory per worker)

The orbital model: POST /api/model

bash
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 example sp^3.99) and deviation_deg, the angle between hybrid and bond (non-zero in small rings);
  • lone pairs are split into σ and π (pi_role), and each atom reports electronic_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 as atoms[].position; the 3D viewer draws π density, interference, orbitals and potential from it;
  • each atom's radial_model lists its valence radial functions as Slater terms [N, ζ, c] (fitted Hartree–Fock, 16.1);
  • the new chemistry block holds the complete layer: hybrids, π components, protonation, Hammett substituents, acceptor orbitals, normalisation notes, sanity checks and a provenance hash;
  • orbital_model names the schema (qo-chem/16.1).

The π model: POST /api/pi-model

bash
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}'
FieldMeaning
moleculethe π 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
calibrationthe forecast lines with R², leave-one-out RMSE and the set they were fitted on
protonationdominant form at ph (only when ph is sent, 0–14)
tautomers, badges, warningscontext and the model's own caveats
provenanceinputs, 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

bash
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.

Source: API_OPENAPI_SWAGGER.md in the server package · updated