Search API
Auth, request fields, response shape, result limits, errors, and examples.
Browse docs
Use the Search API directly from a website with a Browser/public key, or from a backend with a Server key.
Endpoint
POST https://api.ceisium.com/v1/searchChoose a key type
| Key type | Use it from | Required guardrails |
|---|---|---|
| Browser/public keys | Browser code | Exact allowed website origins, optional allowed result URL prefixes, per-IP and total-key rate limits. |
| Server keys | A trusted backend | Total-key rate limit. Never expose these keys in browser code. |
Use CEISIUM_PUBLIC_SEARCH_KEY for browser integrations and CEISIUM_SEARCH_KEY for server integrations. Both key types are search-only and belong to one project.
Auth
Pass a Search API key as a bearer token.
Authorization: Bearer $CEISIUM_PUBLIC_SEARCH_KEYContent-Type: application/jsonFor a Browser/public key, Ceisium Search checks the browser-supplied Origin against the key’s allowed origins. Origin is required: a missing or disallowed origin returns 403. Enter complete origins such as https://docs.example.com or http://localhost:3000; Ceisium Search also adds the expected scheme when you enter a bare hostname or localhost during key creation. Origins cannot contain paths. If the key has allowed result URL prefixes, a request’s path_prefix must start with one of them. When the key has exactly one prefix, a request without path_prefix uses it.
Local development origins
In Setup → API keys → Generate key, choose Browser/public and turn on Enable localhost origins for local development. The switch is off by default. It allows HTTP and HTTPS on any valid port for localhost, 127.0.0.1, and [::1]. It does not allow localhost subdomains, suffix/lookalike hosts, other IP addresses, opaque (null) origins, other schemes, or URLs with user credentials.
Production website origins remain individually listed under Allowed website origins. A localhost-only key can leave that list empty while the switch is enabled. Explicit origins are still matched exactly, including their scheme and port. Result URL prefixes, project restrictions, billing, and key limits continue to apply. Creating a new draft or switching projects resets the switch to off; existing keys are unchanged. The saved policy is allow_localhost_origins: true, not a wildcard in the origins list.
Origin and path restrictions limit where a public key can be used and what it can return. Keep Server keys private because they do not use browser-origin restrictions.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
project_id | string | yes | The project to search. |
query | string | yes | The visitor search query. |
top_k | number | no | Requested result count. Defaults to 10; must be a whole number from 1 to 50. The response is capped to the key’s configured maximum, which defaults to 20, and effective_top_k in the response shows the allowed count. |
path_prefix | string | no | Limit results to a URL prefix, such as https://nextjs.org/docs/app. This includes the App Router root page and its child paths. The host is case-insensitive, and a bare origin such as https://nextjs.org means its root. |
exclude_no_match | boolean | no | Defaults to false. When true, a search with no_match: true returns no results instead of weak ones. The search still counts toward usage. |
Browser example
const response = await fetch("https://api.ceisium.com/v1/search", { method: "POST", headers: { Authorization: `Bearer ${CEISIUM_PUBLIC_SEARCH_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ project_id: CEISIUM_PROJECT_ID, query: "How do I add typed JSON-LD to a page component?", top_k: 8, path_prefix: "https://nextjs.org/docs/app", }),});Do not manually set Origin; browsers add it to cross-origin requests.
Server example
curl -X POST https://api.ceisium.com/v1/search \ -H "Authorization: Bearer $CEISIUM_SEARCH_KEY" \ -H "Content-Type: application/json" \ -d '{ "project_id": "'$CEISIUM_PROJECT_ID'", "query": "How do I add typed JSON-LD to a page component?", "top_k": 5, "path_prefix": "https://nextjs.org/docs/app" }'Per-minute limits
New Workspace keys start with the following defaults. You can edit these values when creating a key; they are defaults, not subscription limits. Existing keys keep their saved limits.
| Key type | Browser searches per IP | Total searches per key |
|---|---|---|
| Browser/public | 120 per IP per minute | 1,000 total per minute |
| Server | Not applied | 1,000 total per minute |
Browser/public keys apply both limits. Server keys apply only the total-key limit because many visitors may share the server’s outbound IP. Per-minute limits protect against short traffic bursts; the plan’s monthly search allowance is counted separately.
When a request exceeds either applicable per-minute limit, the API returns 429 with a Retry-After header that gives the seconds until the limit window ends. A request whose top_k is higher than the key’s maximum is capped to the key’s configured maximum rather than rejected.
Response
Render title, snippet, and url. snippet is plain text from the page. Ceisium Search leaves out page controls that it recognizes, such as copy buttons and page toolbars. score is a relevance value from 0 to 1: how likely the page is the best answer among the up to 30 candidate pages the reranker compared. That pool can be larger than the reply, so scores in one reply need not add up to 1. Scores never rise down the list, and a low first score suggests that no result is a strong match. If the reranker is unavailable, score comes from simpler text matching and is still between 0 and 1. Do not show score to visitors.
no_match is true when none of the up to 30 candidate pages the reranker compared answers the query. Those are the top results, so with top_k above 30, results after the 30th are not part of this check. The reranker answers this as a separate yes/no question in the same call. true means the query is probably off-topic for your site, for example “what is the capital of france” on a framework’s docs. Use it to show a “No good match” message, or send exclude_no_match: true to get no results in that case. It is null when the reranker did not run, for example when it was unavailable.
A repeated search usually returns the same order. Ceisium Search stores the reranker’s answer for a query and its candidate pages, and uses it again for the same search, which is also faster. A stored answer is kept for up to 7 days, or less when newer searches replace it. After that, or when a crawl changes the candidate pages, the order can change.
Errors
| Status | Meaning |
|---|---|
401 | Missing or invalid API key. |
402 | Billing is inactive, usage data is stale, or a configured usage or spending limit blocks search. |
403 | Project, origin, or result-path access is not allowed for this key. |
404 | Project not found. |
405 | The request did not use POST. |
413 | Request body is too large. |
422 | Invalid JSON body; a missing, empty, or non-string project_id or query; a query of only spaces or over 4,096 UTF-8 bytes; a path_prefix that is not a string or is over 2,048 UTF-8 bytes; a top_k that is not a whole number from 1 to 50; or an exclude_no_match that is not true or false. |
429 | A per-IP or total-key per-minute limit was reached. |
500 | Search backend error. Retry later and check observability. |
API errors are JSON with a detail message. Rare service-level 503 or 410 replies can use an error field or plain text instead, so check response.ok before you parse. All error responses include CORS headers, so browser code can read them.