Quickstart
Index three documents and run your first ranked search in about five minutes.
Insight is hosted search for help centres, product catalogues and internal docs. You send it documents, it builds a ranked index, and every query returns hits with a relevance score you can read and tune.
- Refund a card payment0.92
- Partial refunds and card fees0.81
- Why a payment shows as pending0.64
search by Insight · 14 ms
Integration effort
- Complexity
- Low
- Time
- About 5 minutes
- Languages
- TypeScript, Python, Go, Ruby
- Runs on
- Your server
- Free tier
- 10,000 documents
Call Insight from your backend with a typed client. Recommended for most apps; this guide follows it.
Call the HTTPS endpoints directly from any language. Every sample below has a curl tab.
Drop a prebuilt search box into your site with one script tag. No backend code, less control over ranking.
Before you begin #
- An Insight account. The free tier covers 10,000 documents and 50,000 searches a month.
- Node.js 20 or Python 3.10 on the machine that will call the API.
- A test key. You're signed in, so your test key is already filled into the samples below.
Build the integration #
Install the SDK
The client is a single dependency with no native modules.
$ npm install @insight/sdk$ pnpm add @insight/sdk$ pip install insight-searchSet your API key
Keep the secret key in your server environment. The SDK reads it on start-up.
INSIGHT_API_KEY=ins_test_7vKe2Rq9Lm3Q8Test key Filled in for maya@northwind.example · test mode
Never ship a secret key to the browser. For search-as-you-type, mint a short-lived public token on your server with
insight.tokens.create()and send that instead.Index documents
Upsert three help-centre articles. Indexing is idempotent on
id, so you can run this twice.await insight.documents.upsert('help-center', [ { id: 'refund-card', title: 'Refund a card payment', body }, { id: 'partial-refunds', title: 'Partial refunds and card fees', body }, { id: 'pending', title: 'Why a payment shows as pending', body },])// → { indexed: 3, took_ms: 212 }
Run a search
Query the index. The numbered markers explain the three lines that matter.
import { Insight } from '@insight/sdk' const insight = new Insight(process.env.INSIGHT_API_KEY)1 const res = await insight.search({ index: 'help-center',2 query: 'refund a card payment', limit: 3,})res.hits[0].score // 0.923
from insight import Insight insight = Insight(os.environ["INSIGHT_API_KEY"])1 res = insight.search( index="help-center",2 query="refund a card payment", limit=3,)res.hits[0].score # 0.923
curl https://api.insight.example/v1/search \ -H "Authorization: Bearer $INSIGHT_API_KEY" \1 -d index=help-center \2 -d query="refund a card payment" \ -d limit=3 # → { "hits": [{ "score": 0.92, … }] }3
- 1The key never leaves the server. The client reads it from the environment and sends it as
Authorization: Bearer. - 2The index must belong to the key's project. Another project's index returns
403, not an empty result. - 3Hits are ranked. Each carries a score from 0 to 1; see Ranking and filters.
200 OK · query "refund a card payment"3 of 128 hits · 14 ms - Refund a card paymenthelp-center/payments/refund-card-payment0.92
- Partial refunds and card feeshelp-center/billing/partial-refunds0.81
- Why a payment shows as pendinghelp-center/payments/pending0.64
- 1The key never leaves the server. The client reads it from the environment and sends it as
Search parameters #
The full list lives in the Search reference. These are the ones most integrations set.
The index to search. It must belong to the same project as the key.
Natural-language or keyword query, up to 512 characters.
Number of hits to return, from 1 to 100.
Restrict hits by metadata before they are ranked.
Show child parameters
- filter.collectionstring
Only documents from this collection, for example payments.
- filter.updated_aftertimestamp
Only documents changed after this Unix time.
- filter.localestring
An IETF tag such as en-GB. Hits in other locales are dropped.
Re-score the top 50 candidates with the cross-encoder. Adds about 20 ms.
Test mode is free and isolated. Indexes you build with a ins_test_ key never mix with live data and are not billed. Switch to a live key when you deploy.
Handle errors #
| Status | Code | What to do |
|---|---|---|
| 200 | ok | Ranked hits are in data.hits. Cache by query for up to 60 s. |
| 400 | invalid_parameter | The message names the field. Fix it and retry. |
| 401 | invalid_api_key | Check the header and that the key is active. |
| 403 | index_forbidden | Use the key of the project that owns the index. |
| 429 | rate_limited | Back off until the Retry-After header has passed. |


