Content Management API > Search Index
Create a search index
Body parameters
type string Required
Must be exactly "search_index".
attributes.name string Required
Name of the search index
Example:
"Production Website"
attributes.enabled boolean Required
Whether the search index is enabled or not
attributes.frontend_url string, null Required
The public URL of the website. This is the starting point from which the website's spidering will start
Example:
"https://www.mywebsite.com/"
attributes.user_agent_suffix string, null Optional
Optional suffix to append to the DatoCmsSearchBot user agent when indexing the website
Example:
"v1.0.0"
relationships.build_triggers.data Optional
The build triggers that can trigger this search index
Type:
Array<ResourceLinkage<"build_trigger">>
Returns
Returns a resource object of type search_index.
Examples
POST https://site-api.datocms.com/search-indexes HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Content-Type: application/vnd.api+json
{ "data": { "type": "search_index", "attributes": { "name": "Production Website", "enabled": true, "frontend_url": "https://www.mywebsite.com/" } }}curl -g 'https://site-api.datocms.com/search-indexes' \ -X POST \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3" \ -H "Content-Type: application/vnd.api+json" \ --data-binary '{"data":{"type":"search_index","attributes":{"name":"Production Website","enabled":true,"frontend_url":"https://www.mywebsite.com/"}}}'await fetch("https://site-api.datocms.com/search-indexes", { method: "POST", headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", "Content-Type": "application/vnd.api+json", }, body: JSON.stringify({ data: { type: "search_index", attributes: { name: "Production Website", enabled: true, frontend_url: "https://www.mywebsite.com/", }, }, }),});HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": { "type": "search_index", "id": "1822", "attributes": { "name": "Production Website", "enabled": true, "frontend_url": "https://www.mywebsite.com/", "user_agent_suffix": "v1.0.0" }, "relationships": { "build_triggers": { "data": [ { "type": "build_trigger", "id": "1822" } ] } }, "meta": { "indexing_status": "success", "last_indexing_completed_at": "2025-03-30T09:29:14.872Z" } }}