Search API documentation.

Everything you need to add instant search to your app or AI agent. Pick your integration path below.

MCP Server for AI Agents

Connect Claude, Cursor, Windsurf, or any MCP client to Sprigr in one config block. Your agent gets 20 tools for search, storage, index management, and access control.

Install

npx -y @sprigr/mcp-server

Configuration

Add to your MCP client config (Claude Desktop, Cursor, etc.):

claude_desktop_config.json
{
  "mcpServers": {
    "sprigr": {
      "command": "npx",
      "args": ["-y", "@sprigr/mcp-server"],
      "env": {
        "SPRIGR_API_KEY": "your-api-key"
      }
    }
  }
}

Environment variables

SPRIGR_API_KEY  - Required. Sign up at platform.sprigr.com to get one.
SPRIGR_API_BASE - Optional. Defaults to https://search.sprigr.com

Available tools (20)

signuplist_indexescreate_indexupdate_settingsimport_objectssmart_importsearchmulti_searchget_objectexport_objectsget_statsdelete_objectsdelete_indexclear_indexset_aliasdelete_aliaslist_aliasescreate_api_keycreate_secured_keylist_api_keys

How it works

The MCP server runs locally on your machine via npx. Keyword searches execute locally (~5ms) through an embedded WebAssembly engine, against a binary index that auto-downloads from the server. Semantic and exact-match queries route to the nearest edge node. Writes go to the cloud API and the local index refreshes automatically on the next search. No server to host, no ports to open.

Smart import for agent memory

The smart_import tool deduplicates before writing. Each new record is compared against existing ones by meaning: duplicates merge, stale facts are superseded with history preserved, and genuinely new records insert. Pass dry_run to preview the decision without persisting.

REST API

Use the REST API directly from any language. Algolia-compatible endpoints for indexing, search, and management.

Base URL

https://search.sprigr.com

Authentication

Include your API key in the request header:

X-Sprigr-API-Key: your-api-key

API keys support three permission levels (admin, write, search) and optional index-level ACLs. Restrict a key to specific indexes by setting allowed_indexes when creating the key, using exact names or trailing-* prefix patterns. For per-user row-level access, mint scoped keys.

Create an index

PUT /1/indexes/products/settings
Content-Type: application/json

{
  "searchable_attributes": ["title", "description"],
  "attributes_for_faceting": ["category", "brand"]
}

Import objects

POST /1/indexes/products/batch
Content-Type: application/json

{
  "products": [
    {
      "objectID": "prod-1",
      "title": "Ergonomic Keyboard",
      "description": "Split mechanical keyboard",
      "category": "Tech",
      "price": 149.99
    }
  ]
}

Search

POST /1/indexes/products/query
Content-Type: application/json

{
  "query": "keyboard",
  "filters": "category:Tech",
  "hits_per_page": 10,
  "page": 0
}

All endpoints

  • GET/1/indexesList indexes
  • PUT/1/indexes/{index}/settingsCreate/update settings
  • GET/1/indexes/{index}/settingsGet settings
  • POST/1/indexes/{index}/batchImport objects
  • POST/1/indexes/{index}/{id}/partialPartial update
  • GET/1/indexes/{index}/task/{taskID}Async import status
  • POST/1/indexes/{index}/querySearch
  • POST/1/indexes/*/queriesMulti-index search
  • GET/1/indexes/{index}/objects/{id}Get object
  • GET/1/indexes/{index}/objectsExport all objects
  • POST/1/indexes/{index}/deleteObjectsDelete objects
  • POST/1/indexes/{index}/clearClear index
  • DEL/1/indexes/{index}Delete index
  • PUT/1/aliases/{alias}Set alias
  • DEL/1/aliases/{alias}Delete alias
  • GET/1/aliasesList aliases
  • GET/1/statsAccount stats
  • POST/1/embedGenerate embedding
  • POST/1/eventsClick & conversion events
  • POST/1/keys/securedMint scoped search key
  • POST/admin/keysCreate API key
  • GET/admin/keysList API keys (masked)
  • DEL/admin/keys/id/{keyID}Revoke API key

Data modeling tips

Searchable types

Strings, arrays of strings, numbers, and booleans are all indexed for full-text search. Nested objects are not. If you store {"tags": ["red", "blue"]}, searching for "red" will match.

Multi-value facets

Arrays work as multi-value facets. If tags is a faceting attribute and an object has "tags": ["red", "large"], filtering by tags:red or tags:large will both match.

Semantic search with _keywords

Include a _keywords string field with comma-separated tags, synonyms, and related concepts. This makes objects findable by meaning, not just exact text. AI agents should generate these automatically at import time.

{
  "objectID": "prod-1",
  "title": "Ergonomic Laptop Stand",
  "description": "Adjustable aluminum stand",
  "_keywords": "desk accessory, workstation, posture,
               home office, monitor riser, portable"
}

Always include _keywords in your searchable_attributes:

"searchable_attributes": ["title", "description", "_keywords"]

Query features

Aggregations

Compute sum, avg, min, max, and count over every matching record, with optional group_by bucketing. Aggregations run server-side over the full result set, not just the returned page.

POST /1/indexes/orders/query
Content-Type: application/json

{
  "query": "",
  "filters": "status:paid",
  "aggregations": [
    { "name": "revenue_by_region", "op": "sum",
      "field": "amount", "group_by": "region" }
  ]
}

Sorting and facet counts

Pass sort_by to order results by any attribute instead of relevance. List attributes in facets to get value counts computed across all matching records. Use attributes_to_retrieve to trim response size.

Typo tolerance and match mode

Fuzzy matching is on by default: words of 4 or more characters allow one typo, 8 or more allow two, tunable per index via typo_settings. Set match_mode to Exact for precision over recall, per index or per query.

Synonyms and facet canonicalization

Define synonyms in index settings to expand queries. facet_normalization (lowercase, trim) and facet_synonyms fold messy variants like NSW and new south wales into one canonical facet value for both filters and counts. Common English stop words are removed by default; set remove_stop_words: false to keep them.

Async imports and task tracking

Batch imports are made durable, then acknowledged with 202 and a taskID. Poll GET /1/indexes/{index}/task/{taskID} to see when the write is visible in search, or pass ?sync=true to wait for it inline.

Partial updates

POST /1/indexes/{index}/{objectID}/partial merges fields into an existing object without resending the full record. Batch imports accept action: "partialUpdateObject" for the same semantics in bulk.

Zero-downtime reindex with aliases

Point your app at an alias, build a replacement index in the background, then flip the alias to the new index in one call. Searches never see a half-built index.

API keys, ACLs, and scoped keys

Permission levels

Every key is admin, write, or search. Admin keys manage indexes and keys, write keys import and delete data, search keys only query. Create and revoke keys from the dashboard or the /admin/keys endpoints. Key listings return masked previews and revocation works by key id, so full key values never travel in URLs.

Index ACLs

Restrict any key to specific indexes with allowed_indexes: exact names or trailing-* prefix patterns like acme-*. A key with no ACL sees every index in the account. ACLs are alias-aware and enforced on both reads and writes.

Scoped keys: row-level access control

For multi-user apps and AI agents, mint a secured key from a search key. The secured key carries a locked filter that the engine ANDs into every query, on both the keyword and semantic paths. The holder can narrow results further but can never remove or widen the filter.

REST API - mint a scoped key
POST /1/keys/secured
X-Sprigr-API-Key: your-search-key

{
  "filters": "acl_principals:user:alice@corp.com
              OR acl_principals:public",
  "restrictIndices": ["docs"],
  "validUntil": 1893456000
}

The response contains a securedApiKey (sk_...) used exactly like any key. Scoped keys are stateless, signed by the parent key, so there is nothing to store or sync: revoke them by rotating the parent key or by letting validUntil (Unix seconds) expire. An optional userToken attributes analytics to the end user.

Scoped keys are search-only. Direct object reads, exports, and writes are refused, and rows that lack the filtered attribute never match, so access fails closed. Filter values may contain colons, which makes principal-style values like acl_principals:user:alice@corp.com work as row-level grants.

Ready to get started?

Free for up to 1,000 objects. No credit card required.