> For the complete documentation index, see [llms.txt](https://chembl.gitbook.io/unichem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chembl.gitbook.io/unichem/api/compound-search.md).

# Compound Search

UniChem efficiently produces cross-references between chemical structure identifiers from different databases. The services to access this information programatically can be found on `/unichem/api/v1/compounds` using a POST method and query information in the payload.&#x20;

{% code title="Query payload example" %}

```json
{
    "type":"inchikey",
    "compound":"LMXNVOREDXZICN-WDSOQIARSA-N"
}
```

{% endcode %}

#### Accepted parameters

* **type:** The kind of compound representation for the molecule to search.&#x20;
* **compound:** Compound representation to search. Must be the kind specified in the **type** parameter. Ignored when **type** is *sourceID*.
* **sourceID:** Unique identifier from the source database. It will only be consider when the type of search is *sourceID.*&#x20;

#### type

Kind of compound representation for the molecule to search. A compound can be searched by a given InChI, InChI Key, source compound ID or a Unique Compound ID (UCI). Can be configure using the following strings:

* uci
* inchi
* inchikey
* sourceID

#### Compound

The machine readable representation for the compound to search, ignored when using **type** *sourceID***.**

#### **sourceID**

Unique ID on the source database when using **type** *sourceID***.**&#x20;

### Simple usage example

{% tabs %}
{% tab title="Curl" %}

```shell
curl --request POST \
  --url https://www.ebi.ac.uk/unichem/api/v1/compounds \
  --header 'Content-Type: application/json' \
  --data '{
	"type":"inchikey",
	"compound":"LMXNVOREDXZICN-WDSOQIARSA-N"
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://www.ebi.ac.uk/unichem/api/v1/compounds"

payload = {
    "type": "inchikey",
    "compound": "LMXNVOREDXZICN-WDSOQIARSA-N"
}
headers = {"Content-Type": "application/json"}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

{% endtab %}
{% endtabs %}

### Response

We have greatly simplify the response payload making easier to parse and read, as well as eliminating redundant information making it lighter.

A list of compounds will be included with the response, a compound will have information about its unique identifier inside UniChEM's database, its InChI representation, standard InChI key and a list of sources where that compound can be found.&#x20;

#### Sources

Each source record contains the Unique ID in the source database, the short and long name of the source database,  the URL to the source database website where the compound information can be found, and the unique ID of the source in UniChEM's database.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://chembl.gitbook.io/unichem/api/compound-search.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
