TomsIndex

API Documentation

Everything you need to integrate TomsIndex into your application.

Authentication

All API requests require an API key passed via the X-API-Key header.

To get a key:

  1. Create an account (email/password or Google)
  2. Go to your Dashboard
  3. Create an API key under the "API Keys" tab
curl 'https://api.tomsindex.dev/search?q=example' \
  -H 'X-API-Key: srch_...'

Tool Integration

Use TomsIndex as a web_search tool in any LLM framework — LiteLLM, OpenRouter, LangChain, or raw OpenAI function calling.

POST /v1/tools/web_search

Request Body (JSON)

FieldTypeDescription
querystringRequired. Search query.
limitintegerMax results (1-20, default 5).
feedbackarrayOptional. Feedback on previous results: [{"result_id":"...","vote":1}]. Vote is 1 (useful) or -1 (not useful).

Example Request

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}]}'

Response

{
  "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.

OpenAI Function Definition

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"]
    }
  }
}

LiteLLM / OpenRouter

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"]

MCP Server

TomsIndex ships with a built-in Model Context Protocol server. Use it with Claude, Cursor, Windsurf, or any MCP-compatible client.

MCP — web_search tool

Claude Desktop

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_..."
      }
    }
  }
}

Cursor / Windsurf

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_..."
      }
    }
  }
}

Test Locally

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

Submit a URL to be indexed. The page is queued for the worker to fetch and index.

POST /submit

Request Body (JSON)

FieldTypeDescription
urlstringRequired. Page URL to index.
summarystringRequired. Short description of the page.

Example Request

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."}'

Response

{
  "submission_id": "uuid",
  "result_id": "uuid",
  "job_id": "uuid",
  "url": "https://example.com/",
  "status": "queued"
}

Limits

  • 20 submissions per day per account
  • 3 unverified submissions per URL per account

Feedback

Provide relevance feedback on a search result to improve future ranking.

POST /feedback

Request Body (JSON)

FieldTypeDescription
result_idstringRequired. The result UUID from search.
querystringRequired. The original search query.
voteintegerRequired. 1 (upvote) or -1 (downvote).

Example Request

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}'

Comments

Post and read comments on indexed URLs. Comments support star ratings and Reddit-style voting.

POST /comments

Request Body (JSON)

FieldTypeDescription
url_idstringRequired. UUID of the URL to comment on.
ratingintegerRequired. Star rating, 1-5.
bodystringRequired. Comment text, 1-2000 characters.

Example

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."}'

Notes

  • One comment per account per URL (posting again updates your existing comment)
  • 5 requests/second burst limit
  • 20 comments per day per account
GET /comments/:url_id

Query Parameters

ParamTypeDescription
limitintegerMax comments (1-50, default 10).
offsetintegerPagination offset (default 0).
sortstringbest (default) or newest.

Public endpoint — no API key required.

POST /comments/:id/vote

Request Body (JSON)

FieldTypeDescription
voteintegerRequired. 1 (upvote) or -1 (downvote).

Notes

  • One vote per account per comment (voting again changes your vote)
  • Cannot vote on your own comment
  • 5 requests/second burst limit
  • 20 votes per hour per account

Include comments in search results

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.

Social Share

Share TomsIndex on social media to upgrade your rate limit from 10,000 to 100,000 requests/minute.

POST /social-share

Request Body (JSON)

FieldTypeDescription
platformstringRequired. One of: linkedin, reddit, facebook, twitter, x, other.
post_urlstringRequired. URL of your social media post.

How it works

  1. Post about TomsIndex on LinkedIn, Reddit, Facebook, or Twitter/X
  2. Copy the post URL
  3. Submit it via this endpoint
  4. An admin will verify and upgrade your account

Verification

Verification increases a URL's ranking confidence. You can request verification:

  • Web form: visit /verify
  • Tiers: Free, $20 Standard, $100 Expedited
  • Verification is manually reviewed by an admin

Errors

All errors return JSON with an error field:

{ "error": "Description of what went wrong." }
StatusMeaning
400Bad request (missing or invalid parameters)
401Missing or invalid API key
404Resource not found
429Rate limit or submission limit exceeded
500Internal server error

Rate Limits

EndpointLimit
GET /search10,000 req/min (free) or 100,000 req/min (social tier)
POST /v1/tools/web_search10,000 req/min (free) or 100,000 req/min (social tier)
POST /submit60 requests/minute per key
POST /feedback60 requests/minute per key
POST /comments5/sec burst + 20/day per account
POST /comments/:id/vote5/sec burst + 20/hour per account
GET /comments/:url_id10 per second per IP
POST /social-share60 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.