Skip to main content
POST
/
v2
/
text-compare
cURL
curl --request POST \
  --url https://api.gowinston.ai/v2/text-compare \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "first_text": "<string>",
  "second_text": "<string>"
}
'
import requests

url = "https://api.gowinston.ai/v2/text-compare"

payload = {
"first_text": "<string>",
"second_text": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({first_text: '<string>', second_text: '<string>'})
};

fetch('https://api.gowinston.ai/v2/text-compare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gowinston.ai/v2/text-compare",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'first_text' => '<string>',
'second_text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.gowinston.ai/v2/text-compare"

payload := strings.NewReader("{\n \"first_text\": \"<string>\",\n \"second_text\": \"<string>\"\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.gowinston.ai/v2/text-compare")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_text\": \"<string>\",\n \"second_text\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.gowinston.ai/v2/text-compare")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_text\": \"<string>\",\n \"second_text\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": 123,
  "similarity_score": 123,
  "first_text": {
    "total_word_count": 123,
    "matching_word_count": 123,
    "similarity_percentage": 123,
    "items": [
      {
        "type": "<string>",
        "word_count": 123,
        "index_start": 123,
        "length": 123
      }
    ]
  },
  "second_text": {
    "total_word_count": 123,
    "matching_word_count": 123,
    "similarity_percentage": 123,
    "items": [
      {
        "type": "<string>",
        "word_count": 123,
        "index_start": 123,
        "length": 123
      }
    ]
  },
  "credits_used": 123,
  "credits_remaining": 123
}
{
"error": "BAD_REQUEST",
"description": "The request was invalid and could not be processed. Make sure you pass valid arguments."
}
{
"error": "UNAUTHORIZED",
"description": "Pass a valid API key in the Authorization header as a Bearer token."
}
{
"error": "PAYMENT_REQUIRED",
"description": "Insufficient credits. Make sure you have enough credits to make the request."
}
{
"error": "FORBIDDEN",
"description": "The request was forbidden. Make sure you pass a valid URL or document that we can access."
}
{
"error": "TOO_MANY_REQUESTS",
"description": "You have exceeded the rate limit. Please try again later."
}
{
"error": "INTERNAL_SERVER_ERROR",
"description": "An unexpected error occurred. Please try again later."
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The text comparison request body

first_text
string
required

The first text to compare. Maximum 120,000 characters.

Maximum string length: 120000
second_text
string
required

The second text to compare against the first text. Maximum 120,000 characters.

Maximum string length: 120000

Response

Text comparison response

status
integer

HTTP status code representing the result of the text comparison request

similarity_score
number

Overall similarity score between the two texts (0-100).

0 means no similarity, 100 means identical.

first_text
object
second_text
object
credits_used
integer

The credits_used field represents the number of credits consumed for processing your request. Each text comparison request consumes the total number of words in both texts divided by 2.

credits_remaining
integer

The credits_remaining field shows how many credits you have left in your account after your request has been processed.