Create an AI Search instance.
POST/accounts/{account_id}/ai-search/instances
Create a new AI Search instance with the given configuration.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Body ParametersJSON
id: string
AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.
maxLength64
minLength1
ai_search_model: optional string
A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.
Create an AI Search instance.
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-search/instances \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"id": "my-ai-search"
}'{
"result": {
"id": "my-ai-search",
"created_at": "2019-12-27T18:11:19.117Z",
"modified_at": "2019-12-27T18:11:19.117Z",
"ai_gateway_id": "ai_gateway_id",
"ai_search_model": "ai_search_model",
"cache": true,
"cache_threshold": "super_strict_match",
"cache_ttl": 600,
"chunk_overlap": 0,
"chunk_size": 64,
"created_by": "created_by",
"custom_metadata": [
{
"data_type": "text",
"field_name": "x"
}
],
"embedding_model": "embedding_model",
"enable": true,
"engine_version": 0,
"fusion_method": "max",
"hybrid_search_enabled": true,
"index_method": {
"keyword": true,
"vector": true
},
"indexing_options": {
"keyword_tokenizer": "porter"
},
"last_activity": "2019-12-27T18:11:19.117Z",
"max_num_results": 1,
"metadata": {
"created_from_aisearch_wizard": true,
"worker_domain": "worker_domain"
},
"modified_by": "modified_by",
"namespace": "namespace",
"paused": true,
"public_endpoint_id": "public_endpoint_id",
"public_endpoint_params": {
"authorized_hosts": [
"string"
],
"chat_completions_endpoint": {
"disabled": true
},
"custom_domains": [
"search.example.com"
],
"default_domain_enabled": true,
"enabled": true,
"mcp": {
"description": "description",
"disabled": true
},
"rate_limit": {
"period_ms": 60000,
"requests": 1,
"technique": "fixed"
},
"search_endpoint": {
"disabled": true
}
},
"reranking": true,
"reranking_model": "reranking_model",
"retrieval_options": {
"boost_by": [
{
"field": "timestamp",
"direction": "desc"
}
],
"keyword_match_mode": "and"
},
"rewrite_model": "rewrite_model",
"rewrite_query": true,
"score_threshold": 0,
"source": "source",
"source_params": {
"exclude_items": [
"/admin/**",
"/private/**",
"**\\temp\\**"
],
"include_items": [
"/blog/**",
"/docs/**/*.html",
"**\\blog\\**.html"
],
"prefix": "prefix",
"r2_jurisdiction": "r2_jurisdiction",
"web_crawler": {
"discover_options": {
"depth": 5,
"include_external_links": false,
"include_subdomains": false,
"limit": 10000,
"max_age": 86400,
"source": "all"
},
"parse_options": {
"content_selector": [
{
"path": "**/blog/**",
"selector": "article div.post-body"
},
{
"path": "**/docs/**",
"selector": "main"
}
],
"include_headers": {
"cache-control": "no-cache, no-store"
},
"include_images": true,
"specific_sitemaps": [
"https://example.com/sitemap.xml",
"https://example.com/blog-sitemap.xml"
],
"use_browser_rendering": true
},
"parse_type": "sitemap"
}
},
"status": "status",
"sync_interval": 900,
"token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"type": "r2"
},
"success": true
}Returns Examples
{
"result": {
"id": "my-ai-search",
"created_at": "2019-12-27T18:11:19.117Z",
"modified_at": "2019-12-27T18:11:19.117Z",
"ai_gateway_id": "ai_gateway_id",
"ai_search_model": "ai_search_model",
"cache": true,
"cache_threshold": "super_strict_match",
"cache_ttl": 600,
"chunk_overlap": 0,
"chunk_size": 64,
"created_by": "created_by",
"custom_metadata": [
{
"data_type": "text",
"field_name": "x"
}
],
"embedding_model": "embedding_model",
"enable": true,
"engine_version": 0,
"fusion_method": "max",
"hybrid_search_enabled": true,
"index_method": {
"keyword": true,
"vector": true
},
"indexing_options": {
"keyword_tokenizer": "porter"
},
"last_activity": "2019-12-27T18:11:19.117Z",
"max_num_results": 1,
"metadata": {
"created_from_aisearch_wizard": true,
"worker_domain": "worker_domain"
},
"modified_by": "modified_by",
"namespace": "namespace",
"paused": true,
"public_endpoint_id": "public_endpoint_id",
"public_endpoint_params": {
"authorized_hosts": [
"string"
],
"chat_completions_endpoint": {
"disabled": true
},
"custom_domains": [
"search.example.com"
],
"default_domain_enabled": true,
"enabled": true,
"mcp": {
"description": "description",
"disabled": true
},
"rate_limit": {
"period_ms": 60000,
"requests": 1,
"technique": "fixed"
},
"search_endpoint": {
"disabled": true
}
},
"reranking": true,
"reranking_model": "reranking_model",
"retrieval_options": {
"boost_by": [
{
"field": "timestamp",
"direction": "desc"
}
],
"keyword_match_mode": "and"
},
"rewrite_model": "rewrite_model",
"rewrite_query": true,
"score_threshold": 0,
"source": "source",
"source_params": {
"exclude_items": [
"/admin/**",
"/private/**",
"**\\temp\\**"
],
"include_items": [
"/blog/**",
"/docs/**/*.html",
"**\\blog\\**.html"
],
"prefix": "prefix",
"r2_jurisdiction": "r2_jurisdiction",
"web_crawler": {
"discover_options": {
"depth": 5,
"include_external_links": false,
"include_subdomains": false,
"limit": 10000,
"max_age": 86400,
"source": "all"
},
"parse_options": {
"content_selector": [
{
"path": "**/blog/**",
"selector": "article div.post-body"
},
{
"path": "**/docs/**",
"selector": "main"
}
],
"include_headers": {
"cache-control": "no-cache, no-store"
},
"include_images": true,
"specific_sitemaps": [
"https://example.com/sitemap.xml",
"https://example.com/blog-sitemap.xml"
],
"use_browser_rendering": true
},
"parse_type": "sitemap"
}
},
"status": "status",
"sync_interval": 900,
"token_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"type": "r2"
},
"success": true
}