Update an AI Search instance (Search for Agents metadata requires the default namespace).
Update an AI Search instance. Submitting Search for Agents metadata requires the default namespace; omitting or removing it is allowed elsewhere. Submit Search for Agents metadata and restrictive or unknown public endpoint changes or custom domains in separate PUT requests, even when resubmitting unchanged metadata.
Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances (and descendant paths) instead.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Update an AI Search instance (Search for Agents metadata requires the default namespace).
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/ai_search"
"github.com/cloudflare/cloudflare-go/option"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
instance, err := client.AISearch.Instances.Update(
context.TODO(),
"my-ai-search",
ai_search.InstanceUpdateParams{
AccountID: cloudflare.F("c3dc5f0b34a14ff8e1b3ec04895e1b22"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", instance.ID)
}
{
"result": {
"id": "my-ai-search",
"created_at": "2019-12-27T18:11:19.117Z",
"modified_at": "2019-12-27T18:11:19.117Z",
"ai_gateway_id": "ai_gateway_id",
"ai_search_model": "ai_search_model",
"cache": true,
"cache_threshold": "super_strict_match",
"cache_ttl": 600,
"chunk_overlap": 0,
"chunk_size": 64,
"created_by": "created_by",
"custom_metadata": [
{
"data_type": "text",
"field_name": "x"
}
],
"embedding_model": "embedding_model",
"enable": true,
"engine_version": 0,
"fusion_method": "max",
"hybrid_search_enabled": true,
"index_method": {
"keyword": true,
"vector": true
},
"indexing_options": {
"keyword_tokenizer": "porter",
"use_ocr": true
},
"last_activity": "2019-12-27T18:11:19.117Z",
"max_num_results": 1,
"metadata": {
"created_from_aisearch_wizard": true,
"worker_domain": "worker_domain"
},
"modified_by": "modified_by",
"namespace": "namespace",
"paused": true,
"public_endpoint_id": "public_endpoint_id",
"public_endpoint_params": {
"authorized_hosts": [
"string"
],
"chat_completions_endpoint": {
"disabled": true
},
"custom_domains": [
"search.example.com"
],
"default_domain_enabled": true,
"enabled": true,
"mcp": {
"description": "description",
"disabled": true
},
"rate_limit": {
"period_ms": 60000,
"requests": 1,
"technique": "fixed"
},
"search_endpoint": {
"disabled": true
}
},
"reranking": true,
"reranking_model": "reranking_model",
"retrieval_options": {
"boost_by": [
{
"field": "timestamp",
"direction": "desc"
}
],
"keyword_match_mode": "and"
},
"rewrite_model": "rewrite_model",
"rewrite_query": true,
"score_threshold": 0,
"source": "source",
"source_params": {
"exclude_items": [
"/admin/**",
"/private/**",
"**\\temp\\**"
],
"include_items": [
"/blog/**",
"/docs/**/*.html",
"**\\blog\\**.html"
],
"prefix": "prefix",
"r2_jurisdiction": "r2_jurisdiction",
"web_crawler": {
"discover_options": {
"depth": 5,
"include_external_links": false,
"include_subdomains": false,
"limit": 10000,
"max_age": 86400,
"source": "all"
},
"parse_options": {
"content_selector": [
{
"path": "**/blog/**",
"selector": "article div.post-body"
},
{
"path": "**/docs/**",
"selector": "main"
}
],
"include_headers": {
"cache-control": "no-cache, no-store"
},
"include_images": true,
"specific_sitemaps": [
"https://example.com/sitemap.xml",
"https://example.com/blog-sitemap.xml"
],
"use_browser_rendering": true
},
"parse_type": "sitemap"
}
},
"status": "status",
"sync_interval": 900,
"token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"type": "r2"
},
"success": true
}Returns Examples
{
"result": {
"id": "my-ai-search",
"created_at": "2019-12-27T18:11:19.117Z",
"modified_at": "2019-12-27T18:11:19.117Z",
"ai_gateway_id": "ai_gateway_id",
"ai_search_model": "ai_search_model",
"cache": true,
"cache_threshold": "super_strict_match",
"cache_ttl": 600,
"chunk_overlap": 0,
"chunk_size": 64,
"created_by": "created_by",
"custom_metadata": [
{
"data_type": "text",
"field_name": "x"
}
],
"embedding_model": "embedding_model",
"enable": true,
"engine_version": 0,
"fusion_method": "max",
"hybrid_search_enabled": true,
"index_method": {
"keyword": true,
"vector": true
},
"indexing_options": {
"keyword_tokenizer": "porter",
"use_ocr": true
},
"last_activity": "2019-12-27T18:11:19.117Z",
"max_num_results": 1,
"metadata": {
"created_from_aisearch_wizard": true,
"worker_domain": "worker_domain"
},
"modified_by": "modified_by",
"namespace": "namespace",
"paused": true,
"public_endpoint_id": "public_endpoint_id",
"public_endpoint_params": {
"authorized_hosts": [
"string"
],
"chat_completions_endpoint": {
"disabled": true
},
"custom_domains": [
"search.example.com"
],
"default_domain_enabled": true,
"enabled": true,
"mcp": {
"description": "description",
"disabled": true
},
"rate_limit": {
"period_ms": 60000,
"requests": 1,
"technique": "fixed"
},
"search_endpoint": {
"disabled": true
}
},
"reranking": true,
"reranking_model": "reranking_model",
"retrieval_options": {
"boost_by": [
{
"field": "timestamp",
"direction": "desc"
}
],
"keyword_match_mode": "and"
},
"rewrite_model": "rewrite_model",
"rewrite_query": true,
"score_threshold": 0,
"source": "source",
"source_params": {
"exclude_items": [
"/admin/**",
"/private/**",
"**\\temp\\**"
],
"include_items": [
"/blog/**",
"/docs/**/*.html",
"**\\blog\\**.html"
],
"prefix": "prefix",
"r2_jurisdiction": "r2_jurisdiction",
"web_crawler": {
"discover_options": {
"depth": 5,
"include_external_links": false,
"include_subdomains": false,
"limit": 10000,
"max_age": 86400,
"source": "all"
},
"parse_options": {
"content_selector": [
{
"path": "**/blog/**",
"selector": "article div.post-body"
},
{
"path": "**/docs/**",
"selector": "main"
}
],
"include_headers": {
"cache-control": "no-cache, no-store"
},
"include_images": true,
"specific_sitemaps": [
"https://example.com/sitemap.xml",
"https://example.com/blog-sitemap.xml"
],
"use_browser_rendering": true
},
"parse_type": "sitemap"
}
},
"status": "status",
"sync_interval": 900,
"token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"type": "r2"
},
"success": true
}