SMARTSview REST API Tutorial

This guide explains how to use our REST API for generating visualizations. Follow the steps below to prepare your JSON payload, and make POST and GET requests.
To make POST calls, you'll need an API key, which you can request here.

Preparing the JSON Payload

The API accepts a JSON payload with the following structure. Note that job_id is optional and will be auto-generated if not provided.
If the same request already exists in the database, the job_id of this request is returned, even if you specify a job_id.

{
  "job_id": "your_job_id", // Optional: auto-generated if not provided or duplicate request
  "query": {
    "smarts": "SMARTS_pattern",
    "parameters": {
      // see the complete list of parameters below
    }
  }
}

API Endpoint

Send requests to the following endpoint:

https://api.smarts.plus/smartsView/

API Key

This is how you integrate your API Key in header:

'X-API-Key': 'your-key-here'

API Requests in Different Languages

POST Request (JavaScript)

const data = {
  job_id: "your_job_id",
  query: {
    smarts: "SMARTS_pattern",
    parameters: {
      file_format: "png"
    }
  }
};

fetch('https://api.smarts.plus/smartsView/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key-here'
  },
  body: JSON.stringify(data)
})
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

GET Request (JavaScript)

fetch('https://api.smarts.plus/smartsView/?job_id=your_job_id')
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

Possible API Responses

Status Code Example Response Description
202 Accepted
{"job_id": "your_job_id"}
              
The job has been accepted and queued for processing. Use the returned job_id for subsequent GET requests.
200 OK
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "image": "base64-encoded image (PNG) or SVG string",
    "warnings": []
  }
}
              
The job completed successfully. The result contains the visualization image (either as a base64 encoded PNG or an SVG string) and any warnings generated.
200 OK
(with error in result)
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "error": "Error message"
  }
}
              
The job completed successfully, but an error occurred during processing. The result contains the error message.
400 Bad Request
{"error": "Invalid parameters"}
              
The request is missing required fields or contains invalid data.
404 Not Found
{"error": "Job not found"}
              
The job_id provided does not match any existing job.
500 Internal Server Error
{"error": "An unknown error occurred."}
              
An unexpected error occurred on the server. Contact support for help.

Complete List of Parameters

Parameter Default Value Description
visualization_mode 0 Visualization mode (0 = Complete Visualization, 1 = ID-Mapping, 2 = Element Symbols, 3 = Structure Diagram-Like)
visualization_of_default_bonds 0 Bond display option (0 = Single Bonds, 1 = Single or Aromatic Bonds)
labels_for_atoms false Whether to display labels for atoms
smartstrim_active false Enable or disable SMARTS trimming
legend_mode 0 Legend mode (0 = No legend, 1 = Dynamic, 2 = Static, 3 = Both)
smarts_string_into_picture true Embed the SMARTS string into the visualization image
file_format svg Output file format: either "png" or "svg"
smileslikearomaticity false Enable SMILES-like aromaticity interpretation
detectaromaticbonds false Detect aromatic bonds in the structure

Example JSON Payloads

Generate PNG Visualization Without a Legend

{
  "query": {
    "smarts": "[CX3](=[OX1])[OX2][CX3](=[OX1])",
    "parameters": {
      "file_format": "png",
      "visualization_mode": 0,
      "legend_mode": 0,
      "visualization_of_default_bonds": 0,
      "labels_for_atoms": false,
      "smartstrim_active": false,
      "smarts_string_into_picture": true
    }
  }
}

Generate SVG Visualization Using Element Symbols

{
  "query": {
    "smarts": "[$([nr5]:[nr5,or5,sr5]),$([nr5]:[cr5]:[nr5,or5,sr5])]",
    "parameters": {
      "file_format": "svg",
      "visualization_mode": 2,
      "visualization_of_default_bonds": 0,
      "labels_for_atoms": false,
      "smartstrim_active": false,
      "smarts_string_into_picture": true
    }
  }
}

SMARTScompare REST API Tutorial

This guide explains how to use our REST API for comparing SMARTS patterns. Follow the steps below to prepare your JSON payload, and make POST and GET requests.
To make POST calls, you'll need an API key, which you can request here.

Preparing the JSON Payload

The API accepts a JSON payload with the following structure. Note that job_id is optional and will be auto-generated if not provided.
If the same request already exists in the database, the job_id of this request is returned, even if you specify a job_id.

{
  "job_id": "your_job_id", // Optional: auto-generated if not provided or duplicate request
  "query": {
    "smarts": "first_SMARTS_pattern",
    "smarts2": "second_SMARTS_pattern",
    "parameters": {
      // see the complete list of parameters below
    }
  }
}

API Endpoint

Send requests to the following endpoint:

https://api.smarts.plus/smartsCompare

API Key

This is how you integrate your API Key in header:

'X-API-Key': 'your-key-here'

API Requests in Different Languages

POST Request (JavaScript)

const data = {
  job_id: "your_job_id",
  query: {
    smarts: "first_SMARTS_pattern",
    smarts2: "second_SMARTS_pattern",
    parameters: {
      file_format: "png"
    }
  }
};

fetch('https://api.smarts.plus/smartsCompare', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key-here' 
  },
  body: JSON.stringify(data)
})
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

GET Request (JavaScript)

fetch('https://api.smarts.plus/smartsCompare?job_id=your_job_id')
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

Possible API Responses

Status Code Example Response Description
202 Accepted
{"job_id": "your_job_id"}
              
The job has been accepted and queued for processing. Use the returned job_id for subsequent GET requests.
200 OK
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "image": "base64-encoded image (PNG) or SVG string",
    "warnings": []
  }
}
              
The job completed successfully. The result contains the visualization image (either as a base64 encoded PNG or an SVG string) and any warnings generated.
200 OK
(with error in result)
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "error": "Error message"
  }
}
              
The job completed successfully, but an error occurred during processing. The result contains the error message.
400 Bad Request
{"error": "Invalid parameters"}
              
The request is missing required fields or contains invalid data.
404 Not Found
{"error": "Job not found"}
              
The job_id provided does not match any existing job.
500 Internal Server Error
{"error": "An unknown error occurred."}
              
An unexpected error occurred on the server. Contact support for help.

Complete List of Parameters

Parameter Default Value Description
visualization_mode 0 Visualization mode (0 = Complete Visualization, 1 = ID-Mapping, 2 = Element Symbols, 3 = Structure Diagram-Like)
visualization_of_default_bonds 0 Bond display option (0 = Single Bonds, 1 = Single or Aromatic Bonds)
labels_for_atoms false Whether to display labels for atoms
smartstrim_active false Enable or disable SMARTS trimming
legend_mode 0 Legend mode (0 = No legend, 1 = Dynamic, 2 = Static, 3 = Both)
smarts_string_into_picture true Embed the SMARTS string into the visualization image
file_format svg Output file format: either "png" or "svg"
mode similarity Comparison mode:
identical, subsetoffirst, subsetofsecond, subsetrelation, similarity
smileslikearomaticity false Enable SMILES-like aromaticity interpretation
detectaromaticbonds false Detect aromatic bonds in the structure

Example JSON Payloads

Molecule SMARTS Comparison

{
  "query": {
    "smarts": "[#6][$([NX2]=O),$(N=C=O),$(OC#N),$(SC#N)]",
    "smarts2": "N(C)=C=[#8]",
    "parameters": {"mode": "similarity"}
  }
}

Substructure SMARTS Comparison

{
  "query": {
    "smarts": "[#6][$([NX2]=O),$(N=C=O),$(OC#N),$(SC#N)]",
    "smarts2": "[#6][NX2]=O",
    "parameters": {"mode": "subsetoffirst"}
  }
}

Compare Two Reaction SMARTS with Atom Labels

{
  "query": {
    "smarts": "[CH0;$(C-[#6]):1]#[NH0:2].[C;A;!$(C=O):3]-[*;#17,#35,#53]>>[C:1]1=[N:2]-N(-[C:3])-N=N-1",
    "smarts2": "[CH0;$(C-[#6]):1]#[NH0:2].[C;A;!$(C=O):3]-[*;#17,#35,#53]>>[C:1]1=[N:2]-N=N-N-1(-[C:3])",
    "parameters": {
      "labels_for_atoms": true,
      "mode": "product_first"
    }
  }
}

ReactionSMARTScompare REST API Tutorial

This guide explains how to use our REST API for comparing ReactionSMARTS patterns. Follow the steps below to prepare your JSON payload, and make POST and GET requests.
To make POST calls, you'll need an API key, which you can request here.

Preparing the JSON Payload

The API accepts a JSON payload with the following structure. Note that job_id is optional and will be auto-generated if not provided.
If the same request already exists in the database, the job_id of this request is returned, even if you specify a job_id.

{
  "job_id": "your_job_id", // Optional: auto-generated if not provided or duplicate request
  "query": {
    "smarts": "first_ReactionSMARTS_pattern",
    "smarts2": "second_ReactionSMARTS_pattern",
    "parameters": {
      // see the complete list of parameters below
    }
  }
}

API Endpoint

Send requests to the following endpoint:

https://api.smarts.plus/reactionSmartsCompare/

API Key

This is how you integrate your API Key in header:

'X-API-Key': 'your-key-here'

API Requests in Different Languages

POST Request (JavaScript)

const data = {
  job_id: "your_job_id",
  query: {
    smarts: "first_ReactionSMARTS_pattern",
    smarts2: "second_ReactionSMARTS_pattern",
    parameters: {
      file_format: "png"
    }
  }
};

fetch('https://api.smarts.plus/reactionSmartsCompare/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key-here' 
  },
  body: JSON.stringify(data)
})
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

GET Request (JavaScript)

fetch('https://api.smarts.plus/reactionSmartsCompare/?job_id=your_job_id')
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

Possible API Responses

Status Code Example Response Description
202 Accepted
{"job_id": "your_job_id"}
              
The job has been accepted and queued for processing. Use the returned job_id for subsequent GET requests.
200 OK
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "image": "base64-encoded image (PNG) or SVG string",
    "warnings": []
  }
}
              
The job completed successfully. The result contains the visualization image (either as a base64 encoded PNG or an SVG string) and any warnings generated.
200 OK
(with error in result)
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "error": "Error message"
  }
}
              
The job completed successfully, but an error occurred during processing. The result contains the error message.
400 Bad Request
{"error": "Invalid parameters"}
              
The request is missing required fields or contains invalid data.
404 Not Found
{"error": "Job not found"}
              
The job_id provided does not match any existing job.
500 Internal Server Error
{"error": "An unknown error occurred."}
              
An unexpected error occurred on the server. Contact support for help.

Complete List of Parameters

Parameter Default Value Description
visualization_mode 0 Visualization mode (0 = Complete Visualization, 1 = ID-Mapping, 2 = Element Symbols, 3 = Structure Diagram-Like)
visualization_of_default_bonds 0 Bond display option (0 = Single Bonds, 1 = Single or Aromatic Bonds)
labels_for_atoms false Whether to display labels for atoms
smartstrim_active false Enable or disable SMARTS trimming
legend_mode 0 Legend mode (0 = No legend, 1 = Dynamic, 2 = Static, 3 = Both)
smarts_string_into_picture true Embed the ReactionSMARTS string into the visualization image
file_format svg Output file format: either "png" or "svg"
mode educts_first Comparison mode:
educts_first, products_first, ignore_labels
smileslikearomaticity false Enable SMILES-like aromaticity interpretation
detectaromaticbonds false Detect aromatic bonds in the structure

Example JSON Payloads

Compare Two Reaction SMARTS with Atom Labels

{
  "query": {
    "smarts": "[CH0;$(C-[#6]):1]#[NH0:2].[C;A;!$(C=O):3]-[*;#17,#35,#53]>>[C:1]1=[N:2]-N(-[C:3])-N=N-1",
    "smarts2": "[CH0;$(C-[#6]):1]#[NH0:2].[C;A;!$(C=O):3]-[*;#17,#35,#53]>>[C:1]1=[N:2]-N=N-N-1(-[C:3])",
    "parameters": {
      "labels_for_atoms": true,
      "mode": "product_first"
    }
  }
}

SMARTSsearch REST API Tutorial

Search SMARTS in predefined or custom filter sets. Follow the steps below to prepare your JSON payload, and make POST and GET requests.
To make POST calls, you'll need an API key, which you can request here.

Preparing the JSON Payload

The API accepts a JSON payload with the following structure. Note that job_id is optional and will be auto-generated if not provided.
If the same request already exists in the database, the job_id of this request is returned, even if you specify a job_id.

        {
  "job_id": "your_job_id", // Optional: auto-generated if not provided or duplicate request
  "query": {
    "smarts": "SMARTS_pattern",
    "parameters": {
      "filter_set": [], // see the complete list of filter sets below
      // see the complete list of parameters below
    }
  }
}

API Endpoint

Send requests to the following endpoint:

https://api.smarts.plus/smartsSearch

API Key

This is how you integrate your API Key in header:

'X-API-Key': 'your-key-here'

API Requests in Different Languages

POST Request (JavaScript)

        const data = {
  job_id: "your_job_id",
  query: {
    smarts: "SMARTS_pattern",
    parameters: {}
  }
};

fetch('https://api.smarts.plus/smartsSearch', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key-here' 
  },
  body: JSON.stringify(data)
})
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

GET Request (JavaScript)

        fetch('https://api.smarts.plus/smartsSearch?job_id=your_job_id')
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

Possible API Responses

Status Code Example Response Description
202 Accepted
{"job_id": "your_job_id"}
The job has been accepted and queued for processing. Use the returned job_id for subsequent GET requests.
200 OK
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "similarity_results": [
      {
        "similarity": "value between 0.0 and 1.0, higher is more similar",
        "smarts": "The query SMARTS pattern",
        "smarts_to_compare": "The SMARTS pattern found in filterset",
        "filterset": "The filter set where the SMARTS was found",
        "name": "The name of the SMARTS pattern",
        "uniquefiltersetid": "Unique id for internal use"
      },
      ...
    ],
    "warnings": []
  }
}
The job completed successfully. The result contains the similarity results and any warnings generated.
200 OK
(with error in result)
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": { "error": "Error message" }
}
The job completed successfully, but an error occurred during processing. The result contains the error message.
400 Bad Request
{"error": "Invalid parameters"}
The request is missing required fields or contains invalid data.
404 Not Found
{"error": "Job not found"}
The job_id provided does not match any existing job.
500 Internal Server Error
{"error": "An unknown error occurred."}
An unexpected error occurred on the server. Contact support for help.

Complete List of Parameters

Parameter Default Value Description
filter_set all available filter sets Comma-separated list of filter sets: BMS, Dundee, Glaxo, Inpharmatica, LINT, MLSMR, PAINS, SMARTCyp, SureChEMBL. If using a custom filter set, 'custom' must be included in this list.
custom_filter_set none Custom filter set with SMARTS patterns separated by newlines
number_of_results 100 Maximum number of results
mode similarity identical, subsetoffirst, subsetofsecond, similarity

Complete List of Filter Sets

Filter Set Description Reference
BMS A set of SMARTS patterns originating from Bristol-Myers Squibb. Primarily used to exclude compounds prone to false positives or other problematic behaviors in high-throughput screening. BMS
Dundee Provided by the University of Dundee, these filters help identify non-desirable compounds, particularly in neglected tropical disease (NTD) screening libraries. Dundee
Glaxo The so-called "Hard Filters" developed at Glaxo Wellcome (now part of GSK). Designed to remove structural motifs known to cause non-specific binding, toxicity, or poor ADMET properties. Glaxo
Inpharmatica A collection of unwanted fragment filters derived by Inpharmatica Ltd., used to exclude substructures likely to interfere with screening or lead optimization. Inpharmatica
LINT Pfizer’s “lint” filters for undesirable functionalities. These are used to flag compounds containing potentially reactive, promiscuous, or otherwise problematic groups. LINT
MLSMR The NIH Molecular Libraries Small Molecule Repository (MLSMR) filters exclude functionalities deemed reactive or prone to assay interference, helping maintain cleaner screening libraries. MLSMR
PAINS Pan-Assay Interference Compounds (PAINS) filters developed to identify chemical motifs that frequently cause false positives in multiple assay formats. PAINS
SMARTCyp A set of patterns and rules for predicting likely sites of cytochrome P450-mediated metabolism. It is a well-known open-source SMARTS-based approach for CYP site prediction. SMARTCyp
SureChEMBL Non-MedChem Friendly SMARTS patterns from SureChEMBL, aiming to detect substructures considered less suitable for medicinal chemistry due to potential reactivity or poor properties. SureChEMBL

Example JSON Payloads

Search SMARTS in Filter Set BMS

        {
  "job_id": "your_job_id",
  "query": {
    "smarts": "[CX3](=[OX1])[OX2][CX3](=[OX1])",
    "parameters": {
      "filter_set": ["BMS"]
    }
  }
}

Search SMARTS in Multiple Filter Sets

        {
  "job_id": "your_job_id",
  "query": {
    "smarts": "[$([nr5]:[nr5,or5,sr5]),$([nr5]:[cr5]:[nr5,or5,sr5])]",
    "parameters": {
      "filter_set": ["PAINS", "Glaxo", "SureChEMBL"]
    }
  }
}

Search SMARTS using a Custom Filter Set

        {
  "job_id": "your_job_id",
  "query": {
    "smarts": "[CX3](=[OX1])[OX2][CX3](=[OX1])",
    "parameters": {
      "filter_set": ["custom"],
      "custom_filter_set": "[CX3](=[OX1])[OX2] SMARTS_1\n[C]C=C SMARTS_2"
    }
  }
}

ReactionSMARTSsearch REST API Tutorial

Search ReactionSMARTS in predefined or custom filter sets. Follow the steps below to prepare your JSON payload, and make POST and GET requests.
To make POST calls, you'll need an API key, which you can request here.

Preparing the JSON Payload

The API accepts a JSON payload with the following structure. Note that job_id is optional and will be auto-generated if not provided.
If the same request already exists in the database, the job_id of this request is returned, even if you specify a job_id.

{
  "job_id": "your_job_id", // Optional: auto-generated if not provided or duplicate request
  "query": {
    "smarts": "ReactionSMARTS_pattern",
    "parameters": {
      "filter_set": [], // see the complete list of filter sets below
      // see the complete list of parameters below
    }
  }
}

API Endpoint

Send requests to the following endpoint:

https://api.smarts.plus/reactionSmartsSearch/

API Key

This is how you integrate your API Key in header:

'X-API-Key': 'your-key-here'

API Requests in Different Languages

POST Request (JavaScript)

const data = {
  job_id: "your_job_id",
  query: {
    smarts: "ReactionSMARTS_pattern",
    parameters: {
      // Add any additional parameters here
    }
  }
};

fetch('https://api.smarts.plus/reactionSmartsSearch/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key-here' 
  },
  body: JSON.stringify(data)
})
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

GET Request (JavaScript)

fetch('https://api.smarts.plus/reactionSmartsSearch/?job_id=your_job_id')
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

Possible API Responses

Status Code Example Response Description
202 Accepted
{"job_id": "your_job_id"}
The job has been accepted and queued for processing. Use the returned job_id for subsequent GET requests.
200 OK
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "similarity_results": [
      {
        "similarity": "value between 0.0 and 1.0, higher is more similar",
        "smarts": "The query ReactionSMARTS pattern",
        "smarts_to_compare": "The ReactionSMARTS pattern found in filterset",
        "filterset": "The filter set where the ReactionSMARTS was found",
        "name": "The name of the ReactionSMARTS pattern",
        "uniquefiltersetid": "Unique id for internal use"
      },
      ...
    ],
    "warnings": []
  }
}
The job completed successfully. The result contains the similarity results and any warnings generated.
200 OK
(with error in result)
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": { "error": "Error message" }
}
The job completed successfully, but an error occurred during processing. The result contains the error message.
400 Bad Request
{"error": "Invalid parameters"}
The request is missing required fields or contains invalid data.
404 Not Found
{"error": "Job not found"}
The job_id provided does not match any existing job.
500 Internal Server Error
{"error": "An unknown error occurred."}
An unexpected error occurred on the server. Contact support for help.

Complete List of Parameters

Parameter Default Value Description
filter_set all available filter sets Comma-separated list of filter sets: Hartenfeller. If using a custom filter set, 'custom' must be included in this list.
custom_filter_set none Custom filter set with ReactionSMARTS patterns separated by newlines
number_of_results 100 Maximum number of results
mode educts_first educts_first, products_first, ignore_labels

Complete List of Filter Sets

Filter Set Description Reference
Hartenfeller A curated set of reaction-focused SMARTS patterns created by Hartenfeller and coauthors. These patterns highlight reactive functional groups and chemical transformations often targeted during library design, virtual screening, or hit expansion. Hartenfeller et al.

Example Requests

Search ReactionSMARTS in Filter Set Hartenfeller

{
  "job_id": "your_job_id",
  "query": {
    "smarts": "[C:1](=[O:2])[OH:3].[N:4]>>[C:1](=[O:2])[N:4]",
    "parameters": {
      "filter_set": ["hartenfeller"]
    }
  }
}

Search ReactionSMARTS using a Custom Filter Set

{
  "job_id": "your_job_id",
  "query": {
    "smarts": "[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]",
    "parameters": {
      "filter_set": ["custom"],
      "custom_filter_set": "[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]\n[C:1](=[O:2])O.Cl[C:3]>>[C:1](=[O:2])[C:3]"
    }
  }
}

SMARTS Create REST API Tutorial

Generate SMARTS patterns to discriminate between two compound sets. Follow the steps below to prepare your JSON payload, and make POST and GET requests.
To make POST calls, you'll need an API key, which you can request here.

Preparing the JSON Payload

The API accepts a JSON payload with the following structure. Note that job_id is optional and will be auto-generated if not provided.
If the same request already exists in the database, the job_id of this request is returned, even if you specify a job_id.

{
  "job_id": "your_job_id",  // Optional, auto-generated if left empty
  "query": {
    "pos_data": "positive_SMILES_list",
    "neg_data": "negative_SMILES_list",
    "pos_name": "optional_positive_set_name",
    "neg_name": "optional_negative_set_name",
    "parameters": {
      // see the complete list of parameters below
    }
  }
}

API Endpoint

Send requests to the following endpoint:

https://api.smarts.plus/smartsCreate/

API Key

This is how you integrate your API Key in header:

'X-API-Key': 'your-key-here'

API Requests in Different Languages

POST Request (JavaScript)

const data = {
  job_id: "your_job_id",
  query: {
    pos_data: "positive_SMILES_list",
    neg_data: "negative_SMILES_list",
    pos_name: "optional_positive_set_name",
    neg_name: "optional_negative_set_name",
    parameters: {
      // Add additional parameters here if needed
    }
  }
};

fetch('https://api.smarts.plus/smartsCreate/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key-here' 
  },
  body: JSON.stringify(data)
})
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

GET Request (JavaScript)

fetch('https://api.smarts.plus/smartsCreate/?job_id=your_job_id')
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.error('Error:', error));

Possible API Responses

Status Code Example Response Description
202 Accepted
{"job_id": "your_job_id"}
The job has been accepted and queued for processing. Use the returned job_id for subsequent GET requests.
200 OK
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "smarts_miner_result": [
      {
        "score": "Score of the result pattern. (1.0 -> sets are perfectly separated)",
        "smarts": "Generated SMARTS pattern",
        "neg_sup": "Percentage of negative molecules that match the pattern",
        "pos_sup": "Percentage of positive molecules that match the pattern",
        "neg_matches": "Number of negative molecules that match the pattern",
        "pos_matches": "Number of positive molecules that match the pattern",
        "vertex_count": "Number of atoms in the pattern",
        "cycle_count": "Number of cycles in the pattern"
      },
      ...
    ],
    "warnings": []
  }
}
The job completed successfully. The result contains a list of generated SMARTS patterns.
200 OK
(with error in result)
{
  "job_id": "your_job_id",
  "query": { ... },
  "result": {
    "error": "Error message"
  }
}
The job completed successfully, but an error occurred during processing. The result contains the error message.
400 Bad Request
{"error": "Invalid parameters"}
The request is missing required fields or contains invalid data.
404 Not Found
{"error": "Job not found"}
The job_id provided does not match any existing job.
500 Internal Server Error
{"error": "An unknown error occurred."}
An unexpected error occurred on the server. Contact support for help.

Complete List of Parameters

Parameter Default Value Description
pos_support 70 Minimum percentage of positive molecules that must match a pattern (Required, between 0 and 100).
neg_support 30 Maximum percentage of negative molecules that may match a pattern (Required, between 0 and 100).
filter_param 0 Filtering method: 0 = No Filter, 1 = Balanced, 2 = Small Patterns.

Example Requests

Generate SMARTS with the balanced filter method

{
  "job_id": "your_job_id",
  "query": {
    "pos_data": "CCC(N)CCC\nCC(N)C",
    "neg_data": "C\nCC\nN",
    "parameters": {
      "pos_support": 70,
      "neg_support": 50,
      "filter_param": 1
    }
  }
}

Generate SMARTS with scope for small patterns

{
  "job_id": "your_job_id",
  "query": {
    "pos_data": "CCC(N)CCC\nCC(N)C",
    "neg_data": "C\nCC\nN",
    "parameters": {
      "pos_support": 70,
      "neg_support": 20,
      "filter_param": 2
    }
  }
}