Skip to content
Start here

Update an AI Search instance.

client.AISearch.Instances.Update(ctx, id, params) (*InstanceUpdateResponse, error)
PUT/accounts/{account_id}/ai-search/instances/{id}

Update the configuration of an AI Search instance.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
id string
params InstanceUpdateParams
AccountID param.Field[string]

Path param

AIGatewayID param.Field[string]Optional

Body param

AISearchModel param.Field[string]Optional

Body param: A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.

Cache param.Field[bool]Optional

Body param

CacheThreshold param.Field[InstanceUpdateParamsCacheThreshold]Optional

Body param

const InstanceUpdateParamsCacheThresholdSuperStrictMatch InstanceUpdateParamsCacheThreshold = "super_strict_match"
const InstanceUpdateParamsCacheThresholdCloseEnough InstanceUpdateParamsCacheThreshold = "close_enough"
const InstanceUpdateParamsCacheThresholdFlexibleFriend InstanceUpdateParamsCacheThreshold = "flexible_friend"
const InstanceUpdateParamsCacheThresholdAnythingGoes InstanceUpdateParamsCacheThreshold = "anything_goes"
CacheTTL param.Field[InstanceUpdateParamsCacheTTL]Optional

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).

const InstanceUpdateParamsCacheTTL600 InstanceUpdateParamsCacheTTL = 600
const InstanceUpdateParamsCacheTTL1800 InstanceUpdateParamsCacheTTL = 1800
const InstanceUpdateParamsCacheTTL3600 InstanceUpdateParamsCacheTTL = 3600
const InstanceUpdateParamsCacheTTL7200 InstanceUpdateParamsCacheTTL = 7200
const InstanceUpdateParamsCacheTTL21600 InstanceUpdateParamsCacheTTL = 21600
const InstanceUpdateParamsCacheTTL43200 InstanceUpdateParamsCacheTTL = 43200
const InstanceUpdateParamsCacheTTL86400 InstanceUpdateParamsCacheTTL = 86400
const InstanceUpdateParamsCacheTTL172800 InstanceUpdateParamsCacheTTL = 172800
const InstanceUpdateParamsCacheTTL259200 InstanceUpdateParamsCacheTTL = 259200
const InstanceUpdateParamsCacheTTL518400 InstanceUpdateParamsCacheTTL = 518400
Chunk param.Field[bool]Optional

Body param

ChunkOverlap param.Field[int64]Optional

Body param

maximum30
minimum0
ChunkSize param.Field[int64]Optional

Body param

minimum64
CustomMetadata param.Field[[]InstanceUpdateParamsCustomMetadata]Optional

Body param

DataType InstanceUpdateParamsCustomMetadataDataType
One of the following:
const InstanceUpdateParamsCustomMetadataDataTypeText InstanceUpdateParamsCustomMetadataDataType = "text"
const InstanceUpdateParamsCustomMetadataDataTypeNumber InstanceUpdateParamsCustomMetadataDataType = "number"
const InstanceUpdateParamsCustomMetadataDataTypeBoolean InstanceUpdateParamsCustomMetadataDataType = "boolean"
const InstanceUpdateParamsCustomMetadataDataTypeDatetime InstanceUpdateParamsCustomMetadataDataType = "datetime"
FieldName string
maxLength64
minLength1
EmbeddingModel param.Field[string]Optional

Body param

FusionMethod param.Field[InstanceUpdateParamsFusionMethod]Optional

Body param

const InstanceUpdateParamsFusionMethodMax InstanceUpdateParamsFusionMethod = "max"
const InstanceUpdateParamsFusionMethodRrf InstanceUpdateParamsFusionMethod = "rrf"
IndexMethod param.Field[InstanceUpdateParamsIndexMethod]Optional

Body param: Controls which storage backends are used during indexing. Defaults to vector-only.

Keyword bool

Enable keyword (BM25) storage backend.

Vector bool

Enable vector (embedding) storage backend.

IndexingOptions param.Field[InstanceUpdateParamsIndexingOptions]Optional

Body param

KeywordTokenizer InstanceUpdateParamsIndexingOptionsKeywordTokenizerOptional

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.

One of the following:
const InstanceUpdateParamsIndexingOptionsKeywordTokenizerPorter InstanceUpdateParamsIndexingOptionsKeywordTokenizer = "porter"
const InstanceUpdateParamsIndexingOptionsKeywordTokenizerTrigram InstanceUpdateParamsIndexingOptionsKeywordTokenizer = "trigram"
MaxNumResults param.Field[int64]Optional

Body param

maximum50
minimum1
Metadata param.Field[InstanceUpdateParamsMetadata]Optional

Body param

CreatedFromAISearchWizard boolOptional
WorkerDomain stringOptional
Paused param.Field[bool]Optional

Body param

PublicEndpointParams param.Field[InstanceUpdateParamsPublicEndpointParams]Optional

Body param

AuthorizedHosts []stringOptional
ChatCompletionsEndpoint InstanceUpdateParamsPublicEndpointParamsChatCompletionsEndpointOptional
Disabled boolOptional

Disable chat completions endpoint for this public endpoint

CustomDomains []stringOptional

Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).

DefaultDomainEnabled boolOptional

When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.

Enabled boolOptional
Mcp InstanceUpdateParamsPublicEndpointParamsMcpOptional
Description stringOptional
Disabled boolOptional

Disable MCP endpoint for this public endpoint

RateLimit InstanceUpdateParamsPublicEndpointParamsRateLimitOptional
PeriodMs int64Optional
maximum3600000
minimum60000
Requests int64Optional
minimum1
Technique InstanceUpdateParamsPublicEndpointParamsRateLimitTechniqueOptional
One of the following:
const InstanceUpdateParamsPublicEndpointParamsRateLimitTechniqueFixed InstanceUpdateParamsPublicEndpointParamsRateLimitTechnique = "fixed"
const InstanceUpdateParamsPublicEndpointParamsRateLimitTechniqueSliding InstanceUpdateParamsPublicEndpointParamsRateLimitTechnique = "sliding"
SearchEndpoint InstanceUpdateParamsPublicEndpointParamsSearchEndpointOptional
Disabled boolOptional

Disable search endpoint for this public endpoint

Reranking param.Field[bool]Optional

Body param

RerankingModel param.Field[string]Optional

Body param

RetrievalOptions param.Field[InstanceUpdateParamsRetrievalOptions]Optional

Body param

BoostBy []InstanceUpdateParamsRetrievalOptionsBoostByOptional

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.

Field string

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.

maxLength64
minLength1
Direction InstanceUpdateParamsRetrievalOptionsBoostByDirectionOptional

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.

One of the following:
const InstanceUpdateParamsRetrievalOptionsBoostByDirectionAsc InstanceUpdateParamsRetrievalOptionsBoostByDirection = "asc"
const InstanceUpdateParamsRetrievalOptionsBoostByDirectionDesc InstanceUpdateParamsRetrievalOptionsBoostByDirection = "desc"
const InstanceUpdateParamsRetrievalOptionsBoostByDirectionExists InstanceUpdateParamsRetrievalOptionsBoostByDirection = "exists"
const InstanceUpdateParamsRetrievalOptionsBoostByDirectionNotExists InstanceUpdateParamsRetrievalOptionsBoostByDirection = "not_exists"
KeywordMatchMode InstanceUpdateParamsRetrievalOptionsKeywordMatchModeOptional

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. When omitted on an update, the existing stored value is preserved; when never set, search falls back to ‘and’.

One of the following:
const InstanceUpdateParamsRetrievalOptionsKeywordMatchModeAnd InstanceUpdateParamsRetrievalOptionsKeywordMatchMode = "and"
const InstanceUpdateParamsRetrievalOptionsKeywordMatchModeOr InstanceUpdateParamsRetrievalOptionsKeywordMatchMode = "or"
RewriteModel param.Field[string]Optional

Body param: A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.

RewriteQuery param.Field[bool]Optional

Body param

ScoreThreshold param.Field[float64]Optional

Body param

maximum1
minimum0
Source param.Field[string]Optional

Body param

SourceParams param.Field[InstanceUpdateParamsSourceParams]Optional

Body param

ExcludeItems []stringOptional

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). Most accounts are limited to 10 rules; contact support to raise it.

IncludeItems []stringOptional

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). Most accounts are limited to 10 rules; contact support to raise it.

Prefix stringOptional
R2Jurisdiction stringOptional
WebCrawler InstanceUpdateParamsSourceParamsWebCrawlerOptional
DiscoverOptions InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsOptional

Options for parse_type ‘discover’, where Browser Run discovers URLs by link following and sitemaps. Ignored for ‘sitemap’.

Depth float64Optional

Maximum link-follow depth from the seed URL.

maximum100000
minimum1
IncludeSubdomains boolOptional

Follow links to subdomains of the source host.

Limit float64Optional

Maximum number of pages to crawl (1-100000).

maximum100000
minimum1
MaxAge float64Optional

Maximum content age in seconds to accept (0–604800).

maximum604800
minimum0
Source InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsSourceOptional

Where the crawler looks for URLs: ‘sitemaps’ reads sitemap XML only, ‘links’ follows page links only, ‘all’ does both.

One of the following:
const InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsSourceAll InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsSource = "all"
const InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsSourceSitemaps InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsSource = "sitemaps"
const InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsSourceLinks InstanceUpdateParamsSourceParamsWebCrawlerDiscoverOptionsSource = "links"
ParseOptions InstanceUpdateParamsSourceParamsWebCrawlerParseOptionsOptional
ContentSelector []InstanceUpdateParamsSourceParamsWebCrawlerParseOptionsContentSelectorOptional

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.

Path string

Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories.

maxLength200
minLength1
Selector string

CSS selector to extract content from pages matching the path pattern. Must not contain disallowed characters (;, `, $, {, }, ). Must target a single element; if multiple elements match, the selector is ignored and the full page is used.

maxLength200
minLength1
IncludeHeaders map[string, string]Optional

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).

IncludeImages boolOptional
SpecificSitemaps []stringOptional

List of specific sitemap URLs to use for crawling. Only valid when parse_type is ‘sitemap’.

UseBrowserRendering boolOptional
ParseType InstanceUpdateParamsSourceParamsWebCrawlerParseTypeOptional

How URLs are discovered. ‘sitemap’ reads XML sitemaps; ‘discover’ follows links recursively and requires the source to be a Verified zone on this account.

One of the following:
const InstanceUpdateParamsSourceParamsWebCrawlerParseTypeSitemap InstanceUpdateParamsSourceParamsWebCrawlerParseType = "sitemap"
const InstanceUpdateParamsSourceParamsWebCrawlerParseTypeDiscover InstanceUpdateParamsSourceParamsWebCrawlerParseType = "discover"
Summarization param.Field[bool]Optional

Body param

SummarizationModel param.Field[string]Optional

Body param

SyncInterval param.Field[InstanceUpdateParamsSyncInterval]Optional

Body param: Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h).

const InstanceUpdateParamsSyncInterval900 InstanceUpdateParamsSyncInterval = 900
const InstanceUpdateParamsSyncInterval1800 InstanceUpdateParamsSyncInterval = 1800
const InstanceUpdateParamsSyncInterval3600 InstanceUpdateParamsSyncInterval = 3600
const InstanceUpdateParamsSyncInterval7200 InstanceUpdateParamsSyncInterval = 7200
const InstanceUpdateParamsSyncInterval14400 InstanceUpdateParamsSyncInterval = 14400
const InstanceUpdateParamsSyncInterval21600 InstanceUpdateParamsSyncInterval = 21600
const InstanceUpdateParamsSyncInterval43200 InstanceUpdateParamsSyncInterval = 43200
const InstanceUpdateParamsSyncInterval86400 InstanceUpdateParamsSyncInterval = 86400
SystemPromptIndexSummarization param.Field[string]Optional

Body param

SystemPromptRewriteQuery param.Field[string]Optional

Body param

TokenID param.Field[string]Optional

Body param

formatuuid
ReturnsExpand Collapse
type InstanceUpdateResponse struct{…}
ID string

AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.

maxLength64
minLength1
CreatedAt Time
formatdate-time
ModifiedAt Time
formatdate-time
AIGatewayID stringOptional
AISearchModel stringOptional

A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.

Cache boolOptional
CacheThreshold InstanceUpdateResponseCacheThresholdOptional
One of the following:
const InstanceUpdateResponseCacheThresholdSuperStrictMatch InstanceUpdateResponseCacheThreshold = "super_strict_match"
const InstanceUpdateResponseCacheThresholdCloseEnough InstanceUpdateResponseCacheThreshold = "close_enough"
const InstanceUpdateResponseCacheThresholdFlexibleFriend InstanceUpdateResponseCacheThreshold = "flexible_friend"
const InstanceUpdateResponseCacheThresholdAnythingGoes InstanceUpdateResponseCacheThreshold = "anything_goes"
CacheTTL InstanceUpdateResponseCacheTTLOptional

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).

One of the following:
const InstanceUpdateResponseCacheTTL600 InstanceUpdateResponseCacheTTL = 600
const InstanceUpdateResponseCacheTTL1800 InstanceUpdateResponseCacheTTL = 1800
const InstanceUpdateResponseCacheTTL3600 InstanceUpdateResponseCacheTTL = 3600
const InstanceUpdateResponseCacheTTL7200 InstanceUpdateResponseCacheTTL = 7200
const InstanceUpdateResponseCacheTTL21600 InstanceUpdateResponseCacheTTL = 21600
const InstanceUpdateResponseCacheTTL43200 InstanceUpdateResponseCacheTTL = 43200
const InstanceUpdateResponseCacheTTL86400 InstanceUpdateResponseCacheTTL = 86400
const InstanceUpdateResponseCacheTTL172800 InstanceUpdateResponseCacheTTL = 172800
const InstanceUpdateResponseCacheTTL259200 InstanceUpdateResponseCacheTTL = 259200
const InstanceUpdateResponseCacheTTL518400 InstanceUpdateResponseCacheTTL = 518400
ChunkOverlap int64Optional
maximum30
minimum0
ChunkSize int64Optional
minimum64
CreatedBy stringOptional
CustomMetadata []InstanceUpdateResponseCustomMetadataOptional
DataType InstanceUpdateResponseCustomMetadataDataType
One of the following:
const InstanceUpdateResponseCustomMetadataDataTypeText InstanceUpdateResponseCustomMetadataDataType = "text"
const InstanceUpdateResponseCustomMetadataDataTypeNumber InstanceUpdateResponseCustomMetadataDataType = "number"
const InstanceUpdateResponseCustomMetadataDataTypeBoolean InstanceUpdateResponseCustomMetadataDataType = "boolean"
const InstanceUpdateResponseCustomMetadataDataTypeDatetime InstanceUpdateResponseCustomMetadataDataType = "datetime"
FieldName string
maxLength64
minLength1
EmbeddingModel stringOptional
Enable boolOptional
EngineVersion float64Optional
FusionMethod InstanceUpdateResponseFusionMethodOptional
One of the following:
const InstanceUpdateResponseFusionMethodMax InstanceUpdateResponseFusionMethod = "max"
const InstanceUpdateResponseFusionMethodRrf InstanceUpdateResponseFusionMethod = "rrf"
DeprecatedHybridSearchEnabled boolOptional

Deprecated — use index_method instead.

IndexMethod InstanceUpdateResponseIndexMethodOptional

Controls which storage backends are used during indexing. Defaults to vector-only.

Keyword bool

Enable keyword (BM25) storage backend.

Vector bool

Enable vector (embedding) storage backend.

IndexingOptions InstanceUpdateResponseIndexingOptionsOptional
KeywordTokenizer InstanceUpdateResponseIndexingOptionsKeywordTokenizerOptional

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.

One of the following:
const InstanceUpdateResponseIndexingOptionsKeywordTokenizerPorter InstanceUpdateResponseIndexingOptionsKeywordTokenizer = "porter"
const InstanceUpdateResponseIndexingOptionsKeywordTokenizerTrigram InstanceUpdateResponseIndexingOptionsKeywordTokenizer = "trigram"
LastActivity TimeOptional
formatdate-time
MaxNumResults int64Optional
maximum50
minimum1
Metadata InstanceUpdateResponseMetadataOptional
CreatedFromAISearchWizard boolOptional
WorkerDomain stringOptional
ModifiedBy stringOptional
Namespace stringOptional
Paused boolOptional
PublicEndpointID stringOptional
PublicEndpointParams InstanceUpdateResponsePublicEndpointParamsOptional
AuthorizedHosts []stringOptional
ChatCompletionsEndpoint InstanceUpdateResponsePublicEndpointParamsChatCompletionsEndpointOptional
Disabled boolOptional

Disable chat completions endpoint for this public endpoint

CustomDomains []stringOptional

Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).

DefaultDomainEnabled boolOptional

When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.

Enabled boolOptional
Mcp InstanceUpdateResponsePublicEndpointParamsMcpOptional
Description stringOptional
Disabled boolOptional

Disable MCP endpoint for this public endpoint

RateLimit InstanceUpdateResponsePublicEndpointParamsRateLimitOptional
PeriodMs int64Optional
maximum3600000
minimum60000
Requests int64Optional
minimum1
Technique InstanceUpdateResponsePublicEndpointParamsRateLimitTechniqueOptional
One of the following:
const InstanceUpdateResponsePublicEndpointParamsRateLimitTechniqueFixed InstanceUpdateResponsePublicEndpointParamsRateLimitTechnique = "fixed"
const InstanceUpdateResponsePublicEndpointParamsRateLimitTechniqueSliding InstanceUpdateResponsePublicEndpointParamsRateLimitTechnique = "sliding"
SearchEndpoint InstanceUpdateResponsePublicEndpointParamsSearchEndpointOptional
Disabled boolOptional

Disable search endpoint for this public endpoint

Reranking boolOptional
RerankingModel stringOptional
RetrievalOptions InstanceUpdateResponseRetrievalOptionsOptional
BoostBy []InstanceUpdateResponseRetrievalOptionsBoostByOptional

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.

Field string

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.

maxLength64
minLength1
Direction InstanceUpdateResponseRetrievalOptionsBoostByDirectionOptional

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.

One of the following:
const InstanceUpdateResponseRetrievalOptionsBoostByDirectionAsc InstanceUpdateResponseRetrievalOptionsBoostByDirection = "asc"
const InstanceUpdateResponseRetrievalOptionsBoostByDirectionDesc InstanceUpdateResponseRetrievalOptionsBoostByDirection = "desc"
const InstanceUpdateResponseRetrievalOptionsBoostByDirectionExists InstanceUpdateResponseRetrievalOptionsBoostByDirection = "exists"
const InstanceUpdateResponseRetrievalOptionsBoostByDirectionNotExists InstanceUpdateResponseRetrievalOptionsBoostByDirection = "not_exists"
KeywordMatchMode InstanceUpdateResponseRetrievalOptionsKeywordMatchModeOptional

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. When omitted on an update, the existing stored value is preserved; when never set, search falls back to ‘and’.

One of the following:
const InstanceUpdateResponseRetrievalOptionsKeywordMatchModeAnd InstanceUpdateResponseRetrievalOptionsKeywordMatchMode = "and"
const InstanceUpdateResponseRetrievalOptionsKeywordMatchModeOr InstanceUpdateResponseRetrievalOptionsKeywordMatchMode = "or"
RewriteModel stringOptional

A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.

RewriteQuery boolOptional
ScoreThreshold float64Optional
maximum1
minimum0
Source stringOptional
SourceParams InstanceUpdateResponseSourceParamsOptional
ExcludeItems []stringOptional

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). Most accounts are limited to 10 rules; contact support to raise it.

IncludeItems []stringOptional

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). Most accounts are limited to 10 rules; contact support to raise it.

Prefix stringOptional
R2Jurisdiction stringOptional
WebCrawler InstanceUpdateResponseSourceParamsWebCrawlerOptional
DiscoverOptions InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsOptional

Options for parse_type ‘discover’, where Browser Run discovers URLs by link following and sitemaps. Ignored for ‘sitemap’.

Depth float64Optional

Maximum link-follow depth from the seed URL.

maximum100000
minimum1
IncludeSubdomains boolOptional

Follow links to subdomains of the source host.

Limit float64Optional

Maximum number of pages to crawl (1-100000).

maximum100000
minimum1
MaxAge float64Optional

Maximum content age in seconds to accept (0–604800).

maximum604800
minimum0
Source InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsSourceOptional

Where the crawler looks for URLs: ‘sitemaps’ reads sitemap XML only, ‘links’ follows page links only, ‘all’ does both.

One of the following:
const InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsSourceAll InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsSource = "all"
const InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsSourceSitemaps InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsSource = "sitemaps"
const InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsSourceLinks InstanceUpdateResponseSourceParamsWebCrawlerDiscoverOptionsSource = "links"
ParseOptions InstanceUpdateResponseSourceParamsWebCrawlerParseOptionsOptional
ContentSelector []InstanceUpdateResponseSourceParamsWebCrawlerParseOptionsContentSelectorOptional

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.

Path string

Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories.

maxLength200
minLength1
Selector string

CSS selector to extract content from pages matching the path pattern. Must not contain disallowed characters (;, `, $, {, }, ). Must target a single element; if multiple elements match, the selector is ignored and the full page is used.

maxLength200
minLength1
IncludeHeaders map[string, string]Optional

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).

IncludeImages boolOptional
SpecificSitemaps []stringOptional

List of specific sitemap URLs to use for crawling. Only valid when parse_type is ‘sitemap’.

UseBrowserRendering boolOptional
ParseType InstanceUpdateResponseSourceParamsWebCrawlerParseTypeOptional

How URLs are discovered. ‘sitemap’ reads XML sitemaps; ‘discover’ follows links recursively and requires the source to be a Verified zone on this account.

One of the following:
const InstanceUpdateResponseSourceParamsWebCrawlerParseTypeSitemap InstanceUpdateResponseSourceParamsWebCrawlerParseType = "sitemap"
const InstanceUpdateResponseSourceParamsWebCrawlerParseTypeDiscover InstanceUpdateResponseSourceParamsWebCrawlerParseType = "discover"
Status stringOptional
SyncInterval InstanceUpdateResponseSyncIntervalOptional

Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h).

One of the following:
const InstanceUpdateResponseSyncInterval900 InstanceUpdateResponseSyncInterval = 900
const InstanceUpdateResponseSyncInterval1800 InstanceUpdateResponseSyncInterval = 1800
const InstanceUpdateResponseSyncInterval3600 InstanceUpdateResponseSyncInterval = 3600
const InstanceUpdateResponseSyncInterval7200 InstanceUpdateResponseSyncInterval = 7200
const InstanceUpdateResponseSyncInterval14400 InstanceUpdateResponseSyncInterval = 14400
const InstanceUpdateResponseSyncInterval21600 InstanceUpdateResponseSyncInterval = 21600
const InstanceUpdateResponseSyncInterval43200 InstanceUpdateResponseSyncInterval = 43200
const InstanceUpdateResponseSyncInterval86400 InstanceUpdateResponseSyncInterval = 86400
TokenID stringOptional
formatuuid
Type InstanceUpdateResponseTypeOptional
One of the following:
const InstanceUpdateResponseTypeR2 InstanceUpdateResponseType = "r2"
const InstanceUpdateResponseTypeWebCrawler InstanceUpdateResponseType = "web-crawler"

Update an AI Search instance.

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"
    },
    "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"
    },
    "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
}