---
title: POST /v1/sync/similarity
description: "Compare two molecules — Computes Tanimoto, Dice and cosine similarity between two SMILES strings using Morgan, RDKit or MACCS fingerprints."
full: true
---

**Auth:** required. Send an `ivy_` API key (`Authorization: Bearer ivy_…`), a signed-in session token (`Authorization: Bearer …`) or the session cookie (browser sessions). See [Authentication](/docs/api/authentication).

Computes Tanimoto, Dice and cosine similarity between two SMILES strings using Morgan, RDKit or MACCS fingerprints. Scores run from 0 (different) to 1 (identical). An invalid SMILES returns HTTP 200 with `success: false`.

## Request

### Request body

- `smiles1` (string) —

- `smiles2` (string) —

- `fingerprint_type` (enum (&quot;morgan&quot; | &quot;rdkit&quot; | &quot;maccs&quot;)) —

- `radius` (integer) —
Morgan fingerprint radius.

## Responses

### `200` OK

The calculation result. Check `success`: a failed calculation still returns HTTP 200.

Response shape:

- `success` (boolean) —

- `data` (object) —
Calculation output. For `validate-smiles`: `results` (each with `input`, `valid`, `canonical`, `num_atoms`, `num_heavy_atoms` or `error`) and `total`. For `similarity`: `smiles1`, `smiles2`, `fingerprint_type`, `tanimoto`, `dice` and `cosine`. For `admet-quick`: `smiles` plus the ADMET estimates. For `molecular-properties`: the property fields, plus `admet` when requested.

- `error` (string) —
Present when `success` is false.

- `calculation_time_ms` (number) —

### `400` Bad Request

Invalid request

Response shape: `object`

### `401` Unauthorized

Authentication required

Response shape: `object`

### `422` Unprocessable Entity

The request body failed validation; the body says which field

Response shape: `object`

### `429` Too Many Requests

Rate limit exceeded

Response shape: `object`

### `502` Bad Gateway

The compute service is unavailable. Retry with backoff.

Response shape: `object`

**curl**

```bash
curl -X POST 'https://ivybiosciences.com/api/v1/sync/similarity' \
  -H "Authorization: Bearer $IVY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "smiles1": "",
  "smiles2": ""
}'
```

**JavaScript**

```js
const res = await fetch('https://ivybiosciences.com/api/v1/sync/similarity', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.IVY_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "smiles1": "",
  "smiles2": ""
}),
});
const data = await res.json();
```

**Python**

```python
import os, requests

res = requests.post(
    "https://ivybiosciences.com/api/v1/sync/similarity",
    headers={"Authorization": f"Bearer {os.environ['IVY_API_KEY']}"},
    json={
  "smiles1": "",
  "smiles2": ""
},
)
data = res.json()
```
