# AI Search # Instances ## List instances. `client.aiSearch.instances.list(InstanceListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-search/instances` List instances. ### Parameters - `params: InstanceListParams` - `account_id: string` Path param - `namespace?: string | null` Query param - `order_by?: "created_at"` Query param: Order By Column Name - `"created_at"` - `order_by_direction?: "asc" | "desc"` Query param: Order By Direction - `"asc"` - `"desc"` - `page?: number` Query param - `per_page?: number` Query param - `search?: string` Query param: Search by id ### Returns - `InstanceListResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const instanceListResponse of client.aiSearch.instances.list({ account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', })) { console.log(instanceListResponse.id); } ``` #### Response ```json { "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", "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, "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": "x", "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": { "crawl_options": { "depth": 1, "include_external_links": true, "include_subdomains": true, "max_age": 0, "source": "all" }, "parse_options": { "content_selector": [ { "path": "**/blog/**", "selector": "article .post-body" } ], "include_headers": { "foo": "string" }, "include_images": true, "specific_sitemaps": [ "https://example.com/sitemap.xml", "https://example.com/blog-sitemap.xml" ], "use_browser_rendering": true }, "parse_type": "sitemap", "store_options": { "storage_id": "storage_id", "r2_jurisdiction": "r2_jurisdiction", "storage_type": "r2" } } }, "status": "status", "token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "type": "r2" } ], "success": true } ``` ## Create new instances. `client.aiSearch.instances.create(InstanceCreateParamsparams, RequestOptionsoptions?): InstanceCreateResponse` **post** `/accounts/{account_id}/ai-search/instances` Create a new instances. ### Parameters - `params: InstanceCreateParams` - `account_id: string` Path param - `id: string` Body param: AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `ai_gateway_id?: string | null` Body param - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` Body param - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` Body param - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` Body param - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk?: boolean` Body param - `chunk_overlap?: number` Body param - `chunk_size?: number` Body param - `custom_metadata?: Array` Body param - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` Body param - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `fusion_method?: "max" | "rrf"` Body param - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` Body param - `indexing_options?: IndexingOptions | null` Body param - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `max_num_results?: number` Body param - `metadata?: Metadata` Body param - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `public_endpoint_params?: PublicEndpointParams` Body param - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` Body param - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` Body param - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` Body param - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` Body param - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` Body param - `score_threshold?: number` Body param - `source?: string | null` Body param - `source_params?: SourceParams | null` Body param - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `token_id?: string` Body param - `type?: "r2" | "web-crawler" | null` Body param - `"r2"` - `"web-crawler"` ### Returns - `InstanceCreateResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const instance = await client.aiSearch.instances.create({ account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', id: 'my-ai-search', }); console.log(instance.id); ``` #### Response ```json { "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", "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, "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": "x", "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": { "crawl_options": { "depth": 1, "include_external_links": true, "include_subdomains": true, "max_age": 0, "source": "all" }, "parse_options": { "content_selector": [ { "path": "**/blog/**", "selector": "article .post-body" } ], "include_headers": { "foo": "string" }, "include_images": true, "specific_sitemaps": [ "https://example.com/sitemap.xml", "https://example.com/blog-sitemap.xml" ], "use_browser_rendering": true }, "parse_type": "sitemap", "store_options": { "storage_id": "storage_id", "r2_jurisdiction": "r2_jurisdiction", "storage_type": "r2" } } }, "status": "status", "token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "type": "r2" }, "success": true } ``` ## Read instances. `client.aiSearch.instances.read(stringid, InstanceReadParamsparams, RequestOptionsoptions?): InstanceReadResponse` **get** `/accounts/{account_id}/ai-search/instances/{id}` Read instances. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: InstanceReadParams` - `account_id: string` ### Returns - `InstanceReadResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiSearch.instances.read('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(response.id); ``` #### Response ```json { "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", "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, "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": "x", "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": { "crawl_options": { "depth": 1, "include_external_links": true, "include_subdomains": true, "max_age": 0, "source": "all" }, "parse_options": { "content_selector": [ { "path": "**/blog/**", "selector": "article .post-body" } ], "include_headers": { "foo": "string" }, "include_images": true, "specific_sitemaps": [ "https://example.com/sitemap.xml", "https://example.com/blog-sitemap.xml" ], "use_browser_rendering": true }, "parse_type": "sitemap", "store_options": { "storage_id": "storage_id", "r2_jurisdiction": "r2_jurisdiction", "storage_type": "r2" } } }, "status": "status", "token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "type": "r2" }, "success": true } ``` ## Update instances. `client.aiSearch.instances.update(stringid, InstanceUpdateParamsparams, RequestOptionsoptions?): InstanceUpdateResponse` **put** `/accounts/{account_id}/ai-search/instances/{id}` Update instances. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: InstanceUpdateParams` - `account_id: string` Path param - `ai_gateway_id?: string | null` Body param - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` Body param - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` Body param - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` Body param - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk?: boolean` Body param - `chunk_overlap?: number` Body param - `chunk_size?: number` Body param - `custom_metadata?: Array` Body param - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` Body param - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `fusion_method?: "max" | "rrf"` Body param - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` Body param - `indexing_options?: IndexingOptions | null` Body param - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `max_num_results?: number` Body param - `metadata?: Metadata` Body param - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `paused?: boolean` Body param - `public_endpoint_params?: PublicEndpointParams` Body param - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` Body param - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` Body param - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` Body param - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` Body param - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` Body param - `score_threshold?: number` Body param - `source_params?: SourceParams | null` Body param - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `summarization?: boolean` Body param - `summarization_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` Body param - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `system_prompt_ai_search?: string | null` Body param - `system_prompt_index_summarization?: string | null` Body param - `system_prompt_rewrite_query?: string | null` Body param - `token_id?: string` Body param ### Returns - `InstanceUpdateResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const instance = await client.aiSearch.instances.update('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(instance.id); ``` #### Response ```json { "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", "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, "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": "x", "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": { "crawl_options": { "depth": 1, "include_external_links": true, "include_subdomains": true, "max_age": 0, "source": "all" }, "parse_options": { "content_selector": [ { "path": "**/blog/**", "selector": "article .post-body" } ], "include_headers": { "foo": "string" }, "include_images": true, "specific_sitemaps": [ "https://example.com/sitemap.xml", "https://example.com/blog-sitemap.xml" ], "use_browser_rendering": true }, "parse_type": "sitemap", "store_options": { "storage_id": "storage_id", "r2_jurisdiction": "r2_jurisdiction", "storage_type": "r2" } } }, "status": "status", "token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "type": "r2" }, "success": true } ``` ## Delete instances. `client.aiSearch.instances.delete(stringid, InstanceDeleteParamsparams, RequestOptionsoptions?): InstanceDeleteResponse` **delete** `/accounts/{account_id}/ai-search/instances/{id}` Delete instances. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: InstanceDeleteParams` - `account_id: string` ### Returns - `InstanceDeleteResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const instance = await client.aiSearch.instances.delete('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(instance.id); ``` #### Response ```json { "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", "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, "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": "x", "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": { "crawl_options": { "depth": 1, "include_external_links": true, "include_subdomains": true, "max_age": 0, "source": "all" }, "parse_options": { "content_selector": [ { "path": "**/blog/**", "selector": "article .post-body" } ], "include_headers": { "foo": "string" }, "include_images": true, "specific_sitemaps": [ "https://example.com/sitemap.xml", "https://example.com/blog-sitemap.xml" ], "use_browser_rendering": true }, "parse_type": "sitemap", "store_options": { "storage_id": "storage_id", "r2_jurisdiction": "r2_jurisdiction", "storage_type": "r2" } } }, "status": "status", "token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "type": "r2" }, "success": true } ``` ## Stats `client.aiSearch.instances.stats(stringid, InstanceStatsParamsparams, RequestOptionsoptions?): InstanceStatsResponse` **get** `/accounts/{account_id}/ai-search/instances/{id}/stats` Retrieves usage statistics for AI Search instances. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: InstanceStatsParams` - `account_id: string` ### Returns - `InstanceStatsResponse` - `completed?: number` - `error?: number` - `file_embed_errors?: Record` - `index_source_errors?: Record` - `last_activity?: string` - `outdated?: number` - `queued?: number` - `running?: number` - `skipped?: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiSearch.instances.stats('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(response.completed); ``` #### Response ```json { "result": { "completed": 0, "error": 0, "file_embed_errors": { "foo": "bar" }, "index_source_errors": { "foo": "bar" }, "last_activity": "2019-12-27T18:11:19.117Z", "outdated": 0, "queued": 0, "running": 0, "skipped": 0 }, "success": true } ``` ## Search `client.aiSearch.instances.search(stringid, InstanceSearchParamsparams, RequestOptionsoptions?): InstanceSearchResponse` **post** `/accounts/{account_id}/ai-search/instances/{id}/search` Executes a semantic search query against an AI Search instance to find relevant indexed content. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: InstanceSearchParams` - `account_id: string` Path param - `messages: Array` Body param - `content: string | null` - `role: "system" | "developer" | "user" | 2 more` - `"system"` - `"developer"` - `"user"` - `"assistant"` - `"tool"` - `ai_search_options?: AISearchOptions` Body param - `cache?: Cache` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `enabled?: boolean` - `query_rewrite?: QueryRewrite` - `enabled?: boolean` - `model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_prompt?: string` - `reranking?: Reranking` - `enabled?: boolean` - `match_threshold?: number` - `model?: "@cf/baai/bge-reranker-base" | ""` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval?: Retrieval` - `boost_by?: Array` Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, '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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `context_expansion?: number` - `filters?: Record` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `match_threshold?: number` - `max_num_results?: number` - `retrieval_type?: "vector" | "keyword" | "hybrid"` - `"vector"` - `"keyword"` - `"hybrid"` - `return_on_failure?: boolean` ### Returns - `InstanceSearchResponse` - `chunks: Array` - `id: string` - `score: number` - `text: string` - `type: string` - `item?: Item` - `key: string` - `metadata?: Record` - `timestamp?: number` - `scoring_details?: ScoringDetails` - `fusion_method?: "rrf" | "max"` - `"rrf"` - `"max"` - `keyword_rank?: number` - `keyword_score?: number` - `reranking_score?: number` - `vector_rank?: number` - `vector_score?: number` - `search_query: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiSearch.instances.search('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', messages: [{ content: 'content', role: 'system' }], }); console.log(response.chunks); ``` #### Response ```json { "result": { "chunks": [ { "id": "id", "score": 0, "text": "text", "type": "type", "item": { "key": "key", "metadata": { "foo": "bar" }, "timestamp": 0 }, "scoring_details": { "fusion_method": "rrf", "keyword_rank": 0, "keyword_score": 0, "reranking_score": 0, "vector_rank": 0, "vector_score": 0 } } ], "search_query": "search_query" }, "success": true } ``` ## Chat Completions `client.aiSearch.instances.chatCompletions(stringid, InstanceChatCompletionsParamsparams, RequestOptionsoptions?): InstanceChatCompletionsResponse` **post** `/accounts/{account_id}/ai-search/instances/{id}/chat/completions` Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: InstanceChatCompletionsParams` - `account_id: string` Path param - `messages: Array` Body param - `content: string | null` - `role: "system" | "developer" | "user" | 2 more` - `"system"` - `"developer"` - `"user"` - `"assistant"` - `"tool"` - `ai_search_options?: AISearchOptions` Body param - `cache?: Cache` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `enabled?: boolean` - `query_rewrite?: QueryRewrite` - `enabled?: boolean` - `model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_prompt?: string` - `reranking?: Reranking` - `enabled?: boolean` - `match_threshold?: number` - `model?: "@cf/baai/bge-reranker-base" | ""` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval?: Retrieval` - `boost_by?: Array` Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, '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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `context_expansion?: number` - `filters?: Record` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `match_threshold?: number` - `max_num_results?: number` - `retrieval_type?: "vector" | "keyword" | "hybrid"` - `"vector"` - `"keyword"` - `"hybrid"` - `return_on_failure?: boolean` - `model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more` Body param - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `stream?: boolean` Body param ### Returns - `InstanceChatCompletionsResponse` - `choices: Array` - `message: Message` - `content: string | null` - `role: "system" | "developer" | "user" | 2 more` - `"system"` - `"developer"` - `"user"` - `"assistant"` - `"tool"` - `index?: number` - `chunks: Array` - `id: string` - `score: number` - `text: string` - `type: string` - `item?: Item` - `key: string` - `metadata?: Record` - `timestamp?: number` - `scoring_details?: ScoringDetails` - `fusion_method?: "rrf" | "max"` - `"rrf"` - `"max"` - `keyword_rank?: number` - `keyword_score?: number` - `reranking_score?: number` - `vector_rank?: number` - `vector_score?: number` - `id?: string` - `model?: string` - `object?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiSearch.instances.chatCompletions('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', messages: [{ content: 'content', role: 'system' }], }); console.log(response.id); ``` #### Response ```json { "choices": [ { "message": { "content": "content", "role": "system" }, "index": 0 } ], "chunks": [ { "id": "id", "score": 0, "text": "text", "type": "type", "item": { "key": "key", "metadata": { "foo": "bar" }, "timestamp": 0 }, "scoring_details": { "fusion_method": "rrf", "keyword_rank": 0, "keyword_score": 0, "reranking_score": 0, "vector_rank": 0, "vector_score": 0 } } ], "id": "id", "model": "model", "object": "object" } ``` ## Domain Types ### Instance List Response - `InstanceListResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Instance Create Response - `InstanceCreateResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Instance Read Response - `InstanceReadResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Instance Update Response - `InstanceUpdateResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Instance Delete Response - `InstanceDeleteResponse` - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `created_at: string` - `modified_at: string` - `ai_gateway_id?: string | null` - `ai_search_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `cache?: boolean` - `cache_threshold?: "super_strict_match" | "close_enough" | "flexible_friend" | "anything_goes"` - `"super_strict_match"` - `"close_enough"` - `"flexible_friend"` - `"anything_goes"` - `chunk_overlap?: number` - `chunk_size?: number` - `created_by?: string | null` - `custom_metadata?: Array` - `data_type: "text" | "number" | "boolean" | "datetime"` - `"text"` - `"number"` - `"boolean"` - `"datetime"` - `field_name: string` - `embedding_model?: "@cf/qwen/qwen3-embedding-0.6b" | "@cf/baai/bge-m3" | "@cf/baai/bge-large-en-v1.5" | 6 more | null` - `"@cf/qwen/qwen3-embedding-0.6b"` - `"@cf/baai/bge-m3"` - `"@cf/baai/bge-large-en-v1.5"` - `"@cf/google/embeddinggemma-300m"` - `"google-ai-studio/gemini-embedding-001"` - `"google-ai-studio/gemini-embedding-2-preview"` - `"openai/text-embedding-3-small"` - `"openai/text-embedding-3-large"` - `""` - `enable?: boolean` - `engine_version?: number` - `fusion_method?: "max" | "rrf"` - `"max"` - `"rrf"` - `hybrid_search_enabled?: boolean` - `indexing_options?: IndexingOptions | null` - `keyword_tokenizer?: "porter" | "trigram"` 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. - `"porter"` - `"trigram"` - `last_activity?: string | null` - `max_num_results?: number` - `metadata?: Metadata` - `created_from_aisearch_wizard?: boolean` - `worker_domain?: string` - `modified_by?: string | null` - `namespace?: string | null` - `paused?: boolean` - `public_endpoint_id?: string | null` - `public_endpoint_params?: PublicEndpointParams` - `authorized_hosts?: Array` - `chat_completions_endpoint?: ChatCompletionsEndpoint` - `disabled?: boolean` Disable chat completions endpoint for this public endpoint - `enabled?: boolean` - `mcp?: Mcp` - `description?: string` - `disabled?: boolean` Disable MCP endpoint for this public endpoint - `rate_limit?: RateLimit` - `period_ms?: number` - `requests?: number` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `search_endpoint?: SearchEndpoint` - `disabled?: boolean` Disable search endpoint for this public endpoint - `reranking?: boolean` - `reranking_model?: "@cf/baai/bge-reranker-base" | "" | null` - `"@cf/baai/bge-reranker-base"` - `""` - `retrieval_options?: RetrievalOptions | null` - `boost_by?: Array` Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric 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 asc/desc directions; text/boolean fields support exists/not_exists. - `direction?: "asc" | "desc" | "exists" | "not_exists"` 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. - `"asc"` - `"desc"` - `"exists"` - `"not_exists"` - `keyword_match_mode?: "and" | "or"` 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'. Legacy values 'exact_match' and 'fuzzy_match' are accepted and map to 'and' and 'or' respectively. - `"and"` - `"or"` - `rewrite_model?: "@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "@cf/zai-org/glm-4.7-flash" | "@cf/meta/llama-3.1-8b-instruct-fast" | 25 more | null` - `"@cf/meta/llama-3.3-70b-instruct-fp8-fast"` - `"@cf/zai-org/glm-4.7-flash"` - `"@cf/meta/llama-3.1-8b-instruct-fast"` - `"@cf/meta/llama-3.1-8b-instruct-fp8"` - `"@cf/meta/llama-4-scout-17b-16e-instruct"` - `"@cf/qwen/qwen3-30b-a3b-fp8"` - `"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"` - `"@cf/moonshotai/kimi-k2-instruct"` - `"@cf/google/gemma-3-12b-it"` - `"anthropic/claude-3-7-sonnet"` - `"anthropic/claude-sonnet-4"` - `"anthropic/claude-opus-4"` - `"anthropic/claude-3-5-haiku"` - `"cerebras/qwen-3-235b-a22b-instruct"` - `"cerebras/qwen-3-235b-a22b-thinking"` - `"cerebras/llama-3.3-70b"` - `"cerebras/llama-4-maverick-17b-128e-instruct"` - `"cerebras/llama-4-scout-17b-16e-instruct"` - `"cerebras/gpt-oss-120b"` - `"google-ai-studio/gemini-2.5-flash"` - `"google-ai-studio/gemini-2.5-pro"` - `"grok/grok-4"` - `"groq/llama-3.3-70b-versatile"` - `"groq/llama-3.1-8b-instant"` - `"openai/gpt-5"` - `"openai/gpt-5-mini"` - `"openai/gpt-5-nano"` - `""` - `rewrite_query?: boolean` - `score_threshold?: number` - `source?: string | null` - `source_params?: SourceParams | null` - `exclude_items?: Array` 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) - `include_items?: Array` 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) - `prefix?: string` - `r2_jurisdiction?: string` - `web_crawler?: WebCrawler` - `crawl_options?: CrawlOptions` - `depth?: number` - `include_external_links?: boolean` - `include_subdomains?: boolean` - `max_age?: number` - `source?: "all" | "sitemaps" | "links"` - `"all"` - `"sitemaps"` - `"links"` - `parse_options?: ParseOptions` - `content_selector?: Array` 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. - `path: string` Glob pattern to match against the page URL path. Uses standard glob syntax: * matches within a segment, ** crosses directories. - `selector: string` CSS selector to extract content from pages matching the path pattern. Supports standard CSS selectors including class, ID, element, and attribute selectors. - `include_headers?: Record` - `include_images?: boolean` - `specific_sitemaps?: Array` List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'. - `use_browser_rendering?: boolean` - `parse_type?: "sitemap" | "feed-rss" | "crawl"` - `"sitemap"` - `"feed-rss"` - `"crawl"` - `store_options?: StoreOptions` - `storage_id: string` - `r2_jurisdiction?: string` - `storage_type?: Provider` - `"r2"` - `status?: string` - `token_id?: string` - `type?: "r2" | "web-crawler" | null` - `"r2"` - `"web-crawler"` ### Instance Stats Response - `InstanceStatsResponse` - `completed?: number` - `error?: number` - `file_embed_errors?: Record` - `index_source_errors?: Record` - `last_activity?: string` - `outdated?: number` - `queued?: number` - `running?: number` - `skipped?: number` ### Instance Search Response - `InstanceSearchResponse` - `chunks: Array` - `id: string` - `score: number` - `text: string` - `type: string` - `item?: Item` - `key: string` - `metadata?: Record` - `timestamp?: number` - `scoring_details?: ScoringDetails` - `fusion_method?: "rrf" | "max"` - `"rrf"` - `"max"` - `keyword_rank?: number` - `keyword_score?: number` - `reranking_score?: number` - `vector_rank?: number` - `vector_score?: number` - `search_query: string` ### Instance Chat Completions Response - `InstanceChatCompletionsResponse` - `choices: Array` - `message: Message` - `content: string | null` - `role: "system" | "developer" | "user" | 2 more` - `"system"` - `"developer"` - `"user"` - `"assistant"` - `"tool"` - `index?: number` - `chunks: Array` - `id: string` - `score: number` - `text: string` - `type: string` - `item?: Item` - `key: string` - `metadata?: Record` - `timestamp?: number` - `scoring_details?: ScoringDetails` - `fusion_method?: "rrf" | "max"` - `"rrf"` - `"max"` - `keyword_rank?: number` - `keyword_score?: number` - `reranking_score?: number` - `vector_rank?: number` - `vector_score?: number` - `id?: string` - `model?: string` - `object?: string` # Items # Jobs ## List Jobs `client.aiSearch.instances.jobs.list(stringid, JobListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-search/instances/{id}/jobs` Lists indexing jobs for an AI Search instance. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: JobListParams` - `account_id: string` Path param - `page?: number` Query param - `per_page?: number` Query param ### Returns - `JobListResponse` - `id: string` - `source: "user" | "schedule"` - `"user"` - `"schedule"` - `description?: string` - `end_reason?: string` - `ended_at?: string` - `last_seen_at?: string` - `started_at?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const jobListResponse of client.aiSearch.instances.jobs.list('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', })) { console.log(jobListResponse.id); } ``` #### Response ```json { "result": [ { "id": "id", "source": "user", "description": "description", "end_reason": "end_reason", "ended_at": "ended_at", "last_seen_at": "last_seen_at", "started_at": "started_at" } ], "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` ## Create new job `client.aiSearch.instances.jobs.create(stringid, JobCreateParamsparams, RequestOptionsoptions?): JobCreateResponse` **post** `/accounts/{account_id}/ai-search/instances/{id}/jobs` Creates a new indexing job for an AI Search instance. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `params: JobCreateParams` - `account_id: string` Path param - `description?: string` Body param ### Returns - `JobCreateResponse` - `id: string` - `source: "user" | "schedule"` - `"user"` - `"schedule"` - `description?: string` - `end_reason?: string` - `ended_at?: string` - `last_seen_at?: string` - `started_at?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const job = await client.aiSearch.instances.jobs.create('my-ai-search', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(job.id); ``` #### Response ```json { "result": { "id": "id", "source": "user", "description": "description", "end_reason": "end_reason", "ended_at": "ended_at", "last_seen_at": "last_seen_at", "started_at": "started_at" }, "success": true } ``` ## Get a Job Details `client.aiSearch.instances.jobs.get(stringid, stringjobId, JobGetParamsparams, RequestOptionsoptions?): JobGetResponse` **get** `/accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}` Retrieves details for a specific AI Search indexing job. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `jobId: string` - `params: JobGetParams` - `account_id: string` ### Returns - `JobGetResponse` - `id: string` - `source: "user" | "schedule"` - `"user"` - `"schedule"` - `description?: string` - `end_reason?: string` - `ended_at?: string` - `last_seen_at?: string` - `started_at?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const job = await client.aiSearch.instances.jobs.get('my-ai-search', 'job_id', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(job.id); ``` #### Response ```json { "result": { "id": "id", "source": "user", "description": "description", "end_reason": "end_reason", "ended_at": "ended_at", "last_seen_at": "last_seen_at", "started_at": "started_at" }, "success": true } ``` ## List Job Logs `client.aiSearch.instances.jobs.logs(stringid, stringjobId, JobLogsParamsparams, RequestOptionsoptions?): JobLogsResponse` **get** `/accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}/logs` Lists log entries for an AI Search indexing job. ### Parameters - `id: string` AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores. - `jobId: string` - `params: JobLogsParams` - `account_id: string` Path param - `page?: number` Query param - `per_page?: number` Query param ### Returns - `JobLogsResponse = Array` - `id: number` - `created_at: number` - `message: string` - `message_type: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiSearch.instances.jobs.logs('my-ai-search', 'job_id', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(response); ``` #### Response ```json { "result": [ { "id": 0, "created_at": 0, "message": "message", "message_type": 0 } ], "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` ## Domain Types ### Job List Response - `JobListResponse` - `id: string` - `source: "user" | "schedule"` - `"user"` - `"schedule"` - `description?: string` - `end_reason?: string` - `ended_at?: string` - `last_seen_at?: string` - `started_at?: string` ### Job Create Response - `JobCreateResponse` - `id: string` - `source: "user" | "schedule"` - `"user"` - `"schedule"` - `description?: string` - `end_reason?: string` - `ended_at?: string` - `last_seen_at?: string` - `started_at?: string` ### Job Get Response - `JobGetResponse` - `id: string` - `source: "user" | "schedule"` - `"user"` - `"schedule"` - `description?: string` - `end_reason?: string` - `ended_at?: string` - `last_seen_at?: string` - `started_at?: string` ### Job Logs Response - `JobLogsResponse = Array` - `id: number` - `created_at: number` - `message: string` - `message_type: number` # Tokens ## List tokens. `client.aiSearch.tokens.list(TokenListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-search/tokens` List tokens. ### Parameters - `params: TokenListParams` - `account_id: string` Path param - `order_by?: "created_at"` Query param: Order By Column Name - `"created_at"` - `order_by_direction?: "asc" | "desc"` Query param: Order By Direction - `"asc"` - `"desc"` - `page?: number` Query param - `per_page?: number` Query param ### Returns - `TokenListResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const tokenListResponse of client.aiSearch.tokens.list({ account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', })) { console.log(tokenListResponse.id); } ``` #### Response ```json { "result": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "cf_api_id": "cf_api_id", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "created_by": "created_by", "enabled": true, "legacy": true, "modified_by": "modified_by" } ], "success": true } ``` ## Create new tokens. `client.aiSearch.tokens.create(TokenCreateParamsparams, RequestOptionsoptions?): TokenCreateResponse` **post** `/accounts/{account_id}/ai-search/tokens` Create a new tokens. ### Parameters - `params: TokenCreateParams` - `account_id: string` Path param - `cf_api_id: string` Body param - `cf_api_key: string` Body param - `name: string` Body param ### Returns - `TokenCreateResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const token = await client.aiSearch.tokens.create({ account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', cf_api_id: 'cf_api_id', cf_api_key: 'cf_api_key', name: 'name', }); console.log(token.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "cf_api_id": "cf_api_id", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "created_by": "created_by", "enabled": true, "legacy": true, "modified_by": "modified_by" }, "success": true } ``` ## Read tokens. `client.aiSearch.tokens.read(stringid, TokenReadParamsparams, RequestOptionsoptions?): TokenReadResponse` **get** `/accounts/{account_id}/ai-search/tokens/{id}` Read tokens. ### Parameters - `id: string` - `params: TokenReadParams` - `account_id: string` ### Returns - `TokenReadResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiSearch.tokens.read('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(response.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "cf_api_id": "cf_api_id", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "created_by": "created_by", "enabled": true, "legacy": true, "modified_by": "modified_by" }, "success": true } ``` ## Update tokens. `client.aiSearch.tokens.update(stringid, TokenUpdateParamsparams, RequestOptionsoptions?): TokenUpdateResponse` **put** `/accounts/{account_id}/ai-search/tokens/{id}` Update tokens. ### Parameters - `id: string` - `params: TokenUpdateParams` - `account_id: string` Path param - `cf_api_id: string` Body param - `cf_api_key: string` Body param - `name: string` Body param ### Returns - `TokenUpdateResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const token = await client.aiSearch.tokens.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', cf_api_id: 'cf_api_id', cf_api_key: 'cf_api_key', name: 'name', }); console.log(token.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "cf_api_id": "cf_api_id", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "created_by": "created_by", "enabled": true, "legacy": true, "modified_by": "modified_by" }, "success": true } ``` ## Delete tokens. `client.aiSearch.tokens.delete(stringid, TokenDeleteParamsparams, RequestOptionsoptions?): TokenDeleteResponse` **delete** `/accounts/{account_id}/ai-search/tokens/{id}` Delete tokens. ### Parameters - `id: string` - `params: TokenDeleteParams` - `account_id: string` ### Returns - `TokenDeleteResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const token = await client.aiSearch.tokens.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', }); console.log(token.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "cf_api_id": "cf_api_id", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "created_by": "created_by", "enabled": true, "legacy": true, "modified_by": "modified_by" }, "success": true } ``` ## Domain Types ### Token List Response - `TokenListResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Token Create Response - `TokenCreateResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Token Read Response - `TokenReadResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Token Update Response - `TokenUpdateResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null` ### Token Delete Response - `TokenDeleteResponse` - `id: string` - `cf_api_id: string` - `created_at: string` - `modified_at: string` - `name: string` - `created_by?: string | null` - `enabled?: boolean` - `legacy?: boolean` - `modified_by?: string | null`