Find similar documents
Sometimes there's no query to type — you already have the document that matters, and what you want is everything else in your corpus that resembles it. This endpoint takes a reference document instead of a search phrase and returns the other documents in your set that are conceptually closest to it.
Run it online
Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.
A search problem with no natural query
Most search assumes a person typing a few words describing what they want, but a lot of real retrieval needs start from a document, not a phrase: a reader just finished an article and wants more like it, a legal team has one contract and needs every similar agreement in the archive, a support agent has one resolved ticket and wants past tickets matching the same underlying issue. Compressing a whole document into a short query loses most of what makes it distinctive, which is exactly the information this endpoint uses instead of discarding it.
How the matching works
POST a reference document along with the candidate set to compare it against to /search/similar-docs and the task represents the reference document's full content as a point in meaning-space, then measures how close every candidate sits to that point, returning the candidates ranked by closeness. There's no keyword extraction step and no requirement to summarize the reference document into a query first — the whole document is the query, which is what makes the matches reflect its actual substance rather than a handful of terms someone guessed were the important ones.
Item-to-item similarity, an old idea in a new form
This is the document-retrieval cousin of the 'customers who bought this also bought' pattern recommendation systems have used for decades, applied here to text similarity instead of purchase history. What changed is the representation: instead of relying on shared tags or co-occurrence statistics, the comparison happens on meaning captured directly from the content, surfacing genuinely similar material even between documents that share almost no vocabulary.
Where 'more like this' earns its place
Content platforms use it to power related-article and related-product modules without hand-tagging every item; legal and compliance teams use it to find every contract, policy, or filing similar to a given reference document across a large archive; support teams use it to surface prior tickets or resolutions that match a new one in substance, not just shared keywords. In every one of these, the starting point is a document a person already has in hand, not a phrase they'd have to compose.
Pricing and how it's billed
The cost is a small base fee per request plus a per-query charge, published on this page regardless of how many candidates are compared against the reference document. The task runs asynchronously: submit the reference document and candidates, get a task_id right away, and collect the ranked matches by signed webhook or a signed link valid for 24 hours; a failed task retries automatically up to three times and is never charged if it still can't complete.
What you can do with it
Related articles and content recommendations
A publisher shows readers more articles similar to the one they just finished, generated automatically from the article's content rather than manual tagging.
Contract and policy similarity search
A legal team finds every agreement in a large archive that resembles a given reference contract, speeding up due diligence and precedent review.
Support ticket precedent matching
A helpdesk finds prior tickets similar in substance to a new one, surfacing resolutions that solved the same underlying problem even with different wording.
Duplicate and near-duplicate content detection
A content team scans a large document set for entries that closely resemble a known reference file, flagging near-duplicates for review or cleanup.
FAQ
What does a similar documents API do?
It takes a reference document and a candidate set, then returns the candidates ranked by how conceptually similar they are to the reference document, without needing a search query.
Do I need to write a search query to use it?
No, the reference document itself is the input; the endpoint compares its full content against your candidates and ranks them by similarity.
Is the similar documents API free to use?
There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.
How is this different from semantic search?
Semantic search starts from a short text query; similar documents starts from an entire reference document and finds other documents like it, which captures more nuance than a short query typically can.
How do I retrieve the results?
The task returns a task_id immediately and processes asynchronously, with the ranked matches delivered by signed webhook or a signed link valid for 24 hours.
Can it find duplicate or near-duplicate documents?
Yes, ranking candidates by closeness to a reference document naturally surfaces near-duplicates near the top of the results, making it useful for deduplication review.
Can I compare a reference document against a large archive?
Yes, submit the reference document with your full candidate set as a single request; pricing is per request and per query with no artificial cap on candidate set size.
What happens if a similar documents request fails?
The task retries automatically up to three times before returning a clear error, and a failed request is never charged.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/search/similar-docs \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"input":"…"}'const res = await fetch("https://api.kit.forhosting.com/search/similar-docs", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"input": "…"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/search/similar-docs",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"input": "…"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/search/similar-docs", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"input":"…"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"input":"…"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/search/similar-docs", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"input": "…"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "search.similar_docs",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_chunks | 10000 |
max_tokens | 20000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |