ForHosting KIT · Semantic Search & RAG

Rerank results

Your first-pass search already found the right candidates somewhere in the list — the problem is they're sitting at position eleven instead of position one. This endpoint takes a query and a set of already-retrieved results and reorders them by how well each one actually answers the query, turning a rough shortlist into a precise ranking.

● StablePer request + per query$0.002
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

The gap between retrieval and relevance

Most search systems, including keyword indexes and even vector search, are built for recall: cast a wide net, pull in everything plausibly related, and accept that the ordering within that net is approximate. That's a reasonable tradeoff when retrieving from millions of candidates cheaply matters more than perfect ordering, but it leaves a gap — the top result and the eleventh might both be relevant, yet only one truly answers what was asked. Reranking closes that gap without touching how the initial candidates were found.

What the endpoint does with your shortlist

POST a query along with an already-narrowed set of candidate documents to /search/rerank and the task evaluates each candidate directly against the query, scoring relevance more precisely than the original retrieval step could afford to, then returns the same set reordered by that finer-grained score. Nothing is added or removed from your list — the endpoint's whole job is putting the right entries near the top, which is exactly the step a first-pass retrieval system is usually too coarse to get right on its own.

A second, cheaper pass by design

The two-stage pattern — retrieve broadly, then rerank precisely — exists because evaluating every document in a large corpus with the highest precision would be prohibitively slow at scale; a fast first pass shrinks millions of candidates to a few dozen or a few hundred, and a careful second pass spends its attention budget where it matters. This is the same division of labor search engines and recommendation systems have relied on for years, adapted here into a single callable step you drop after any retrieval method you already use.

Where reranking earns its keep

It's the natural finishing step after keyword search, semantic search, or hybrid search when the top few results matter more than the rest of the list, and it's a core building block in RAG pipelines where only the top handful of passages actually get passed to a downstream model, so getting that short list exactly right has an outsized effect on answer quality. It also helps recommendation and content-matching systems where a rough candidate set exists but the final order shown to a user needs to be tight.

Pricing and how results arrive

The endpoint bills a small base fee per request plus a per-query charge, published here with no extra cost tied to how many candidates are in your list. It runs asynchronously: submit the query and candidates, get a task_id immediately, and retrieve the reordered results 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.

Sharpening the top of search results

A site reranks the top fifty results from its existing search index so the three or four most genuinely relevant items land at the very top instead of buried mid-list.

Final relevance pass in a RAG pipeline

An assistant reranks a broad set of retrieved passages down to the handful actually worth feeding into the model, improving answer grounding without changing the retrieval step.

Recommendation list refinement

A content platform reranks a candidate set of similar articles or products by relevance to a specific query or session before displaying the final list to a user.

Cross-source result consolidation

A team merges results pulled from several different search systems and reranks the combined set by relevance to produce one coherent, prioritized list.

What does a reranking API actually do?

It takes a query and a set of already-retrieved candidate results and reorders them by how relevant each one truly is to the query, without adding or removing any candidates.

Do I need to run my own search or retrieval step first?

Yes, reranking works on a candidate set you've already retrieved by keyword search, semantic search, or any other method; it's a refinement step, not a standalone retrieval system.

Is the reranking 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 reranking different from semantic search?

Semantic search finds candidates from a large corpus by meaning; reranking takes an existing, already-narrowed set of candidates and reorders it by more precise relevance to the query.

How many candidates can I send to be reranked?

Send the shortlist you've already narrowed down through retrieval; pricing scales per request and per query rather than an artificial candidate cap, though reranking is designed for a focused shortlist, not an entire corpus.

How do I get the reranked results back?

The task returns a task_id immediately and processes asynchronously, with the reordered list delivered by signed webhook or a signed link valid for 24 hours.

Why not just rely on my original search ranking?

Initial retrieval is typically optimized for speed and recall across a huge candidate pool, which leaves ordering approximate; reranking spends more precision exactly where it matters, on the shortlist that will actually be shown or used.

What happens if a reranking request fails?

The task retries automatically up to three times before returning a clear error, and a failed request is never charged.

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.

POSThttps://api.kit.forhosting.com/search/rerank

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.

curl -X POST https://api.kit.forhosting.com/search/rerank \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"…"}'
{
  "input": "…"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "search.rerank",
  "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.

Per request$0.002
Per query$0.0015

Published price — no tokens, no invented credits. A failed task is never charged.

max_chunks10000
max_tokens20000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →