AI Search
AI SearchNamespaces
resource cloudflare_ai_search_namespace
cloudflare_ai_search_namespace
resource "cloudflare_ai_search_namespace" "example_ai_search_namespace" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
name = "name"
description = "Production environment"
public_endpoint_params = {
authorized_hosts = ["string"]
chat_completions_endpoint = {
disabled = true
}
custom_domains = ["search.example.com"]
default_domain_enabled = true
enabled = true
instances_allowed = ["docs", "blog"]
mcp = {
description = "description"
disabled = true
}
rate_limit = {
period_ms = 60000
requests = 1
technique = "fixed"
}
search_endpoint = {
disabled = true
}
}
}
data cloudflare_ai_search_namespace
cloudflare_ai_search_namespace
data "cloudflare_ai_search_namespace" "example_ai_search_namespace" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
name = "production"
}
data cloudflare_ai_search_namespaces
optional
cloudflare_ai_search_namespaces
data "cloudflare_ai_search_namespaces" "example_ai_search_namespaces" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
search = "prod"
}
AI SearchInstances
resource cloudflare_ai_search_instance
required
optional
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.
A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.
Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).
cloudflare_ai_search_instance
resource "cloudflare_ai_search_instance" "example_ai_search_instance" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
id = "my-ai-search"
ai_gateway_id = "ai_gateway_id"
aisearch_model = "ai_search_model"
cache = true
cache_threshold = "super_strict_match"
cache_ttl = 600
chunk = true
chunk_overlap = 0
chunk_size = 64
custom_metadata = [{
data_type = "text"
field_name = "x"
}]
embedding_model = "embedding_model"
fusion_method = "max"
hybrid_search_enabled = true
index_method = {
keyword = true
vector = true
}
indexing_options = {
keyword_tokenizer = "porter"
}
max_num_results = 1
metadata = {
created_from_aisearch_wizard = true
worker_domain = "worker_domain"
}
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"
}
}
sync_interval = 900
token_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
type = "r2"
}
data cloudflare_ai_search_instance
computed
A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.
Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).
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.
cloudflare_ai_search_instance
data "cloudflare_ai_search_instance" "example_ai_search_instance" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
id = "my-ai-search"
}
data cloudflare_ai_search_instances
optional
cloudflare_ai_search_instances
data "cloudflare_ai_search_instances" "example_ai_search_instances" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
namespace = "namespace"
search = "search"
}
AI SearchTokens
resource cloudflare_ai_search_token
cloudflare_ai_search_token
resource "cloudflare_ai_search_token" "example_ai_search_token" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
cf_api_id = "a1b2c3d4e5f6"
cf_api_key = "abc123"
name = "my-token"
legacy = true
}
data cloudflare_ai_search_token
cloudflare_ai_search_token
data "cloudflare_ai_search_token" "example_ai_search_token" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
id = "62af0db3-c410-40b2-9ee3-0e93f6dd1de0"
}
data cloudflare_ai_search_tokens
optional
cloudflare_ai_search_tokens
data "cloudflare_ai_search_tokens" "example_ai_search_tokens" {
account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
search = "my-token"
}