> This page is for Analytics API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://documentation.babelstreet.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://documentation.babelstreet.com/_mcp/server.

# Finds terms similar to the input

POST https://analytics.babelstreet.com/rest/v1/semantics/similar
Content-Type: application/json

Provides the terms similar to the input.  Returns a mapping of each requested language to a list of terms similar to the input

Reference: https://documentation.babelstreet.com/analytics/text-analytics/semantic-vectors/finds-terms-similar-to-the-input

## Authentication

- `X-BabelStreetAPI-Key` header (required) — API Key authentication via header
- `X-RosetteAPI-Key` header (required) — API Key authentication via header

## Servers

- `https://analytics.babelstreet.com/rest/v1` (https://analytics.babelstreet.com/rest/v1/, default)
- `https://api.rosette.com/rest/v1` (https://api.rosette.com/rest/v1/)

## Request

### Body (application/json)

This endpoint expects a SemanticsSimilarRequest.

- `language` (string, optional) — 3 letter code of language.
- `options` (SemanticsSimilarRequestOptions, optional)

## Response

### 200

OK

- `relationships` (list of SimilarTermsResponse, optional)

## Types

### SemanticsSimilarRequestOptions

- `count` (integer, optional) — how many to return per language
- `embeddingsMode` (enum, optional) — the generation of semantic embeddings to use for all languages; defaults to second generation unless the language only supports first generation embeddings
  - Allowed values: `DEFAULT`, `GEN_1`, `GEN_2`
- `resultLanguages` (list of string, optional) — languages to return similar terms in

### SimilarTermsResponse

- `similarTerms` (SimilarTermsResponseSimilarTerms, optional) — similar terms per language

### SimilarTermsResponseSimilarTerms

similar terms per language

- `language` (string, optional)
- `similarTerms` (list of SimilarTermsResponseSimilarTermsSimilarTermsItems, optional)

### SimilarTermsResponseSimilarTermsSimilarTermsItems

- `term` (string, optional)
- `similarity` (double, optional)

## Examples

### JSON String

**Request**

```json
{
  "options": {
    "resultLanguages": [
      "eng",
      "spa",
      "deu",
      "jpn"
    ]
  },
  "content": "spy"
}
```

**Response**

```json
{
  "relationships": [
    {
      "similarTerms": {
        "language": "string",
        "similarTerms": [
          {
            "term": "string",
            "similarity": 1.1
          }
        ]
      }
    }
  ]
}
```

**SDK Code**

```python JSON String
import requests

url = "https://analytics.babelstreet.com/rest/v1/semantics/similar"

payload = {
    "options": { "resultLanguages": ["eng", "spa", "deu", "jpn"] },
    "content": "spy"
}
headers = {
    "X-BabelStreetAPI-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript JSON String
const url = 'https://analytics.babelstreet.com/rest/v1/semantics/similar';
const options = {
  method: 'POST',
  headers: {'X-BabelStreetAPI-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"options":{"resultLanguages":["eng","spa","deu","jpn"]},"content":"spy"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go JSON String
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.babelstreet.com/rest/v1/semantics/similar"

	payload := strings.NewReader("{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-BabelStreetAPI-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby JSON String
require 'uri'
require 'net/http'

url = URI("https://analytics.babelstreet.com/rest/v1/semantics/similar")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-BabelStreetAPI-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}"

response = http.request(request)
puts response.read_body
```

```java JSON String
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://analytics.babelstreet.com/rest/v1/semantics/similar")
  .header("X-BabelStreetAPI-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}")
  .asString();
```

```php JSON String
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://analytics.babelstreet.com/rest/v1/semantics/similar', [
  'body' => '{
  "options": {
    "resultLanguages": [
      "eng",
      "spa",
      "deu",
      "jpn"
    ]
  },
  "content": "spy"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-BabelStreetAPI-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp JSON String
using RestSharp;

var client = new RestClient("https://analytics.babelstreet.com/rest/v1/semantics/similar");
var request = new RestRequest(Method.POST);
request.AddHeader("X-BabelStreetAPI-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift JSON String
import Foundation

let headers = [
  "X-BabelStreetAPI-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "options": ["resultLanguages": ["eng", "spa", "deu", "jpn"]],
  "content": "spy"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.babelstreet.com/rest/v1/semantics/similar")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### URI

**Request**

```json
{
  "options": {
    "resultLanguages": [
      "eng",
      "spa",
      "deu",
      "jpn"
    ]
  },
  "contentUri": "https://en.wikipedia.org/wiki/Espionage"
}
```

**Response**

```json
{
  "relationships": [
    {
      "similarTerms": {
        "language": "string",
        "similarTerms": [
          {
            "term": "string",
            "similarity": 1.1
          }
        ]
      }
    }
  ]
}
```

**SDK Code**

```python URI
import requests

url = "https://analytics.babelstreet.com/rest/v1/semantics/similar"

payload = {
    "options": { "resultLanguages": ["eng", "spa", "deu", "jpn"] },
    "contentUri": "https://en.wikipedia.org/wiki/Espionage"
}
headers = {
    "X-BabelStreetAPI-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript URI
const url = 'https://analytics.babelstreet.com/rest/v1/semantics/similar';
const options = {
  method: 'POST',
  headers: {'X-BabelStreetAPI-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"options":{"resultLanguages":["eng","spa","deu","jpn"]},"contentUri":"https://en.wikipedia.org/wiki/Espionage"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go URI
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.babelstreet.com/rest/v1/semantics/similar"

	payload := strings.NewReader("{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"contentUri\": \"https://en.wikipedia.org/wiki/Espionage\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-BabelStreetAPI-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby URI
require 'uri'
require 'net/http'

url = URI("https://analytics.babelstreet.com/rest/v1/semantics/similar")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-BabelStreetAPI-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"contentUri\": \"https://en.wikipedia.org/wiki/Espionage\"\n}"

response = http.request(request)
puts response.read_body
```

```java URI
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://analytics.babelstreet.com/rest/v1/semantics/similar")
  .header("X-BabelStreetAPI-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"contentUri\": \"https://en.wikipedia.org/wiki/Espionage\"\n}")
  .asString();
```

```php URI
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://analytics.babelstreet.com/rest/v1/semantics/similar', [
  'body' => '{
  "options": {
    "resultLanguages": [
      "eng",
      "spa",
      "deu",
      "jpn"
    ]
  },
  "contentUri": "https://en.wikipedia.org/wiki/Espionage"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-BabelStreetAPI-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp URI
using RestSharp;

var client = new RestClient("https://analytics.babelstreet.com/rest/v1/semantics/similar");
var request = new RestRequest(Method.POST);
request.AddHeader("X-BabelStreetAPI-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"options\": {\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"contentUri\": \"https://en.wikipedia.org/wiki/Espionage\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift URI
import Foundation

let headers = [
  "X-BabelStreetAPI-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "options": ["resultLanguages": ["eng", "spa", "deu", "jpn"]],
  "contentUri": "https://en.wikipedia.org/wiki/Espionage"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.babelstreet.com/rest/v1/semantics/similar")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Options

**Request**

```json
{
  "language": "eng",
  "options": {
    "count": 4,
    "embeddingsMode": "GEN_1",
    "resultLanguages": [
      "eng",
      "spa",
      "deu",
      "jpn"
    ]
  },
  "content": "spy"
}
```

**Response**

```json
{
  "relationships": [
    {
      "similarTerms": {
        "language": "string",
        "similarTerms": [
          {
            "term": "string",
            "similarity": 1.1
          }
        ]
      }
    }
  ]
}
```

**SDK Code**

```python Options
import requests

url = "https://analytics.babelstreet.com/rest/v1/semantics/similar"

payload = {
    "language": "eng",
    "options": {
        "count": 4,
        "embeddingsMode": "GEN_1",
        "resultLanguages": ["eng", "spa", "deu", "jpn"]
    },
    "content": "spy"
}
headers = {
    "X-BabelStreetAPI-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Options
const url = 'https://analytics.babelstreet.com/rest/v1/semantics/similar';
const options = {
  method: 'POST',
  headers: {'X-BabelStreetAPI-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"language":"eng","options":{"count":4,"embeddingsMode":"GEN_1","resultLanguages":["eng","spa","deu","jpn"]},"content":"spy"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Options
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.babelstreet.com/rest/v1/semantics/similar"

	payload := strings.NewReader("{\n  \"language\": \"eng\",\n  \"options\": {\n    \"count\": 4,\n    \"embeddingsMode\": \"GEN_1\",\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-BabelStreetAPI-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Options
require 'uri'
require 'net/http'

url = URI("https://analytics.babelstreet.com/rest/v1/semantics/similar")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-BabelStreetAPI-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"language\": \"eng\",\n  \"options\": {\n    \"count\": 4,\n    \"embeddingsMode\": \"GEN_1\",\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}"

response = http.request(request)
puts response.read_body
```

```java Options
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://analytics.babelstreet.com/rest/v1/semantics/similar")
  .header("X-BabelStreetAPI-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"language\": \"eng\",\n  \"options\": {\n    \"count\": 4,\n    \"embeddingsMode\": \"GEN_1\",\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}")
  .asString();
```

```php Options
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://analytics.babelstreet.com/rest/v1/semantics/similar', [
  'body' => '{
  "language": "eng",
  "options": {
    "count": 4,
    "embeddingsMode": "GEN_1",
    "resultLanguages": [
      "eng",
      "spa",
      "deu",
      "jpn"
    ]
  },
  "content": "spy"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-BabelStreetAPI-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Options
using RestSharp;

var client = new RestClient("https://analytics.babelstreet.com/rest/v1/semantics/similar");
var request = new RestRequest(Method.POST);
request.AddHeader("X-BabelStreetAPI-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"language\": \"eng\",\n  \"options\": {\n    \"count\": 4,\n    \"embeddingsMode\": \"GEN_1\",\n    \"resultLanguages\": [\n      \"eng\",\n      \"spa\",\n      \"deu\",\n      \"jpn\"\n    ]\n  },\n  \"content\": \"spy\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Options
import Foundation

let headers = [
  "X-BabelStreetAPI-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "language": "eng",
  "options": [
    "count": 4,
    "embeddingsMode": "GEN_1",
    "resultLanguages": ["eng", "spa", "deu", "jpn"]
  ],
  "content": "spy"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.babelstreet.com/rest/v1/semantics/similar")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```