Update instance.
Update instance.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYYAPI Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
X-Auth-Email: user@example.comThe previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194ParametersExpand Collapse
params InstanceUpdateParams
Body param
Body param
Body param
Body param
Body param: Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).
Body param: Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).
CustomMetadata param.Field[[]InstanceUpdateParamsCustomMetadata]OptionalBody param
Body param
DataType InstanceUpdateParamsCustomMetadataDataType
Body param
Body param
Body param
Body param
KeywordTokenizer InstanceUpdateParamsIndexingOptionsKeywordTokenizerOptionalTokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.
Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.
Body param
Body param
Body param
Body param
Body param
Body param
BoostBy []InstanceUpdateParamsRetrievalOptionsBoostByOptionalMetadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to ‘asc’ for numeric/datetime fields and ‘exists’ for text/boolean fields. Fields must match ‘timestamp’ or a defined custom_metadata field.
Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to ‘asc’ for numeric/datetime fields and ‘exists’ for text/boolean fields. Fields must match ‘timestamp’ or a defined custom_metadata field.
Metadata field name to boost by. Use ‘timestamp’ for document freshness, or any custom_metadata field. Numeric and datetime fields support all four directions (asc, desc, exists, not_exists); text/boolean fields only support exists/not_exists.
Direction InstanceUpdateParamsRetrievalOptionsBoostByDirectionOptionalBoost direction. ‘desc’ = higher values rank higher (e.g. newer timestamps). ‘asc’ = lower values rank higher. ‘exists’ = boost chunks that have the field. ‘not_exists’ = boost chunks that lack the field. Optional — defaults to ‘asc’ for numeric/datetime fields, ‘exists’ for text/boolean fields.
Boost direction. ‘desc’ = higher values rank higher (e.g. newer timestamps). ‘asc’ = lower values rank higher. ‘exists’ = boost chunks that have the field. ‘not_exists’ = boost chunks that lack the field. Optional — defaults to ‘asc’ for numeric/datetime fields, ‘exists’ for text/boolean fields.
KeywordMatchMode InstanceUpdateParamsRetrievalOptionsKeywordMatchModeOptionalControls which documents are candidates for BM25 scoring. ‘and’ restricts candidates to documents containing all query terms; ‘or’ includes any document containing at least one term, ranked by BM25 relevance. Defaults to ‘and’.
Controls which documents are candidates for BM25 scoring. ‘and’ restricts candidates to documents containing all query terms; ‘or’ includes any document containing at least one term, ranked by BM25 relevance. Defaults to ‘and’.
Body param
Body param
Body param
Body param
List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced)
List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post)
WebCrawler InstanceUpdateParamsSourceParamsWebCrawlerOptional
ParseOptions InstanceUpdateParamsSourceParamsWebCrawlerParseOptionsOptional
ContentSelector []InstanceUpdateParamsSourceParamsWebCrawlerParseOptionsContentSelectorOptionalList of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. Only the matched HTML fragment is stored and indexed. Omit the field to disable content selection — empty arrays are rejected.
List of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. Only the matched HTML fragment is stored and indexed. Omit the field to disable content selection — empty arrays are rejected.
Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 token characters (no spaces, colons, or control characters); values must be HTAB + printable ASCII (no CR/LF).
Body param
Body param
ReturnsExpand Collapse
type InstanceUpdateResponse struct{…}
AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.
AISearchModel InstanceUpdateResponseAISearchModelOptional
CacheThreshold InstanceUpdateResponseCacheThresholdOptional
CacheTTL InstanceUpdateResponseCacheTTLOptionalCache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).
Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).
CustomMetadata []InstanceUpdateResponseCustomMetadataOptional
DataType InstanceUpdateResponseCustomMetadataDataType
EmbeddingModel InstanceUpdateResponseEmbeddingModelOptional
IndexMethod InstanceUpdateResponseIndexMethodOptionalControls which storage backends are used during indexing. Defaults to vector-only.
Controls which storage backends are used during indexing. Defaults to vector-only.
IndexingOptions InstanceUpdateResponseIndexingOptionsOptional
KeywordTokenizer InstanceUpdateResponseIndexingOptionsKeywordTokenizerOptionalTokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.
Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.
PublicEndpointParams InstanceUpdateResponsePublicEndpointParamsOptional
RetrievalOptions InstanceUpdateResponseRetrievalOptionsOptional
BoostBy []InstanceUpdateResponseRetrievalOptionsBoostByOptionalMetadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to ‘asc’ for numeric/datetime fields and ‘exists’ for text/boolean fields. Fields must match ‘timestamp’ or a defined custom_metadata field.
Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to ‘asc’ for numeric/datetime fields and ‘exists’ for text/boolean fields. Fields must match ‘timestamp’ or a defined custom_metadata field.
Metadata field name to boost by. Use ‘timestamp’ for document freshness, or any custom_metadata field. Numeric and datetime fields support all four directions (asc, desc, exists, not_exists); text/boolean fields only support exists/not_exists.
Direction InstanceUpdateResponseRetrievalOptionsBoostByDirectionOptionalBoost direction. ‘desc’ = higher values rank higher (e.g. newer timestamps). ‘asc’ = lower values rank higher. ‘exists’ = boost chunks that have the field. ‘not_exists’ = boost chunks that lack the field. Optional — defaults to ‘asc’ for numeric/datetime fields, ‘exists’ for text/boolean fields.
Boost direction. ‘desc’ = higher values rank higher (e.g. newer timestamps). ‘asc’ = lower values rank higher. ‘exists’ = boost chunks that have the field. ‘not_exists’ = boost chunks that lack the field. Optional — defaults to ‘asc’ for numeric/datetime fields, ‘exists’ for text/boolean fields.
KeywordMatchMode InstanceUpdateResponseRetrievalOptionsKeywordMatchModeOptionalControls which documents are candidates for BM25 scoring. ‘and’ restricts candidates to documents containing all query terms; ‘or’ includes any document containing at least one term, ranked by BM25 relevance. Defaults to ‘and’.
Controls which documents are candidates for BM25 scoring. ‘and’ restricts candidates to documents containing all query terms; ‘or’ includes any document containing at least one term, ranked by BM25 relevance. Defaults to ‘and’.
RewriteModel InstanceUpdateResponseRewriteModelOptional
SourceParams InstanceUpdateResponseSourceParamsOptional
List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced)
List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post)
WebCrawler InstanceUpdateResponseSourceParamsWebCrawlerOptional
ParseOptions InstanceUpdateResponseSourceParamsWebCrawlerParseOptionsOptional
ContentSelector []InstanceUpdateResponseSourceParamsWebCrawlerParseOptionsContentSelectorOptionalList of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. Only the matched HTML fragment is stored and indexed. Omit the field to disable content selection — empty arrays are rejected.
List of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. Only the matched HTML fragment is stored and indexed. Omit the field to disable content selection — empty arrays are rejected.
Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 token characters (no spaces, colons, or control characters); values must be HTAB + printable ASCII (no CR/LF).
Update instance.
package main
import (
"context"
"fmt"
"github.com/stainless-sdks/cloudflare-go"
"github.com/stainless-sdks/cloudflare-go/ai_search"
"github.com/stainless-sdks/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": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"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": "@cf/qwen/qwen3-embedding-0.6b",
"enable": true,
"engine_version": 0,
"fusion_method": "max",
"hybrid_search_enabled": true,
"index_method": {
"keyword": true,
"vector": true
},
"indexing_options": {
"keyword_tokenizer": "porter"
},
"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
},
"enabled": true,
"mcp": {
"description": "description",
"disabled": true
},
"rate_limit": {
"period_ms": 60000,
"requests": 1,
"technique": "fixed"
},
"search_endpoint": {
"disabled": true
}
},
"reranking": true,
"reranking_model": "@cf/baai/bge-reranker-base",
"retrieval_options": {
"boost_by": [
{
"field": "timestamp",
"direction": "desc"
}
],
"keyword_match_mode": "and"
},
"rewrite_model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"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": {
"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": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"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": "@cf/qwen/qwen3-embedding-0.6b",
"enable": true,
"engine_version": 0,
"fusion_method": "max",
"hybrid_search_enabled": true,
"index_method": {
"keyword": true,
"vector": true
},
"indexing_options": {
"keyword_tokenizer": "porter"
},
"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
},
"enabled": true,
"mcp": {
"description": "description",
"disabled": true
},
"rate_limit": {
"period_ms": 60000,
"requests": 1,
"technique": "fixed"
},
"search_endpoint": {
"disabled": true
}
},
"reranking": true,
"reranking_model": "@cf/baai/bge-reranker-base",
"retrieval_options": {
"boost_by": [
{
"field": "timestamp",
"direction": "desc"
}
],
"keyword_match_mode": "and"
},
"rewrite_model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"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": {
"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
}