Get similarity score
curl --request GET \
--url https://api.truthlocks.com/v1/consumer/similarity \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.truthlocks.com/v1/consumer/similarity"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/consumer/similarity', 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.truthlocks.com/v1/consumer/similarity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/consumer/similarity"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.truthlocks.com/v1/consumer/similarity")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/consumer/similarity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"scores": [
{
"attestation_id": "<string>",
"similarity": 123,
"match_type": "<string>"
}
]
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Consumer (B2C)
Content similarity check
Check whether a content hash already has existing public protections.
GET
/
v1
/
consumer
/
similarity
Get similarity score
curl --request GET \
--url https://api.truthlocks.com/v1/consumer/similarity \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.truthlocks.com/v1/consumer/similarity"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/consumer/similarity', 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.truthlocks.com/v1/consumer/similarity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/consumer/similarity"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.truthlocks.com/v1/consumer/similarity")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/consumer/similarity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"scores": [
{
"attestation_id": "<string>",
"similarity": 123,
"match_type": "<string>"
}
]
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}GET
Check whether a SHA-256 content hash already has public protections. Use this before protecting content to detect exact duplicates and avoid re-protecting content that someone else has already registered.
Authentication is optional. When you include an API key, your own protections are excluded from the results so you only see matches from other users.
Only protections with /v1/consumer/similarityvisibility: "public" are searched. Private protections are never returned.
Parameters
string
required
SHA-256 hash of the content to check. Must match the hex-encoded hash format used when protecting content.
Responses
Response fields
| Field | Type | Description |
|---|---|---|
content_hash | string | The hash you submitted, echoed back for confirmation. |
exact_match | boolean | true if at least one public protection exists for this hash. |
matches | array | Up to 10 matching protections, ordered by creation date. |
matches[].attestation_id | string | Attestation ID of the matching protection. |
matches[].title | string | Title of the matching protection. |
matches[].category | string | Content category (e.g. photography, code, design). |
matches[].similarity_score | number | Always 1.0 for exact hash matches. |
matches[].protected_at | string | ISO 8601 timestamp when the content was protected. |
matches[].owner_username | string | Public username of the protection owner, if set. |
total | integer | Total number of matches found. |

