The Embeddings API encodes any text into a vector using state-of-the-art NLP machine learning models. It can be used to power semantic search, text comparison tools (also check out our Text Similarity API), recommendation engines, and much more.
https://api.api-ninjas.com/v1/embeddings
Returns a 768-dimensional vector as an array that encodes the meaning of any given input text.
text
requiredQuery text to embed. Maximum 5000 characters.
X-Api-Key
requiredAPI Key associated with your account.
https://api.api-ninjas.com/v1/embeddings
Headers
X-Api-Key
Log in or sign up to get your API Key
1
2
3
4
5
6
7
8
9
10
11
{
"embeddings": [
0.013939207419753075,
-0.07620275765657425,
-0.014649288728833199,
-0.00781314168125391,
-0.0740455836057663,
0.03170469030737877,
...
]
}
1
2
3
4
curl -X POST "https://api.api-ninjas.com/v1/embeddings" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "This is an example sentence."}'
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.