For AI agents: this page is also available as Markdown at /docs/api-reference.md. Every docs page is: add .md to its URL. llms.txt lists them all.
REST API reference
The WarpSearch API lives under /v1 at https://api.warpsearch.io. Its complete, machine-readable description is the OpenAPI 3.1 document. Fetching it needs no API key, so code generators and agents can read it directly. The API also serves it, with a key, at /v1/openapi.yaml.
There are two kinds of route. Query routes put the verb first and take the collection, or a comma-separated list of collections, as an optional path segment: /v1/search, /v1/count, /v1/graph/.... Management routes live under /v1/collections/{collection} and act on one collection, its schema and its documents.
#Authentication
Every request needs an API key (ws_...). Send it in any of these forms:
| Form | Example |
|---|---|
| Bearer token | Authorization: Bearer ws_... |
| Key header | X-API-Key: ws_... |
| ApiKey scheme | Authorization: ApiKey ws_... |
| HTTP Basic | username apikey (or empty), key as the password |
Elasticsearch clients can also send their base64 id:secret form. Roles are viewer, writer, editor and admin, and a key sees only the collections it holds a role on. Error messages and the MCP server use the permission names read, write, manage and admin. See Access control. GET /v1/auth/me shows who you are and what you may do.
#Query routes
The role column names the lowest organization role that may call the route, on every collection the request touches.
| Method and path | Role | Purpose |
|---|---|---|
POST /v1/search/{collections} | viewer | Search one collection, or a comma-separated list, in any language. See Searching. |
POST /v1/search | viewer | The same, for a query that names its own collections: FROM in sql, pgsql and ppl. |
POST /v1/count[/{collections}] | viewer | Count matching documents. Same body as a search; paging, facets and metrics are ignored. |
POST /v1/graph/expand[/{collection}] | viewer | Walk a graph neighborhood from seed nodes, scored by spread or personalized PageRank. See Graph search. |
POST /v1/graph/paths[/{collection}] | viewer | Shortest, k-shortest or all paths between nodes, with edge evidence. See Graph search. |
Without the path segment, a graph request names its collection in the body.
#Match routes
The Match API is reverse search, often called percolation: you register queries in a queries collection and send documents to learn which queries match them. All its routes live under /v1/match/{queries-collection}.
| Method and path | Role | Purpose |
|---|---|---|
POST /v1/match/{queries-collection} | viewer | Match documents against the registered queries. |
PUT /v1/match/{queries-collection}/{id} | writer | Register or replace one query. Add ?dry_run=true to only check it. |
PUT /v1/match/{queries-collection} | writer | Register many queries. |
GET /v1/match/{queries-collection}/{id} | viewer | Read one registered query. |
GET /v1/match/{queries-collection} | viewer | List registered queries. |
DELETE /v1/match/{queries-collection}/{id} | writer | Unregister a query. |
A search request carries a query in its language (text by default, or lucene, sql, pgsql, es, solr, logql, grafana, warpsearch, ppl, esql or cypher), plus optional filters, post_filters, facets, metrics, sort, limit, offset, fields, time_range, time_zone, include_translation and the resource caps timeout_ms, max_rows, max_groups, max_bytes and max_parallel. See Searching for every field and Query languages. Add ?format=es for an Elasticsearch-shaped response or ?format=csv for a table.
#Management routes
| Method and path | Role | Purpose |
|---|---|---|
GET /v1/collections | viewer | List the collections you can access. |
PUT /v1/collections/{collection} | editor | Create a collection, with an optional schema, description, class, labels and metadata, or as a clone of another one. See Create a collection. |
GET /v1/collections/{collection} | viewer | Describe a collection and its fields. A collection being rebuilt shows "status": "reingesting" (a new version is being filled; writes pause briefly at the switch) or "recovering" (rebuilt from its stored documents after storage damage; reads go on where possible, writes wait). |
PATCH /v1/collections/{collection} | editor | Change the description, metadata and labels. |
DELETE /v1/collections/{collection} | admin | Delete a collection and its documents. Answers 202 {"status":"deleting"}: the collection is gone from the API at once, and its data is removed in the background. Until that finishes it is listed with "status": "deleting", and creating the same name answers 409 collection_deleting. |
GET /v1/collections/{collection}/partitions | viewer | List a partitioned collection's partitions. |
GET /v1/collections/{collection}/schema | viewer | Read the schema, as JSON or (with Accept: application/yaml) YAML. |
PUT /v1/collections/{collection}/schema | editor | Set field and template definitions from a JSON or YAML body; everything else is kept. Returns the resulting schema. |
POST /v1/collections/{collection}/refresh | writer | Make pending writes searchable. |
POST /v1/collections/{collection}/documents | writer | Index documents (JSON array, {"docs": [...]} or NDJSON). Add ?commit=true to search them right away, ?all_or_none=true to refuse the whole batch when one document fails. |
GET /v1/collections/{collection}/documents/{id} | viewer | Get one document. |
DELETE /v1/collections/{collection}/documents/{id} | writer | Delete one document (?commit=true applies it before answering). |
POST /v1/collections/{collection}/browse | viewer | Cursor-based browsing. See Paging. |
GET /v1/collections/{collection}/export | viewer | Stream matching hits as NDJSON. See Export. |
PATCH /v1/collections/{collection}/documents/{id} | writer | Partial-update operations, with optional upsert and durability. See Partial updates. |
POST /v1/collections/{collection}/documents/_patch | writer | Patch a docs array of ids and operations. |
POST /v1/collections/{collection}/documents/_delete | writer | Delete several documents by id: {"ids": [...], "commit": true}. |
#Account routes
| Method and path | Role | Purpose |
|---|---|---|
GET /v1/usage | needs the view usage permission | Your usage counters and plan limits. |
GET /v1/auth/me | any | The caller, its permissions, rate limits and its role on each collection. |
GET /v1/openapi.yaml | any | The OpenAPI document. |
#Create a collection
PUT /v1/collections/{collection} takes an optional JSON body. Every key is optional:
| Key | Meaning |
|---|---|
description | Free text, up to 2000 characters. |
class | search (default), knowledge, stream, archive or queries (Match API). Fixed at creation; feature access may be required. |
labels | String key/value pairs. |
metadata | A JSON object of your own, up to 16 KB. |
schema | The schema: fields, templates and stored_resources, in the format described in Schemas and field types. |
clone | {"from": "<collection>", "documents": false, "recover": "auto"}: copy another collection's schema, synonyms, rules and search settings, and with documents its documents. Not combined with schema or partitioning. See Clone a collection. |
curl -X PUT https://api.warpsearch.io/v1/collections/products \
-H "Authorization: Bearer $WARPSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Product catalog",
"schema": {
"fields": {"name": {"parent": "_t"}, "price": "double", "tags": {"type": "string", "multi": "set"}},
"templates": {"_attr": "string"}
}
}'
It answers 201 with the collection. A name that exists answers 409 already_exists, and an invalid schema answers 400 with a message naming the problem. The create body is JSON, so the schema inside it is a JSON object; to send a schema as YAML, create the collection first and then PUT the YAML to /schema.
#Schema
GET /v1/collections/{collection}/schema returns the schema as JSON, or as YAML when the request sends Accept: application/yaml. The output is valid input for a write.
PUT on the same path takes a schema as JSON or YAML. The fields and templates in the body are set (a named field's definition is replaced as a whole) and everything else is kept. The response is the resulting schema.
curl -X PUT https://api.warpsearch.io/v1/collections/products/schema \
-H "Authorization: Bearer $WARPSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fields": {"rating": "float"}}'
A change that would break documents already indexed answers 409 with the code incompatible_schema and names the field. Refused: changing a field's type, single-valued versus multi-valued, a vector's dims, metric or truncate_dims, a decimal's scale, the analyzer or normalizer, and the index mode or column. Adding fields and templates, and changing ann or long_terms, is allowed. Vector storage encoding is not configurable through this API. To change a field, add a new one and reindex. See Schemas and field types.
#Conventions
| Topic | Convention |
|---|---|
| Request bodies | Decoded strictly: an unknown field is rejected instead of ignored. |
| Collection names | Start with a lowercase letter and contain only lowercase letters, digits and _. |
| Errors | RFC 9457 application/problem+json bodies with type, title, status, detail, a stable machine-readable code and a request_id. Branch on code, not on the text. See Limits and errors. |
| Request IDs | Every response carries an X-Request-Id. Send your own to have it kept, and quote it when you contact us. |
| Rate limits | Responses carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (also as X-RateLimit-*). A rate-limited or overloaded request answers 429 with a Retry-After header; wait that long before retrying. A collection that is loading answers 503 with Retry-After too. See Rate limits. |
| Warnings | When a query is approximated or part of it is ignored, the response carries a Warning: 299 header, and /v1 responses also list the messages in warnings. |
| Partial indexing | An ingest request where some documents fail answers 207, and one where all fail answers 400, with the failures listed in errors. |
#Compatible APIs and agents
Existing clients can use the compatible APIs instead of /v1, with the same key:
- Elasticsearch at
/compat/es - OpenSearch at
/compat/opensearch - Solr at
/compat/solr - turbopuffer at
/compat/turbopuffer - LogQL
Agents connect to the MCP server at https://api.warpsearch.io/mcp. See the Guide for AI agents.