Skip to main content
FAIR-TPs
API version v1

FAIR-TPs API

Programmatic access to FAIR-TPs compound and transformation data.

Search compounds, read full compound records, follow the transformations recorded for a compound, find the shortest pathway between two compounds and run SMARTS substructure searches. Every endpoint is a plain GET request that returns JSON or XML.

OpenAPI specificationInteractive reference

Quick start

All endpoints share one base URL. No account or API key is needed.

Base URL

https://fairtps.lcsb.uni.lu/api/v1

Try a compound search. Open the URL in a browser or run the same request with curl.

URL
https://fairtps.lcsb.uni.lu/api/v1/compounds?q=atrazine
curl
curl "https://fairtps.lcsb.uni.lu/api/v1/compounds?q=atrazine"

count is the number of matches across all pages. Use the inchikey of a result to fetch its full record.

Response
{
  "meta": {
    "api_version": "v1",
    "count": 17,
    "page": 1,
    "page_size": 20,
    "total_pages": 1
  },
  "data": [
    {
      "inchikey": "MXWJVTOOROXGIU-UHFFFAOYSA-N",
      "name": "Atrazine",
      "title": "Atrazine",
      "iupac_name": "6-chloro-4-N-ethyl-2-N-propan-2-yl-1,3,5-triazine-2,4-diamine",
      "molecular_formula": "C8H14ClN5",
      "pubchem_cid": "2256",
      "mass": 215.0937732,
      "xlogp": 2.6
    }
  ]
}
Shortened to the first of the matching compounds.

What you can do

Each task maps to a single endpoint.

Endpoints

The API has seven endpoints. All of them are read only and use GET. Open an example response to see the fields it returns.

Service metadata

GET/api/v1/meta

Returns the API version and the response formats the service supports. It is a quick way to check that the API is reachable.

Parameters

None.

Example request
https://fairtps.lcsb.uni.lu/api/v1/meta
Example response
JSON
{
  "api_version": "v1",
  "service": "FAIR-TPs Public API",
  "supported_formats": [
    "application/json",
    "application/xml"
  ],
  "documentation": "/api/v1/docs"
}

Search compounds

GET/api/v1/compounds

Searches compound names, PubChem titles, IUPAC names and synonyms, ignoring letter case. Each compound appears once and is returned as a summary.

Summaries leave out synonyms and structures. Fetch a compound by its inchikey for the full record.

Parameters

qOptional
Search text, up to 1024 characters. When it is omitted or empty, the response is an empty page.Example atrazine
pageOptional
Page number, starting at 1.Default 1Example 2
page_sizeOptional
Results per page, from 1 to 100.Default 20Example 50
Example request
https://fairtps.lcsb.uni.lu/api/v1/compounds?q=atrazine
Example response
JSON
{
  "meta": {
    "api_version": "v1",
    "count": 17,
    "page": 1,
    "page_size": 20,
    "total_pages": 1
  },
  "data": [
    {
      "inchikey": "MXWJVTOOROXGIU-UHFFFAOYSA-N",
      "name": "Atrazine",
      "title": "Atrazine",
      "iupac_name": "6-chloro-4-N-ethyl-2-N-propan-2-yl-1,3,5-triazine-2,4-diamine",
      "molecular_formula": "C8H14ClN5",
      "pubchem_cid": "2256",
      "mass": 215.0937732,
      "xlogp": 2.6
    }
  ]
}
Shortened to the first of the matching compounds.

Compound details

GET/api/v1/compounds/{inchikey}

Returns the full record for one compound, including synonyms, SMILES, InChI, exact and monoisotopic mass, molecular weight and XLogP.

Parameters

inchikeyRequired
A standard InChIKey. Letter case does not matter. A malformed key returns 422 and an unknown key returns 404.Example MXWJVTOOROXGIU-UHFFFAOYSA-NPart of the path
Example request
https://fairtps.lcsb.uni.lu/api/v1/compounds/MXWJVTOOROXGIU-UHFFFAOYSA-N
Example response
JSON
{
  "inchikey": "MXWJVTOOROXGIU-UHFFFAOYSA-N",
  "name": "Atrazine",
  "title": "Atrazine",
  "iupac_name": "6-chloro-4-N-ethyl-2-N-propan-2-yl-1,3,5-triazine-2,4-diamine",
  "synonyms": [
    "atrazine",
    "1912-24-9",
    "Gesaprim",
    "Aatrex"
  ],
  "molecular_formula": "C8H14ClN5",
  "pubchem_cid": "2256",
  "smiles": "CCNC1=NC(=NC(=N1)Cl)NC(C)C",
  "canonical_smiles": "CCNC1=NC(=NC(=N1)Cl)NC(C)C",
  "isomeric_smiles": "CCNC1=NC(=NC(=N1)Cl)NC(C)C",
  "inchi": "InChI=1S/C8H14ClN5/c1-4-10-7-12-6(9)13-8(14-7)11-5(2)3/h5H,4H2,1-3H3,(H2,10,11,12,13,14)",
  "exact_mass": 215.0937732,
  "monoisotopic_mass": 215.0937732,
  "molecular_weight": 215.68,
  "xlogp": 2.6
}
The synonyms list is shortened.

Compound connections

GET/api/v1/compounds/{inchikey}/connections

Lists the recorded transformation reactions that involve a compound. Each entry names the substrate and the product in the direction of the reaction, with biosystems, enzymes, the dataset reference and the change in mass and XLogP.

mass_diff and xlogp_diff are product minus substrate. A value of 0 is a measured result, while null means no value is available.

Parameters

inchikeyRequired
InChIKey of the compound.Example MXWJVTOOROXGIU-UHFFFAOYSA-NPart of the path
directionOptional
outgoing lists reactions where the compound is the substrate, incoming lists reactions where it is the product, and both lists all of them.Default bothExample outgoing
datasetOptional
Keeps reactions from one dataset. The value must match a dataset_reference exactly.
biosystemOptional
Keeps reactions recorded for one biosystem. Matching ignores letter case.Example Human
enzymeOptional
Keeps reactions recorded for one enzyme. Matching ignores letter case.Example CYP3A4
pageOptional
Page number, starting at 1.Default 1Example 2
page_sizeOptional
Results per page, from 1 to 100.Default 20Example 50
Example request
https://fairtps.lcsb.uni.lu/api/v1/compounds/MXWJVTOOROXGIU-UHFFFAOYSA-N/connections?page_size=1
Example response
JSON
{
  "meta": {
    "api_version": "v1",
    "count": 126,
    "page": 1,
    "page_size": 1,
    "total_pages": 126
  },
  "data": [
    {
      "direction": "outgoing",
      "substrate": {
        "inchikey": "MXWJVTOOROXGIU-UHFFFAOYSA-N",
        "name": "Atrazine",
        "molecular_formula": "C8H14ClN5",
        "pubchem_cid": "2256"
      },
      "product": {
        "inchikey": "DFWFIQKMSFGDCQ-UHFFFAOYSA-N",
        "name": "Deethylatrazine",
        "molecular_formula": "C6H10ClN5",
        "pubchem_cid": "22563"
      },
      "transformation": "Environmental Transformation",
      "biosystems": [],
      "enzymes": [],
      "dataset_reference": "Kiefer, K.; Müller, A.; Singer, H.; Hollender, J. S60 | SWISSPEST19 | Swiss Pesticides and Metabolites from Kiefer et al. 2019. Zenodo. DOI: 10.5281/zenodo.3544760.",
      "evidence": null,
      "evidence_doi": null,
      "mass_diff": -28.031300199999976,
      "xlogp_diff": -1.1
    }
  ]
}

Shortest pathway

GET/api/v1/pathways/shortest

Finds the shortest chain of transformation reactions from one compound to another. Both compounds are identified by InChIKey.

When no forward chain exists, the reverse direction is searched and traversal says which one answered. If nothing connects the two compounds, the response is still 200 with found set to false. Up to 25 equally short pathways are returned.

Parameters

sourceRequired
InChIKey of the starting compound.Example MXWJVTOOROXGIU-UHFFFAOYSA-N
targetRequired
InChIKey of the compound to reach. It must differ from source.Example DFWFIQKMSFGDCQ-UHFFFAOYSA-N
max_depthOptional
Longest pathway to search for, counted in reactions, from 1 to 20. A smaller value makes the search faster.Default 20Example 3
Example request
https://fairtps.lcsb.uni.lu/api/v1/pathways/shortest?source=MXWJVTOOROXGIU-UHFFFAOYSA-N&target=DFWFIQKMSFGDCQ-UHFFFAOYSA-N&max_depth=1
Example response
JSON
{
  "source": "MXWJVTOOROXGIU-UHFFFAOYSA-N",
  "target": "DFWFIQKMSFGDCQ-UHFFFAOYSA-N",
  "max_depth": 1,
  "found": true,
  "traversal": "forward",
  "path_length": 1,
  "pathway_count": 1,
  "pathways": [
    {
      "length": 1,
      "nodes": [
        {
          "position": 0,
          "inchikey": "MXWJVTOOROXGIU-UHFFFAOYSA-N",
          "name": "Atrazine",
          "molecular_formula": "C8H14ClN5",
          "pubchem_cid": "2256"
        },
        {
          "position": 1,
          "inchikey": "DFWFIQKMSFGDCQ-UHFFFAOYSA-N",
          "name": "Deethylatrazine",
          "molecular_formula": "C6H10ClN5",
          "pubchem_cid": "22563"
        }
      ],
      "steps": [
        {
          "step": 1,
          "substrate": {
            "inchikey": "MXWJVTOOROXGIU-UHFFFAOYSA-N",
            "name": null,
            "molecular_formula": null,
            "pubchem_cid": "2256"
          },
          "product": {
            "inchikey": "DFWFIQKMSFGDCQ-UHFFFAOYSA-N",
            "name": null,
            "molecular_formula": null,
            "pubchem_cid": "22563"
          },
          "transformation": "Dealkylation",
          "biosystems": [
            "Rice"
          ],
          "enzymes": [],
          "dataset_reference": null,
          "evidence": null,
          "evidence_doi": null,
          "mass_diff": -28.031300199999976,
          "xlogp_diff": -1.1
        }
      ]
    }
  ]
}

Substructure search

GET/api/v1/search/substructure

Finds compounds whose structure contains a SMARTS pattern. Matching uses RDKit, and every candidate is checked before results are paged, so count is complete.

A valid pattern that matches nothing returns 200 with a count of 0. A pattern RDKit cannot parse returns 422. URL encode the pattern when you build the request.

Parameters

smartsRequired
One SMARTS pattern, up to 512 characters.Example c1ncncn1
datasetOptional
Limits the search to compounds from one dataset reference, matched exactly.
biosystemOptional
Limits the search to compounds recorded for one biosystem. Matching ignores letter case.
pageOptional
Page number, starting at 1.Default 1Example 2
page_sizeOptional
Results per page, from 1 to 100.Default 20Example 50
Example request
https://fairtps.lcsb.uni.lu/api/v1/search/substructure?smarts=c1ncncn1&page_size=1
Example response
JSON
{
  "meta": {
    "api_version": "v1",
    "count": 170,
    "page": 1,
    "page_size": 1,
    "total_pages": 170
  },
  "data": [
    {
      "inchikey": "UUVWYPNAQBNQJQ-UHFFFAOYSA-N",
      "name": "Altretamine",
      "title": "Altretamine",
      "iupac_name": "2-N,2-N,4-N,4-N,6-N,6-N-hexamethyl-1,3,5-triazine-2,4,6-triamine",
      "molecular_formula": "C9H18N6",
      "pubchem_cid": "2123",
      "mass": 210.1592946,
      "xlogp": 2.7
    }
  ]
}

Batch substructure search

GET/api/v1/search/substructure/batch

Searches with several SMARTS patterns at once and returns compounds that match any of them, ranked by how many of the patterns each compound matches.

Repeat the smarts parameter once per pattern. If any pattern is invalid, the whole request returns 422, so a partial result is never mistaken for a complete one.

Parameters

smartsRequired
A SMARTS pattern. Repeat the parameter for each pattern, up to 12 in one request.Example c1ncncn1Can be repeated
datasetOptional
Limits the search to compounds from one dataset reference, matched exactly.
biosystemOptional
Limits the search to compounds recorded for one biosystem. Matching ignores letter case.
pageOptional
Page number, starting at 1.Default 1Example 2
page_sizeOptional
Results per page, from 1 to 100.Default 20Example 50
Example request
https://fairtps.lcsb.uni.lu/api/v1/search/substructure/batch?smarts=c1ncncn1&smarts=C%28%3DO%29O&page_size=1
Example response
JSON
{
  "meta": {
    "api_version": "v1",
    "count": 3745,
    "page": 1,
    "page_size": 1,
    "total_pages": 3745
  },
  "data": [
    {
      "inchikey": "GOJNKIKCITVQDE-UHFFFAOYSA-N",
      "name": "Atrazine-GSH-conjugate",
      "title": "Atrazine-GSH-conjugate",
      "iupac_name": "2-[3-[[4-(ethylamino)-6-(propan-2-ylamino)-1,3,5-triazin-2-yl]sulfanyl]propanoylamino]acetic acid",
      "molecular_formula": "C13H22N6O3S",
      "pubchem_cid": "177546081",
      "mass": 342.14740976,
      "xlogp": 1.5
    }
  ]
}
This request searches for a 1,3,5-triazine ring or a carboxylic acid group.

Responses

Responses are JSON by default. Endpoints that return lists share one envelope: a meta object with pagination details and a data array.

meta.count
Matches across all pages.
meta.page
The page you received.
meta.page_size
Items per page.
meta.total_pages
Pages available at this page size.

Fields without a value are returned as null rather than left out, and pubchem_cid is a string so identifiers are never altered by number parsing.

The same data is available as XML. Send Accept: application/xml and every list uses named elements.

XML
curl -H "Accept: application/xml" "https://fairtps.lcsb.uni.lu/api/v1/meta"

Errors

Errors are returned as problem documents (RFC 9457) in the format you asked for. Branch on the code field, which stays stable, rather than on the readable title or detail.

404

The compound or the path does not exist.

not_found

406

The Accept header asks for a format the API does not provide. Use JSON or XML.

not_acceptable

414

The request URL is too long, usually because of long SMARTS patterns. Send fewer or shorter patterns.

uri_too_long

422

The request was understood, but a parameter is missing or invalid. For most validation errors the errors list names the parameter.

validation_errortoo_many_patterns

429

Too many requests arrived in a short period. Wait and retry later.

rate_limited

503

The service cannot complete the request right now. If a search ran out of time, narrow it instead of repeating it unchanged.

temporarily_unavailablescientific_query_timeoutcapacity_exhaustedresource_control_unavailable

Example problem document
{
  "type": "/api/v1/problems/validation_error",
  "title": "Validation error",
  "status": 422,
  "detail": "One or more request parameters were invalid.",
  "code": "validation_error",
  "instance": "/api/v1/compounds",
  "errors": [
    {
      "field": "query.page_size",
      "code": "less_than_equal",
      "message": "Input should be less than or equal to 100"
    }
  ]
}

Examples

Three short tasks that cover most first integrations.

Look up a compound by name

  1. Search for atrazine and note the inchikey of the result you want.

    GET
    https://fairtps.lcsb.uni.lu/api/v1/compounds?q=atrazine
  2. Request the full record with that key.

    GET
    https://fairtps.lcsb.uni.lu/api/v1/compounds/MXWJVTOOROXGIU-UHFFFAOYSA-N

See what a compound transforms into

  1. Ask for the reactions in which atrazine is the substrate.

    GET
    https://fairtps.lcsb.uni.lu/api/v1/compounds/MXWJVTOOROXGIU-UHFFFAOYSA-N/connections?direction=outgoing
  2. Each product is a transformation product. Switch to direction=incoming to see which compounds form atrazine instead.

Search by structure

  1. Find compounds that contain a 1,3,5-triazine ring by passing the pattern in smarts.

    GET
    https://fairtps.lcsb.uni.lu/api/v1/search/substructure?smarts=c1ncncn1
  2. To look for several substructures at once, repeat smarts and call the batch endpoint.

    GET
    https://fairtps.lcsb.uni.lu/api/v1/search/substructure/batch?smarts=c1ncncn1&smarts=C%28%3DO%29O

Code examples

The same lookup in three languages: search by name, then fetch the full record of the first result.

curl "https://fairtps.lcsb.uni.lu/api/v1/compounds?q=atrazine&page_size=5"

curl "https://fairtps.lcsb.uni.lu/api/v1/compounds/MXWJVTOOROXGIU-UHFFFAOYSA-N"

# SMARTS patterns contain characters that must be URL encoded
curl -G "https://fairtps.lcsb.uni.lu/api/v1/search/substructure" \
  --data-urlencode "smarts=c1ncncn1" \
  --data-urlencode "page_size=5"

Version and fair use

API version

v1

The version is part of every route, so fields in v1 keep their names and meaning. New fields may be added, and a breaking change would be released as v2.

Responsible use

The API applies request and resource controls so the service stays available for everyone. Substructure, batch and pathway searches do the most work, so avoid repeating identical requests and cache results that rarely change.

Successful responses carry an ETag. Send it back in an If-None-Match header and the API answers 304 Not Modified without a body when nothing has changed. After a 429, wait before retrying and honour Retry-After when it is present.