Skip to main content

API Overview

hlquery exposes a modern HTTP/JSON API for collection management, document indexing, lexical search, vector search, aliases, access control, cluster links, modules, and server health.

The authoritative route resolver lives in src/api/httproutes.cpp. Endpoint pages in this section describe the public surface exposed by that resolver.

Base URL

Development servers listen on port 9200 by default:

http://localhost:9200

TLS deployments usually terminate HTTPS at a proxy or run hlquery with an HTTPS listener, depending on local configuration.

https://search.example.com

Request Format

Most write and action endpoints accept JSON request bodies:

curl -X POST http://localhost:9200/collections/products/documents \
-H "Content-Type: application/json" \
-d '{"id":"prod_1","title":"Keyboard","price":49.99}'

Most read endpoints support query string parameters:

curl "http://localhost:9200/collections/products/documents/search?q=keyboard&limit=10"

Trailing slashes are normalized by the route resolver. Query strings are stripped before route matching.

Authentication

hlquery supports API key authentication through either header:

curl -H "X-API-Key: your-api-key" http://localhost:9200/collections
curl -H "Authorization: Bearer your-api-key" http://localhost:9200/collections

Authentication behavior is controlled by server configuration. When authentication is disabled, unauthenticated requests are accepted, while token-bearing requests may be rejected except for routes such as /health.

Admin routes include /keys, /users, /flush, and /admin/storage_status.

Route Groups

Health, Readiness, and Metrics

MethodPathDescription
GET/Status response
GET/statusStatus response
GET/queryStatus alias
ANY/healthHealth check. Use GET from clients.
GET/readyReadiness check
GET/pingLightweight ping
GET/startupStartup report
GET/boot-statusStartup report alias
GET/statsServer statistics
GET/metricsJSON metrics
GET/metrics.jsonMetrics alias
GET/metrics/historyHistorical metrics
GET/metrics-historyHistorical metrics alias
GET/connectionsActive connection count
GET/doctotalTotal document and collection count
GET/etcProtocol metadata for clients
GET/cacheSearch/cache status
GET/config-filesRuntime configuration file metadata
GET/search-configSearch configuration summary

Storage and Maintenance

MethodPathDescription
GET/rocksdbRocksDB status
GET/_rocksdbRocksDB status alias
GET/admin/storage_statusStorage backend status
GET/POST/update-countersRecompute document counters
GET/debug/countersCounter diagnostics
GET/POST/repairRun repair checks
GET/integrityIntegrity checks
GET/consistencyIntegrity alias
GET/self-checkSelf-check report
POST/flushFlush all data. Admin-only and destructive.
GET/presetsList saved presets
POST/PUT/presets/{preset}Create or update a preset
GET/presets/{preset}Get a preset
DELETE/presets/{preset}Delete a preset

Collections

MethodPathDescription
GET/collectionsList collections
POST/collectionsCreate collection
GET/collections/distributedList collections across configured links
GET/collections/{collection}Get collection metadata
DELETE/collections/{collection}Delete collection
GET/collections/{collection}/langGet collection language
POST/collections/{collection}/updateUpdate collection schema

Documents

MethodPathDescription
GET/collections/{collection}/documentsList documents
POST/collections/{collection}/documentsAdd document
DELETE/collections/{collection}/documentsDelete documents by filter
POST/collections/{collection}/documents/importBulk import documents
GET/collections/{collection}/documents/{id}Get document
PUT/collections/{collection}/documents/{id}Update document
DELETE/collections/{collection}/documents/{id}Delete document
GET/collections/{collection}/documents/{id}/contextGet surrounding document context
POST/collections/{collection}/documents/_update_by_queryUpdate matching documents
POST/collections/{collection}/documents/_delete_by_queryDelete matching documents
MethodPathDescription
GET/POST/collections/{collection}/documents/searchLexical or hybrid document search
GET/POST/collections/{collection}/documents/facet_countsFacet counts
GET/POST/collections/{collection}/documents/exportExport matching documents
GET/POST/collections/{collection}/documents/maybeQuery suggestion endpoint
GET/POST/collections/{collection}/vector_searchDedicated vector search
GET/POST/collections/{collection}/searchVector search alias
GET/POST/multi_searchMulti-search
GET/POST/searchGlobal search
GET/POST/sqlSQL-style query entry point

Synonyms, Stopwords, Overrides, and Aliases

MethodPathDescription
GET/synonymsList all synonyms
GET/synonym_setsList all synonyms alias
GET/synonyms/globalList global synonyms
GET/synonym_sets/globalList global synonyms alias
POST/PUT/synonyms/global/{id}Create or update global synonym
POST/PUT/synonym_sets/global/{id}Create or update global synonym alias
POST/PUT/synonym_sets/global/items/{id}Create or update global synonym item alias
GET/synonyms/global/{id}Get global synonym
GET/synonym_sets/global/{id}Get global synonym alias
GET/synonym_sets/global/items/{id}Get global synonym item alias
DELETE/synonyms/global/{id}Delete global synonym
DELETE/synonym_sets/global/{id}Delete global synonym alias
DELETE/synonym_sets/global/items/{id}Delete global synonym item alias
GET/collections/{collection}/synonymsList collection synonyms
GET/collections/{collection}/synonym_setsList collection synonyms alias
POST/PUT/collections/{collection}/synonyms/{id}Create or update collection synonym
POST/PUT/collections/{collection}/synonym_sets/{id}Create or update collection synonym alias
GET/collections/{collection}/synonyms/{id}Get collection synonym
GET/collections/{collection}/synonym_sets/{id}Get collection synonym alias
DELETE/collections/{collection}/synonyms/{id}Delete collection synonym
DELETE/collections/{collection}/synonym_sets/{id}Delete collection synonym alias
GET/stopwordsList all stopwords
GET/stopword_setsList all stopwords alias
GET/stopwords/globalList global stopwords
GET/stopword_sets/globalList global stopwords alias
POST/stopwords/globalCreate global stopword
POST/stopword_sets/globalCreate global stopword alias
DELETE/stopwords/global/{word}Delete global stopword
DELETE/stopword_sets/global/{word}Delete global stopword alias
DELETE/stopword_sets/global/items/{word}Delete global stopword item alias
GET/collections/{collection}/stopwordsList collection stopwords
GET/collections/{collection}/stopword_setsList collection stopwords alias
POST/collections/{collection}/stopwordsCreate collection stopword
POST/collections/{collection}/stopword_setsCreate collection stopword alias
DELETE/collections/{collection}/stopwords/{word}Delete collection stopword
DELETE/collections/{collection}/stopword_sets/{word}Delete collection stopword alias
GET/collections/{collection}/overridesList collection overrides
POST/PUT/collections/{collection}/overrides/{id}Create or update override
GET/collections/{collection}/overrides/{id}Get override
DELETE/collections/{collection}/overrides/{id}Delete override
GET/collections/{collection}/curationsList collection curations alias
GET/collections/{collection}/curation_setsList collection curations alias
POST/PUT/collections/{collection}/curations/{id}Create or update curation alias
POST/PUT/collections/{collection}/curation_sets/{id}Create or update curation alias
GET/collections/{collection}/curations/{id}Get curation alias
GET/collections/{collection}/curation_sets/{id}Get curation alias
DELETE/collections/{collection}/curations/{id}Delete curation alias
DELETE/collections/{collection}/curation_sets/{id}Delete curation alias
GET/aliasesList aliases
GET/collections/{collection}/aliasesList aliases targeting a collection
POST/PUT/aliases/{alias}Create or update alias
GET/aliases/{alias}Get alias
DELETE/aliases/{alias}Delete alias

Access Control

MethodPathDescription
GET/keysList API keys
POST/keysCreate API key
GET/keys/{id}Get API key metadata
PUT/keys/{id}Update API key
DELETE/keys/{id}Delete API key
GET/usersList users
POST/usersCreate user
GET/users/{name}Get user
PUT/users/{name}Update user
DELETE/users/{name}Delete user
MethodPathDescription
GET/linksList configured cluster links
GET/links/pingPing configured links
POST/links/connectAdd a runtime link
POST/links/disconnectRemove a runtime link
GET/modulesList loaded modules
POST/loadmoduleLoad module by request body
POST/loadmodule/{module}Load module by path
POST/unloadmoduleUnload module by request body
POST/unloadmodule/{module}Unload module by path
GET/POST/PUT/DELETE/modules/{module}/...Module-specific API
GET/modules/{module}/syntaxModule syntax
POST/analytics/clickRecord click analytics

Pagination

Common list endpoints accept offset and limit:

curl "http://localhost:9200/collections/products/documents?offset=0&limit=25"

Search endpoints also support page and per_page where the handler accepts Typesense-style parameters.

Errors

Errors are returned as JSON when possible:

{
"error": "Collection not found",
"message": "The requested collection does not exist",
"code": 1004,
"code_text": "COLLECTION_NOT_FOUND"
}

error is the handler-provided description when one is available. code_text is the stable name associated with the numeric protocol code; clients should use code or code_text for programmatic branching and treat error and message as human-readable context.

Common status codes:

StatusMeaning
200Request succeeded
201Resource created
400Bad request
401Missing or invalid authentication
403Forbidden
404Resource not found
405Method not allowed
409Conflict
500Internal server error
503Temporarily unavailable during startup, metadata scan, or sync

Next