- Celery Task API
- SMILES API
- Buyables API
- Template API
- Saved Results API
- Banlist API
- Authentication Token API
- Other API
The API endpoints in this section are used to submit various celery tasks to the queue. All of these endpoints require POST requests containing task parameters, and will return the task ID associated with the created celery task.
Once the task has been created, you must retrieve the task result using the /api/v2/celery/task endpoint.
API endpoint for retrieving status and output of a celery task. The task id is obtained from submission of any celery task. Celery task results are not permanent, and will expire after 30 minutes.
URL: /api/v2/celery/task/<task id>/
Method: GET
Returns:
complete: boolean indicating whether job is completefailed: boolean indicating if job failedpercent: completion percent of jobmessage: message regarding job statusstate: state of the joberror: any error message if encounteredoutput: output of celery task if complete
API endpoint for generating atom mappings for reactions.
URL: /api/v2/atom-mapper/
Method: POST
Parameters:
rxnsmiles(str): reaction SMILES stringmapper(str, optional): atom mapping backend to use (currently only 'WLN atom mapper')
Returns:
task_id: celery task ID
API endpoint for context recommendation prediction using neural network model.
URL: /api/v2/context/
Method: POST
Parameters:
reactants(str): SMILES string of reactantsproducts(str): SMILES string of productswith_smiles(bool, optional): whether to use SMILES for predictionsingle_solvent(bool, optional): whether to use single solvent for predictionreturn_scores(bool, optional): whether to also return scoresnum_results(int, optional): max number of results to return
Returns:
task_id: celery task ID
API endpoint for reaction scoring using fast filter model.
URL: /api/v2/fast-filter/
Method: POST
Parameters:
reactants(str): SMILES string of reactantsproducts(str): SMILES string of products
Returns:
task_id: celery task ID
API endpoint for template-free forward prediction task.
URL: /api/v2/forward/
Method: POST
Parameters:
reactants(str): SMILES string of reactantsreagents(str, optional): SMILES string of reagentssolvent(str, optional): SMILES string of solventnum_results(int, optional): max number of results to returnatommap(bool, optional): Flag to keep atom mapping from the prediction (default=False)
Returns:
task_id: celery task ID
API endpoint for impurity prediction task.
URL: /api/v2/impurity/
Method: POST
Parameters:
reactants(str): SMILES string of reactantsreagents(str, optional): SMILES string of reagentsproducts(str, optional): SMILES string of productssolvent(str, optional): SMILES string of solventtop_k(int, optional): max number of results to returnthreshold(float, optional): probability thresholdpredictor(str, optional): forward predictor to useinspector(str, optional): reaction scorer to usemapper(str, optional): reaction atom mapper to usecheck_mapping(bool, optional): whether to check atom mapping
Returns:
task_id: celery task ID
API endpoint for single-step retrosynthesis task.
URL: /api/v2/retro/
Method: POST
Parameters:
target(str): SMILES string of targetnum_templates(int, optional): number of templates to considermax_cum_prob(float, optional): maximum cumulative probability of templatesfilter_threshold(float, optional): fast filter thresholdtemplate_set(str, optional): reaction template set to usetemplate_prioritizer_version(int, optional): version number of template relevance model to usecluster(bool, optional): whether or not to cluster resultscluster_method(str, optional): method for clustering resultscluster_feature(str, optional): which feature to use for clusteringcluster_fp_type(str, optional): fingerprint type for clusteringcluster_fp_length(int, optional): fingerprint length for clusteringcluster_fp_radius(int, optional): fingerprint radius for clusteringselec_check(bool, optional): whether or not to check for potential selectivity issues
Returns:
task_id: celery task ID
API endpoint for site selectivity prediction task.
URL: /api/v2/selectivity/
Method: POST
Parameters:
smiles(str): SMILES string of target
Returns:
task_id: celery task ID
API endpoint for general selectivity prediction task.
URL: /api/v2/gen-selectivity/
Method: POST
Parameters:
reaction_smiles(str): reaction smiles with map atom number
Returns:
task_id: celery task ID
API endpoint for tree builder prediction task.
URL: /api/v2/tree-builder/
Method: POST
Parameters:
smiles(str): SMILES string of targetmax_depth(int, optional): maximum depth of returned treesmax_branching(int, optional): maximum branching in returned treesexpansion_time(int, optional): time limit for tree expansionmax_ppg(int, optional): maximum price for buyable terminationtemplate_count(int, optional): number of templates to considermax_cum_prob(float, optional): maximum cumulative probability of templateschemical_property_logic(str, optional): logic type for chemical property terminationmax_chemprop_c(int, optional): maximum carbon count for terminationmax_chemprop_n(int, optional): maximum nitrogen count for terminationmax_chemprop_o(int, optional): maximum oxygen count for terminationmax_chemprop_h(int, optional): maximum hydrogen count for terminationchemical_popularity_logic(str, optional): logic type for chemical popularity terminationmin_chempop_reactants(int, optional): minimum reactant precedents for terminationmin_chempop_products(int, optional): minimum product precedents for terminationfilter_threshold(float, optional): fast filter thresholdtemplate_set(str, optional): template set to usetemplate_prioritizer_version(int, optional): version number of template relevance model to usereturn_first(bool, optional): whether to return upon finding the first pathwaystore_results(bool, optional): whether to permanently save this resultdescription(str, optional): description to associate with stored resultbanned_reactions(list, optional): list of reactions to not considerbanned_chemicals(list, optional): list of molecules to not consider
Returns:
task_id: celery task ID
The API endpoints in this section provide various utilities for working with SMILES.
Canonicalize the specified SMILES using RDKit.
URL: /api/v2/rdkit/smiles/canonicalize/
Method: POST
Parameters:
smiles(str): SMILES string to canonicalizeisomericSmiles(bool, optional): whether to generate isomeric SMILES
Returns:
smiles(str): canonicalized SMILES
Check the syntax and validity of a SMILES string.
URL: /api/v2/rdkit/smiles/validate/
Method: POST
Parameters:
smiles(str): SMILES string
Returns:
correct_syntax(bool): correctness of the SMILES syntaxvalid_chem_name(bool): validity of the chemical
RDKit ref: rdkit/rdkit#2430
Convert the provided Molfile to a SMILES string.
URL: /api/v2/rdkit/smiles/from_molfile/
Method: POST
Parameters:
molfile(str): Molfile inputisomericSmiles(bool, optional): whether to generate isomeric SMILES
Returns:
smiles(str): canonical SMILES
Convert the provided SMILES string to a Molfile.
URL: /api/v2/rdkit/smiles/to_molfile/
Method: POST
Parameters:
smiles(str): SMILES input
Returns:
molfile(str): Molfile output
The API endpoints in this section provide methods for accessing and modifying the buyables database. User authentication is required for any endpoints which modify the database.
API endpoint for viewing buyables or creating new buyables.
URL: /api/v2/buyables/
Method: GET
Query Parameters:
q(str): search query, e.g. SMILES stringsource(str): source of buyables dataregex(bool): whether or not to treatqas regex patternreturnLimit(int): maximum number of results to returncanonicalize(bool): whether or not to canonicalizeq
Returns:
search: query pattern used for searchresult: list of buyables matching search query
Method: POST
Parameters:
smiles(str): SMILES string of buyableppg(float): price of buyablesource(float): source of dataallowOverwrite(bool): whether or not to overwrite existing duplicates
Returns:
success: true if buyable was created successfullyerror: error message if not successfulduplicate: true if buyable was not added because it already existedinserted: buyables entry which was created if it didn't existupdated: buyables entry which was updated if it existed andallowOverwrite = True
API endpoint for viewing or deleting specific buyable. The buyable ID can be obtained from querying the main buyables endpoint.
URL: /api/v2/buyables/<buyable id>/
Method: GET
Returns:
_id: the requested buyable idresult: the requested buyableerror: error message if encountered
Method: DELETE
Returns:
success: true if deletion was successfulerror: error message if encountered
API endpoint for uploading buyables data.
URL: /api/v2/buyables/upload/
Method: POST
Parameters:
upload_file(file): file containing buyables dataformat(str): file format, either json or csvreturnLimit(int): maximum number of results to returnallowOverwrite(bool): whether or not to overwrite existing duplicates
Returns:
success: true if buyable was created successfullyerror: error message if not successfulinserted: list of new buyable entries, up toreturnLimitupdated: list of updated buyable entries, up toreturnLimitinserted_count: total number of inserted entriesupdated_count: total number of updated entriesduplicate_count: total number of duplicate entries ifallowOverwrite = Falsecount: total number of successfully uploaded entriestotal: total number of uploaded entries, including errors
The API endpoints in this section are for accessing retrosynthetic template data.
API endpoint for accessing a particular template entry. The template ID is returned from certain tasks, like the one-step retrosynthetic prediction.
URL: /api/v2/template/<template id>/
Method: GET
Returns:
template: reaction template
API endpoint for exporting template reference data as a Reaxys query.
Note that this only applies for the reaxys template set.
URL: /api/v2/template/<template id>/export/
Method: GET
Returns:
- JSON format Reaxys query
API endpoint to query available template sets.
URL: /api/v2/template/sets/
Method: GET
Returns:
template_sets: list of available template sets
The API endpoints in this section are for accessing saved results. Note that these are different from the celery task results. Currently, saved results include async tree builder jobs submitted via the web client and any web pages which have been manually saved. User authentication is required to access these endpoints.
API endpoint for accessing a user's job results.
URL: /api/v2/results/
Method: GET
Returns:
results: list of results belonging to the current user
API endpoint for accessing or deleting a particular result. The result ID can be obtained from the main results endpoint.
URL: /api/v2/results/<result id>/
Method: GET
Returns:
id: the requested result idresult: the requested resulterror: error message if encountered
Method: DELETE
Returns:
success: true if deletion was successfulerror: error message if encountered
API endpoint for checking the status of a particular result. The result ID can be obtained from the main results endpoint.
URL: /api/v2/results/<result id>/check/
Method: GET
Returns:
state: current state of the joberror: error message if encountered
The API endpoints in this section are for accessing and modifying user chemical and reaction banlists. User authentication is required to access these endpoints.
URLs:
/api/v2/banlist/chemicals/api/v2/banlist/reactions
Method: GET
Returns: list of banned chemical or reaction entries belonging to the currently authenticated user
Method: POST
Parameters:
smiles(str): chemical or reaction SMILES string to be addeddescription(str, optional): text descriptiondatetime(str, optional): timestamp, default current timeactive(bool, optional): whether this entry is active, default true
Returns: created entry
API endpoints for accessing or deleting a particular banlist entry. The entry ID can be obtained from the main banlist endpoints.
URLs:
/api/v2/banlist/chemicals/<id>/api/v2/banlist/reactions/<id>
Method: GET
Returns: entry with requested id
Method: DELETE
Returns:
success: true if successfully deleteddata: data from deleted entry
API endpoints for activating or deactivating a particular banlist entry. The entry ID can be obtained from the main banlist endpoints.
URLs:
/api/v2/banlist/chemicals/<id>/activate/api/v2/banlist/chemicals/<id>/deactivate/api/v2/banlist/reactions/<id>/activate/api/v2/banlist/reactions/<id>/deactivate
Method: GET
Returns:
success: true if successfully activateddata: updated entry data
The API endpoints in this section are for obtaining JSON Web Tokens to use for authenticating to API endpoints which require authentication.
API endpoint for requesting a temporary authentication token.
URL: /api/v2/token-auth/
Method: POST
Parameters:
username: usernamepassword: password
Returns:
token: JSON Web Token that can be used for authenticated requests
API endpoint for obtaining a refreshed token. Useful for extending expiration time.
URL: /api/v2/token-refresh/
Method: POST
Parameters:
token: valid, non-expired token
Returns:
token: JSON Web Token that can be used for authenticated requests
API endpoint for retrieving celery worker status.
URL: /api/v2/celery/
Method: GET
Returns:
queues: list of worker information for each celery queue
API endpoint for drawing molecules, reactions, and templates.
Notes:
- Both GET and POST requests are possible. GET requests may be easier for simple linking, while POST requests are better for complex data.
- If
input_typeis not specified, will attempt to determine type. Specifyinginput_typecan provide faster results.
URL: /api/v2/draw/
Method: GET, POST
Parameters:
smiles(str): input SMILES (or SMARTS) stringinput_type(str, optional): one of 'chemical', 'reaction', or 'template'transparent(bool, optional): whether background should be transparent (chemical only)draw_map(bool, optional): whether atom mapping should be drawn (reaction only)highlight(bool, optional): whether to highlight mapped atoms (reaction or chemical)reacting_atoms(list, optional): list of atom scores to highlight and label (chemical only)
Returns: PNG image of input SMILES
API endpoint for clustering similar transformed outcomes
URL: /api/v2/cluster/
Method: POST
Parameters:
original(str): smiles stringoutcomes(list): list of smiles strings of outcomesfeature(str, optional): features to use [original', 'outcomes', 'all']fingerprint(str, optional): fingerprint type ['morgan']fpradius(int, optional): fingerprint radius, default 1fpnbits(int, optional): fingerprint bits, default 512clustermethod(str, optional): cluster method ['hdbscan', 'kmeans']scores(list, optional): list of scores of precursors
Returns:
request: dictionary of request parametersoutput: list of cluster indices for outcomes
API endpoint for reaction lookup task.
URL: /api/v2/reactions/
Method: POST
Parameters:
ids(list): list of reaction ids to retrievetemplate_set(str, optional): template set to search within
Returns:
reactions: list of reactions
API endpoint for scscore prediction task.
URL: /api/v2/scscore/
Method: POST
Parameters:
smiles(str): SMILES string of target
Returns:
output: synthetic complexity score
API endpoint for querying available retrosynthetic models for a given template set.
URL: /api/v2/retro/models/
Method: GET
Parameters:
template_set(str): template set name
Returns:
versions: List of version numbers that are available