Everything you need to integrate TomsIndex into your application.
All API requests require an API key passed via the X-API-Key header.
To get a key:
curl 'https://api.tomsindex.dev/search?q=example' \ -H 'X-API-Key: srch_...'
Search the index using lexical matching with optional embedding rerank.
| Param | Type | Description |
|---|---|---|
q | string | Required. Search query. |
limit | integer | Max results (1-20, default 10). |
curl 'http://localhost:3000/search?q=bedrock+data+protection&limit=5' \ -H 'X-API-Key: srch_...'
{
"source": "local",
"results": [
{
"result_id": "uuid",
"link": "https://example.com/page",
"title": "Page Title",
"snippet": "Matched chunk content...",
"summary": "Display summary",
"verified": true,
"confidence": 0.82
}
],
"meta": {
"query": "bedrock data protection",
"took_ms": 42,
"top_confidence": 0.82
}
}
Use TomsIndex as a web_search tool in any LLM framework — LiteLLM, OpenRouter, LangChain, or raw OpenAI function calling.
| Field | Type | Description |
|---|---|---|
query | string | Required. Search query. |
limit | integer | Max results (1-20, default 5). |
feedback | array | Optional. Feedback on previous results: [{"result_id":"...","vote":1}]. Vote is 1 (useful) or -1 (not useful). |
curl -X POST 'http://localhost:3000/v1/tools/web_search' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: srch_...' \
-d '{"query":"aws lambda pricing","feedback":[{"result_id":"prev-uuid","vote":1}]}'
{
"results": [
{
"result_id": "uuid",
"title": "AWS Lambda Pricing",
"url": "https://aws.amazon.com/lambda/pricing/",
"snippet": "With AWS Lambda, you pay only for what you use..."
}
]
}
Each result includes a result_id you can pass back in the feedback array on your next search to improve future ranking.
Register this as a tool so the LLM can call it directly:
{
"type": "function",
"function": {
"name": "web_search",
"description": "Search the web using TomsIndex",
"parameters": {
"type": "object",
"properties": {
"query": { "type": "string" },
"limit": { "type": "number" }
},
"required": ["query"]
}
}
}
Point the tool handler at your TomsIndex instance:
import requests
def web_search(query, limit=5):
r = requests.post(
"https://your-instance.com/v1/tools/web_search",
headers={"X-API-Key": "srch_...", "Content-Type": "application/json"},
json={"query": query, "limit": limit},
)
return r.json()["results"]
TomsIndex ships with a built-in Model Context Protocol server. Use it with Claude, Cursor, Windsurf, or any MCP-compatible client.
Add to ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"tomsindex": {
"command": "node",
"args": ["/path/to/mcp/tomsindex-mcp.js"],
"env": {
"TOMSINDEX_URL": "https://your-instance.com",
"TOMSINDEX_API_KEY": "srch_..."
}
}
}
}
Add to .cursor/mcp.json or .windsurf/mcp.json:
{
"mcpServers": {
"tomsindex": {
"command": "node",
"args": ["./mcp/tomsindex-mcp.js"],
"env": {
"TOMSINDEX_URL": "https://your-instance.com",
"TOMSINDEX_API_KEY": "srch_..."
}
}
}
}
TOMSINDEX_URL=http://localhost:3000 node mcp/tomsindex-mcp.js
The MCP server exposes a single web_search tool. The LLM calls it automatically when it needs to search the web.
Submit a URL to be indexed. The page is queued for the worker to fetch and index.
| Field | Type | Description |
|---|---|---|
url | string | Required. Page URL to index. |
summary | string | Required. Short description of the page. |
curl -X POST 'http://localhost:3000/submit' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: srch_...' \
-d '{"url":"https://example.com","summary":"Example page."}'
{
"submission_id": "uuid",
"result_id": "uuid",
"job_id": "uuid",
"url": "https://example.com/",
"status": "queued"
}
Provide relevance feedback on a search result to improve future ranking.
| Field | Type | Description |
|---|---|---|
result_id | string | Required. The result UUID from search. |
query | string | Required. The original search query. |
vote | integer | Required. 1 (upvote) or -1 (downvote). |
curl -X POST 'http://localhost:3000/feedback' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: srch_...' \
-d '{"result_id":"uuid","query":"example","vote":1}'
Post and read comments on indexed URLs. Comments support star ratings and Reddit-style voting.
| Field | Type | Description |
|---|---|---|
url_id | string | Required. UUID of the URL to comment on. |
rating | integer | Required. Star rating, 1-5. |
body | string | Required. Comment text, 1-2000 characters. |
curl -X POST 'http://localhost:3000/comments' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: srch_...' \
-d '{"url_id":"uuid","rating":4,"body":"Great resource for learning async/await."}'
| Param | Type | Description |
|---|---|---|
limit | integer | Max comments (1-50, default 10). |
offset | integer | Pagination offset (default 0). |
sort | string | best (default) or newest. |
Public endpoint — no API key required.
| Field | Type | Description |
|---|---|---|
vote | integer | Required. 1 (upvote) or -1 (downvote). |
Add include_comments=true to your search query to get the top 3 comments per result:
GET /search?q=example&include_comments=true
Each result will include comments, comment_count, and avg_rating fields.
Verification increases a URL's ranking confidence. You can request verification:
All errors return JSON with an error field:
{ "error": "Description of what went wrong." }
| Status | Meaning |
|---|---|
400 | Bad request (missing or invalid parameters) |
401 | Missing or invalid API key |
404 | Resource not found |
429 | Rate limit or submission limit exceeded |
500 | Internal server error |
| Endpoint | Limit |
|---|---|
GET /search | 10,000 req/min (free) or 100,000 req/min (social tier) |
POST /v1/tools/web_search | 10,000 req/min (free) or 100,000 req/min (social tier) |
POST /submit | 60 requests/minute per key |
POST /feedback | 60 requests/minute per key |
POST /comments | 5/sec burst + 20/day per account |
POST /comments/:id/vote | 5/sec burst + 20/hour per account |
GET /comments/:url_id | 10 per second per IP |
POST /social-share | 60 requests/minute per key |
Upgrade your limit: Share TomsIndex on social media and submit the post URL via POST /social-share to get 10x rate limits.
Social Share
Share TomsIndex on social media to upgrade your rate limit from 10,000 to 100,000 requests/minute.
Request Body (JSON)
platformlinkedin,reddit,facebook,twitter,x,other.post_urlHow it works