CyberRXN Docs

Common task recipes

Choose the right operation for source evidence, atom balance and structure conversion.

Install the Python or JavaScript SDK and configure your API key first. These examples use Python; the corresponding JavaScript methods and REST routes are listed below. Each chemistry or corpus operation consumes one successful metered call.

Find how a molecule was prepared

Search the product structure, then retrieve the full source for a selected result:

from cyberrxn import Client

with Client() as client:
    matches = client.molecule_reactions(
        "CCN1CCN(CO)C(=O)C1=O", role="product", limit=3
    )
    if matches.items:
        record = client.get_observation(matches.items[0].observation_id)
        print(record.evidence.patent, record.evidence.year)
        print(record.paragraph_text)
        print(record.conditions)
    else:
        print("No recorded match for this structure.")

A returned hit is evidence to inspect, not a recommended procedure. Pressure, solvent and temperature can belong to different stages. Missing fields remain unknown. Search semantics.

Search an exact transformation

Use lookup_reaction when both sides are known; use search_reactions when you need filters:

from cyberrxn import Client

with Client() as client:
    exact = client.lookup_reaction(
        "C=O.CCN1CCNC(=O)C1=O>>CCN1CCN(CO)C(=O)C1=O", limit=3
    )
    filtered = client.search_reactions(
        products="CCN1CCN(CO)C(=O)C1=O",
        temperature_min=20, temperature_max=80, limit=3,
    )
    print("Exact observations:", len(exact.items))
    print("Filtered observations:", len(filtered.items))

These are two alternative searches, shown together for comparison: running the whole snippet makes two calls. Agents are not part of the identity of an exact transformation. Structural analogues from similar_products have a different meaning; similarity is not synthesis probability.

Check, balance and display an equation

from cyberrxn import Client

with Client() as client:
    check = client.validate_reaction("CCO>>CC=O")
    print(check.valid, check.atom_balance.delta)
    balance = client.balance_reaction(
        "[H][H].O=O>>O", method="coefficients"
    )
    if balance.solved and balance.balanced_reaction_smiles:
        display = client.convert_smiles(balance.balanced_reaction_smiles)
        print(display.unicode)

This performs two calls, plus a third if conversion runs. The coefficient solver balances supplied species only. method="synrbl" is a separate, explicit model-assisted hypothesis for missing species; inspect imputed_species and limitations. Neither computation establishes experimental evidence. Validation and balance.

Convert a structure for another tool

from cyberrxn import Client

with Client() as client:
    result = client.convert_representation(
        "CCO", input_format="smiles", output_format="inchi"
    )
    print(result)

Supply explicit input and output formats. Preserve multiline MOL/SDF/RXN data. Conversions that discard information require allow_lossy=True; inspect preservation diagnostics rather than assuming a round trip is lossless. A formula or InChIKey cannot identify a unique structure. Conversion guide.

Equivalent interfaces

TaskJavaScript methodREST operation
Molecule searchmoleculeReactionsPOST /v1/molecules/reactions
Exact transformationlookupReactionPOST /v1/reactions/lookup
Filtered searchsearchReactionsPOST /v1/reactions/search
Full sourcegetObservationGET /v1/observations/ID
ValidatevalidateReactionPOST /v1/chemistry/validate
BalancebalanceReactionPOST /v1/chemistry/balance
Display SMILESconvertSmilesPOST /v1/chemistry/convert
Convert formatsconvertRepresentationPOST /v1/chemistry/convert-representation

For an assistant, ask the same task in plain language after connecting MCP. For a batch, apply rate controls, stop pagination deliberately and inspect usage.

On this page