REST API¶
The server describes itself at /openapi.json, with interactive
documentation at /docs. This page is the map.
Documents¶
Route |
Does |
|---|---|
|
The open documents, the one to show first, and what the server can do. |
|
List open documents with revision, filename and dirty state. |
|
A new document: empty, from a document’s JSON ( |
|
The document, its revision (also as |
|
Replace it. Needs |
|
Replace the drawing (KET); species and reactions are derived from it. |
|
Draw structures from |
|
Standard bond lengths and angles for every molecule; a molecule it cannot clean without changing its stereochemistry is left and named in |
|
Lays the reaction scheme out as papers draw it (Tidy scheme); |
|
3D structures for |
|
Relaxes the 3D structures of |
|
One writer’s input for several species with one |
|
A reaction’s atom mapping for review: pairs, bond changes, |
|
Nudged-elastic-band inputs ( |
|
Inputs for |
|
The document’s runs with their state in vibe-scheduler, and where each result is ( |
|
Import a verified result onto a recorded run; revision, source basename and base64 output bytes, never a server path. See results. |
|
A run’s IR, Raman or UV-Vis line list as CSV or text, or its broadened spectrum as text; see results. |
|
A run’s NMR shieldings and shifts against a reference run, as JSON or a CSV, Markdown or LaTeX line list; |
|
Place a run’s shifts as text beside its species’ drawn atoms; revision, run, reference and optional nuclei. |
|
Compute an explicit group/run comparison as JSON, derived SVG, QVF, CSV, Markdown or LaTeX, with optional reaction coefficients. |
|
The document’s run groups, newest first: each group’s |
|
Cancel the group’s runs that have not finished; answers with the runs |
|
The staged recipes ( |
|
Save |
|
Explicit |
|
Save the publication baseline (MACE, PBE/def2-SVP, same-surface Hessian, DLPNO-CCSD(T)) as |
|
Remove a recipe; 404 when there is none. |
|
Compile the recipe into a vibe-scheduler campaign in |
|
The campaign’s stages: process state and attempts in vibe-scheduler’s journal, and scientific |
|
Same-orientation renders of |
|
Authorise the next attempt of the failed |
|
Shows |
|
Set a compound number, multiplicity or name. |
|
Formula, masses, elemental analysis, calculated descriptors, identifiers and checked name per species. |
|
Mark atoms of a species, numbered from 1, in a palette colour; revision, |
|
Mark the atoms drawn at |
|
Remove every highlight, or those of |
|
Where the marked atoms are drawn in a posted |
|
The labels that can be contracted ( |
|
Draw groups such as Ph, Boc or OTf as their label; revision, optional |
|
Draw contracted groups as their atoms again; revision, optional |
|
Generate a nanostructure and add it as a species; revision, |
|
Put a picture of a nanostructure species on the canvas; revision, |
|
The nanostructure pictures on the canvas: species, style, box and anchors. |
|
Move a labelled structure onto a picture’s anchor; revision, |
|
Draw an electrode half-reaction; revision, |
|
Each reaction’s atoms and charge per side with its electrons, the imbalance and whether it balances. |
|
Draw a TLC plate beside the drawing; revision and |
|
Make a species of a labelled structure by capping its labels; revision and |
|
The R-group cores, bracketed groups and labelled structures ( |
|
Each species’ CIP descriptors, undefined stereo and enhanced-stereo groups. |
|
Write the descriptors into the drawing as labels, or remove them with |
|
Replace a reaction’s entered amounts; revision and |
|
The worked stoichiometry table as JSON, CSV, Markdown or LaTeX. |
|
The species property table as CSV, Markdown or LaTeX. |
|
Place the species’ properties as text under its structure; revision and optional |
|
The document as a file; |
|
Write it back to the file the server opened it from; 409 when replacing a QVF would discard result data or other unsupported content. |
|
Close it. |
Document response fields¶
Field |
Meaning |
|---|---|
|
The server session’s document handle, used in URLs; not a species ID or filename |
|
The current revision to use for the next edit |
|
Native document JSON, including species, jobs and provenance |
|
Notices from the operation or stored document; inspect them even after HTTP success |
|
The backing file’s name, or |
|
Whether a file-backed document has changed since that backing file was saved |
A document with file: null reports dirty: false even though no file has
been saved. Do not use this flag as proof of persistence. Export and retain
such documents explicitly. Server document IDs last only for that in-memory
session; reopening the same VSK in another session creates a new handle.
Species IDs inside the document have their own identity rules.
Revisions and concurrent edits¶
Replacing a whole document requires If-Match, for example If-Match: "2".
Canvas replacement, import, cleanup, embedding, species edits and submission
instead require a JSON revision field. In particular, PUT .../canvas uses
revision, not If-Match. Use the revision returned by the latest read or
successful edit; do not assume every request increments it.
A stale edit answers 409, or 412 for whole-document replacement, with the
current revision in detail.revision. Read the latest document, reconcile
your intended change with it, and then resubmit. Retrying an old whole-document
snapshot with a new revision can overwrite another editor’s work.
Whole-document replacement without If-Match returns 428; a malformed header
returns 400.
Edit request models also take actor (human, agent or system) and
client (for example rest or mcp) for provenance. Consult /openapi.json
for each route’s fields. Save and close take neither a revision body nor
If-Match; exporting and input generation do not edit the stored document.
Whole-document PUT validates and replaces the supplied model. It does not rederive species from the canvas or automatically append a provenance edit; its store advances the revision. Prefer the specific canvas, import or species routes when you want their derivation and edit-recording behavior.
Request body shapes¶
The state response wrapper is not itself a document. When sending a document
back, extract its document field and use the shape required by that route:
Operation |
JSON body |
|---|---|
Create from an existing document |
|
Create/import from chemistry text |
|
Replace the whole document |
|
Validate, stateless clean/report/export |
|
Replace the canvas |
|
Stateless input generation |
|
Stored-document input generation |
|
DOCUMENT, N, KET_OBJECT and SPEC above are placeholders for actual JSON
values. Do not send them literally. Save and close have no request body.
Use the running server’s OpenAPI schema for required fields and constraints.
A first request¶
Start vibe-sketcher serve and use the address it prints. For the default port:
curl --fail-with-body http://127.0.0.1:8766/api/documents \
-H 'Content-Type: application/json' \
-d '{"format":"smiles","data":"CCO","actor":"agent","client":"rest"}'
The response contains id, revision, document, warnings, file and
dirty. Use the returned id in subsequent URLs and the returned revision
when embedding or editing. The downloadable REST example
performs the full create, embed, write-input and export sequence.
Documents created through REST live in the server’s memory and have no backing
file. Export them and save the returned bytes to keep them across server
restarts. /save writes only to a file already associated with the document;
it returns 409 when there is no backing file. It does not accept a destination
path. Closing a document removes it from the session without saving it.
For stored-document input generation, embed first. A successful JSON response
can contain both files and refused; HTTP 200 does not mean every species
succeeded. A ZIP includes REFUSED.txt for partial refusals, and an all-refused
batch returns 422. Submission similarly returns submitted and refused;
inspect recorded runs before retrying a partially successful submission.
Updating species metadata¶
PATCH /api/documents/{id}/species/{species} accepts revision, label,
name and multiplicity, plus the edit’s actor and client. Omitted fields
and JSON null leave existing values unchanged. To clear a compound label or
user name, send an empty string:
{"revision": 2, "label": "", "name": "", "actor": "agent", "client": "rest"}
Replace 2 with the document’s current revision. A nonempty user name is
stored with source user and confidence high; this records authorship, not
an independent chemical verification. Clearing it allows the properties
report to show the naming engine’s result again when available.
Multiplicity must be a positive integer compatible with the species’ electron count when that can be checked. This endpoint does not accept a charge or SMILES change: edit/import the chemical structure to change those. It also does not edit text labels on the canvas. See document identity for how later canvas edits reconcile species metadata.
Validation responses¶
POST /api/documents/validate takes the document JSON itself, without a
document wrapper. For a syntactically valid JSON body, it returns HTTP 200
with valid and errors, even when the document fails validation. Check
valid; a successful HTTP request alone does not establish a valid document.
Malformed JSON is a request error and returns 422.
curl --fail-with-body http://127.0.0.1:8766/api/documents/validate \
-H 'Content-Type: application/json' \
--data-binary @ethanol.vsk
The same validation runs in the Python document model. JSON Schema alone cannot enforce every cross-reference or charge/multiplicity check. See document validation.
Operations without an open document¶
The chemistry routes below operate on supplied data without creating an open document. Queue inspection and cancellation are also available without one; cancellation changes the external queue run.
Route |
Does |
|---|---|
|
Inspect existing QVF bytes in base64 |
|
|
|
A posted document with its drawing cleaned, and how many molecules were. |
|
A posted document with its scheme laid out, its |
|
3D conformers for one |
|
One |
|
The report for a posted document. |
|
A posted document as a file. |
|
Whether a JSON value is a valid document, with every problem. |
|
Whether vibe-scheduler is installed and serving, and which programs it can run. |
|
Cancel a run; 409 when it has finished. |
|
The document’s JSON schema. |
|
The input writers; see input writers. |
Binary data, a QVF archive, goes into data base64-encoded with
"encoding": "base64" (on POST /api/documents, /import and /convert).
GET /api/session says whether QVF is available ("qvf").
Refusals answer 422 with the reasons, under detail.reasons or
detail.errors. Input beyond vibe-sketcher’s bounds is such a refusal; a
request body over 272 MiB answers 413. A server on the loopback interface
answers 421 to a Host that is not this machine’s and 403 to a request
from another site’s Origin; see Security and input bounds. A figure export on a machine without the drawing libraries
(see installation) answers 503, with the fix in
detail.reasons.
A client writing exported bytes to disk must protect existing QVF results.
Inspect the destination through /api/qvf/overwrite-check and confirm that
its bytes have not changed before replacement, or use the SDK’s
write_output helper. A refusal requires a different Save As destination;
exporting an imported result does not preserve its calculation payloads.
Named reactions¶
See the compound, fragment and named-reaction library for the searchable picker, editable examples, explicit unfinished scaffolds, source coverage and matching SDK, CLI, REST and MCP operations.