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

# Search by InChI

<mark style="color:green;">`POST`</mark> `/inchi`

### Headers

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |

### Body

| Name    | Type    | Description                                                                                                              |
| ------- | ------- | ------------------------------------------------------------------------------------------------------------------------ |
| `InChI` | string  | The International Chemical Identifier (full match only; should include "InChI=" prefix)                                  |
| `limit` | integer | Optional parameter that specifies how many results should be returned. Valid values range from 1 to 100. Defaults to 10. |

### GraphQL schema

{% code overflow="wrap" %}

```graphql
query ByInChI ($inchi: String!, $limit: Int = 10) {
    molecules (InChI: $inchi, limit: $limit) { # Here described fields to include in the response
        CID
        IUPAC
        SMILES
        InChI
        InChIKey
        synonyms
    }
}
```

{% endcode %}

### Response

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

### OK response from API:

{% code overflow="wrap" %}

```json
{
    "molecules": [
        {
            "CID": 39912,
            "IUPAC": "(2S)-2-[4-(2-methylpropyl)phenyl]propanoic acid",
            "SMILES": "C[C@@H](C1=CC=C(C=C1)CC(C)C)C(=O)O",
            "InChI": "InChI=1S/C13H18O2/c1-9(2)8-11-4-6-12(7-5-11)10(3)13(14)15/h4-7,9-10H,8H2,1-3H3,(H,14,15)/t10-/m0/s1",
            "InChIKey": "HEFNNWSXXWATRW-JTQLQIEISA-N",
            "synonyms": [
                "(S)-(+)-Ibuprofen",
                ...
            ]
        },
        ...
    ]
}
```

{% endcode %}
{% endtab %}

{% tab title="400" %}

### When parameters is invalid:

{% code overflow="wrap" %}

```json
{
    "error": {
        "message": "Inputs are invalid or missing",
        "errors": [
            "\"limit\": Value error, Limit value should be in range 1 to 100"
        ]
    }
}
```

{% endcode %}

### When provided InChI is invalid:

```json
{
    "error": {
        "message": "Invalid InChI!"
    }
}
```

{% endtab %}

{% tab title="415" %}

### When payload is not a valid JSON:

```json
{
    "error": {
        "message": "Invalid content type."
    }
}
```

{% endtab %}

{% tab title="500" %}

### When unexpected error occurs:

```json
{
    "error": {
        "message": "Unexpected error occurred"
    }
}
```

{% endtab %}
{% endtabs %}

### **Requests example**

{% tabs %}
{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests

payload = {
    "query": """query ByInChI ($inchi: String!, $limit: Int = 10) {
        molecules (InChI: $inchi, limit: $limit) { 
            CID
            IUPAC
            SMILES
            InChI
            InChIKey
            synonyms
        }
    }""",
    "variables": {"inchi": "InChI=1S/C13H18O2/c1-9(2)8-11-4-6-12(7-5-11)10(3)13(14)15/h4-7,9-10H,8H2,1-3H3,(H,14,15)/t10-/m0/s1"}
}

resp = requests.post(
    url=API_URL,
    json=payload,
)
print(resp.json())
```

{% endcode %}
{% endtab %}
{% endtabs %}
