Endpoint
POST https://requiems.xyz/v1/text/similarity
Compare Text Similarity
Compares two texts and returns a cosine similarity score.
Parameters
| Name | Type | Required | Location | Description |
|---|---|---|---|---|
text1 |
string | yes | body | The first text to compare. |
text2 |
string | yes | body | The second text to compare. |
Request Example
{
"text1": "The cat sat on the mat",
"text2": "A cat was sitting on a mat"
}
Response Example
{
"data": {
"similarity": 0.4364,
"method": "cosine"
},
"metadata": {
"timestamp": "2026-01-01T00:00:00Z"
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
similarity |
number | Cosine similarity score between the two texts, in the range [0, 1]. |
method |
string | The algorithm used. Currently always 'cosine'. |
Errors
422validation_failed — One or both text fields are missing or empty.400bad_request — The request body is missing or malformed.500internal_error — Unexpected server error.