Search API
Search API
Overview
The Search API allows you to create, update, and manage search records independently of content updates. This provides more control over structured data (title, summary, content, filterable attributes) rather than relying solely on content extractors.
Authentication
Method: Bearer Token
All API requests must include the following headers:
Header | Description |
---|---|
Quant-Token | Your project’s API token (found in your dashboard) |
Quant-Customer | Your customer identifier |
Quant-Project | Your project identifier |
These headers will be validated to ensure the request is authorized.
Example:
curl -H "Quant-Customer: example-customer" \ -H "Quant-Project: example-project" \ -H "Quant-Token: your-project-token" \ https://api.quantcdn.io/v1/search
Base URL
All API requests must be directed to:
https://api.quantcdn.io/v1/
Endpoints
Check Index Status
URL: /search
Method: GET
Description: Check index size, outstanding tasks, and basic configuration.
Response
Status Code: 200 OK
{ "index_size": 1250, "pending_tasks": 0, "facets": ["categories", "tags"], "status": "ready"}
Create or Update Search Records
URL: /search
Method: POST
Description: Create or update search records in the index.
Request Body
An array of search record objects:
[ { "title": "This is a record", "url": "/blog/page", "summary": "The record is small and neat.", "content": "Lots of good content here. But not too much!" }, { "title": "Fully featured search record", "url": "/about-us", "summary": "The record contains all the trimmings.", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image": "https://www.example.com/images/about.jpg", "categories": ["Blog", "Commerce", "Jamstack"], "tags": ["Tailwind", "QuantCDN"] }]
Property | Type | Required | Description |
---|---|---|---|
title | string | Yes | Title used in search results and as a searchable attribute |
url | string | Yes | The URL path where the content is accessible |
summary | string | Yes | Content snippet displayed in search results |
content | string | Yes | Main searchable content (can contain HTML, tags will be stripped) |
image | string | No | URL to an image for display in search results |
categories | object/array | No | Custom taxonomies for faceting and filtering |
tags | array | No | Tags for faceting and filtering |
Response
Status Code: 200 OK
{ "message": "Search records created/updated successfully", "processed": 2, "errors": 0}
Make Attributes Filterable (Add Facets)
URL: /search/facet
Method: POST
Description: Define which attributes should be filterable in search results.
Request Body
An array of attribute names:
["categories", "tags"]
Response
Status Code: 200 OK
{ "message": "Facets updated successfully", "facets": ["categories", "tags"]}
Delete a Search Record
URL: /search
Method: DELETE
Description: Remove a specific item from the search index.
Request Headers
Header | Type | Required | Description |
---|---|---|---|
Quant-Url | string | Yes | The URL path of the record to delete |
Example
curl -X DELETE \ -H "Quant-Customer: example-customer" \ -H "Quant-Project: example-project" \ -H "Quant-Token: your-project-token" \ -H "Quant-Url: /about-us" \ https://api.quantcdn.io/v1/search
Response
Status Code: 200 OK
{ "message": "Search record deleted successfully", "url": "/about-us"}
Clear Entire Search Index
URL: /search/all
Method: DELETE
Description: Remove all records from the search index.
Example
curl -X DELETE \ -H "Quant-Customer: example-customer" \ -H "Quant-Project: example-project" \ -H "Quant-Token: your-project-token" \ https://api.quantcdn.io/v1/search/all
Response
Status Code: 200 OK
{ "message": "Search index cleared successfully"}
Including Search Records with Content
You can include search records when posting content by adding a search_record
object to your content payload:
{ "content": "<html><body><h1>My static web page</h1></body></html>", "url": "/", "published": true, "info": { "author_name": "Joe Static", "log": "Included custom search_record values" }, "search_record": { "title": "Manually provided title", "summary": "Content snippet to display in search results.", "content": "This page has a lot of body content. It is manually provided via search_record.", "image": "https://via.placeholder.com/custom", "categories": { "tags": ["manual-tag-1", "manual-tag-2"], "custom_taxonomy": ["apple", "banana", "pineapple"] } }}
Supported Keys
Key | Description |
---|---|
title | Used both as a searchable attribute and the title in search results |
summary | Used as a searchable attribute and the content snippet in search results |
content | Main searchable content (HTML tags will be stripped) |
image | URL to an image for display in search results |
categories | Object containing taxonomies with arrays of terms for faceting |
All keys within search_record
are optional. The configured extractors will attempt to determine content as a fallback.
Error Responses
400 Bad Request
{ "error": "Invalid parameter", "message": "Search record must include title, url, and content"}
401 Unauthorized
{ "error": "Unauthorized", "message": "Invalid API token"}
429 Too Many Requests
{ "error": "Rate limit exceeded", "message": "Too many requests, please try again later"}