Skip to content
Start here

AI Search

AI SearchInstances

resource cloudflare_ai_search_instance

required Expand Collapse
id: String

Use your AI Search ID.

account_id: String
optional Expand Collapse
source?: String
type?: String
ai_gateway_id?: String
aisearch_model?: String
embedding_model?: String
reranking_model?: String
rewrite_model?: String
summarization_model?: String
system_prompt_aisearch?: String
system_prompt_index_summarization?: String
system_prompt_rewrite_query?: String
token_id?: String
custom_metadata?: List[Attributes]
data_type: String
field_name: String
metadata?: Attributes
created_from_aisearch_wizard?: Bool
worker_domain?: String
cache?: Bool
cache_threshold?: String
chunk?: Bool
chunk_overlap?: Int64
chunk_size?: Int64
fusion_method?: String
hybrid_search_enabled?: Bool
max_num_results?: Int64
paused?: Bool
reranking?: Bool
rewrite_query?: Bool
score_threshold?: Float64
summarization?: Bool
public_endpoint_params?: Attributes
authorized_hosts?: List[String]
chat_completions_endpoint?: Attributes
disabled?: Bool

Disable chat completions endpoint for this public endpoint

enabled?: Bool
mcp?: Attributes
description?: String
disabled?: Bool

Disable MCP endpoint for this public endpoint

rate_limit?: Attributes
period_ms?: Int64
requests?: Int64
technique?: String
search_endpoint?: Attributes
disabled?: Bool

Disable search endpoint for this public endpoint

retrieval_options?: Attributes
boost_by?: List[Attributes]

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?: String

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.

keyword_match_mode?: String

Controls how keyword search terms are matched. exact_match requires all terms to appear (AND); fuzzy_match returns results containing any term (OR). Defaults to exact_match.

source_params?: Attributes
exclude_items?: List[String]

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?: List[String]

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?: Attributes
crawl_options?: Attributes
depth?: Float64
include_subdomains?: Bool
max_age?: Float64
source?: String
parse_options?: Attributes
content_selector?: List[Attributes]

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?: Map[String]
include_images?: Bool
specific_sitemaps?: List[String]

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

use_browser_rendering?: Bool
parse_type?: String
store_options?: Attributes
storage_id: String
r2_jurisdiction?: String
storage_type?: String
computed Expand Collapse
created_at: Time
created_by: String
enable: Bool
last_activity: Time
modified_at: Time
modified_by: String
public_endpoint_id: String
status: String

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 = "@cf/meta/llama-3.3-70b-instruct-fp8-fast"
  cache = true
  cache_threshold = "super_strict_match"
  chunk = true
  chunk_overlap = 0
  chunk_size = 64
  custom_metadata = [{
    data_type = "text"
    field_name = "x"
  }]
  embedding_model = "@cf/qwen/qwen3-embedding-0.6b"
  fusion_method = "max"
  hybrid_search_enabled = true
  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
    }
    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 = "exact_match"
  }
  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"
      }
    }
  }
  token_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  type = "r2"
}

data cloudflare_ai_search_instance

required Expand Collapse
account_id: String
optional Expand Collapse
id?: String

Use your AI Search ID.

filter?: Attributes
order_by?: String

Order By Column Name

order_by_direction?: String

Order By Direction

computed Expand Collapse
ai_gateway_id: String
aisearch_model: String
cache: Bool
cache_threshold: String
chunk_overlap: Int64
chunk_size: Int64
created_at: Time
created_by: String
embedding_model: String
enable: Bool
fusion_method: String
hybrid_search_enabled: Bool
last_activity: Time
max_num_results: Int64
modified_at: Time
modified_by: String
paused: Bool
public_endpoint_id: String
reranking: Bool
reranking_model: String
rewrite_model: String
rewrite_query: Bool
score_threshold: Float64
source: String
status: String
token_id: String
type: String
custom_metadata: List[Attributes]
data_type: String
field_name: String
metadata: Attributes
created_from_aisearch_wizard: Bool
worker_domain: String
public_endpoint_params: Attributes
authorized_hosts: List[String]
chat_completions_endpoint: Attributes
disabled: Bool

Disable chat completions endpoint for this public endpoint

enabled: Bool
mcp: Attributes
description: String
disabled: Bool

Disable MCP endpoint for this public endpoint

rate_limit: Attributes
period_ms: Int64
requests: Int64
technique: String
search_endpoint: Attributes
disabled: Bool

Disable search endpoint for this public endpoint

retrieval_options: Attributes
boost_by: List[Attributes]

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: String

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.

keyword_match_mode: String

Controls how keyword search terms are matched. exact_match requires all terms to appear (AND); fuzzy_match returns results containing any term (OR). Defaults to exact_match.

source_params: Attributes
exclude_items: List[String]

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: List[String]

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: Attributes
crawl_options: Attributes
depth: Float64
include_subdomains: Bool
max_age: Float64
source: String
parse_options: Attributes
content_selector: List[Attributes]

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: Map[String]
include_images: Bool
specific_sitemaps: List[String]

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

use_browser_rendering: Bool
parse_type: String
store_options: Attributes
storage_id: String
r2_jurisdiction: String
storage_type: String

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

required Expand Collapse
account_id: String
optional Expand Collapse
order_by?: String

Order By Column Name

order_by_direction?: String

Order By Direction

max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String

Use your AI Search ID.

created_at: Time
modified_at: Time
ai_gateway_id: String
aisearch_model: String
cache: Bool
cache_threshold: String
chunk_overlap: Int64
chunk_size: Int64
created_by: String
custom_metadata: List[Attributes]
data_type: String
field_name: String
embedding_model: String
enable: Bool
fusion_method: String
hybrid_search_enabled: Bool
last_activity: Time
max_num_results: Int64
metadata: Attributes
created_from_aisearch_wizard: Bool
worker_domain: String
modified_by: String
paused: Bool
public_endpoint_id: String
public_endpoint_params: Attributes
authorized_hosts: List[String]
chat_completions_endpoint: Attributes
disabled: Bool

Disable chat completions endpoint for this public endpoint

enabled: Bool
mcp: Attributes
description: String
disabled: Bool

Disable MCP endpoint for this public endpoint

rate_limit: Attributes
period_ms: Int64
requests: Int64
technique: String
search_endpoint: Attributes
disabled: Bool

Disable search endpoint for this public endpoint

reranking: Bool
reranking_model: String
retrieval_options: Attributes
boost_by: List[Attributes]

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: String

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.

keyword_match_mode: String

Controls how keyword search terms are matched. exact_match requires all terms to appear (AND); fuzzy_match returns results containing any term (OR). Defaults to exact_match.

rewrite_model: String
rewrite_query: Bool
score_threshold: Float64
source: String
source_params: Attributes
exclude_items: List[String]

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: List[String]

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: Attributes
crawl_options: Attributes
depth: Float64
include_subdomains: Bool
max_age: Float64
source: String
parse_options: Attributes
content_selector: List[Attributes]

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: Map[String]
include_images: Bool
specific_sitemaps: List[String]

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

use_browser_rendering: Bool
parse_type: String
store_options: Attributes
storage_id: String
r2_jurisdiction: String
storage_type: String
status: String
token_id: String
type: String

cloudflare_ai_search_instances

data "cloudflare_ai_search_instances" "example_ai_search_instances" {
  account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
  search = "search"
}

AI SearchTokens

resource cloudflare_ai_search_token

required Expand Collapse
account_id: String
cf_api_id: String
cf_api_key: String
name: String
computed Expand Collapse
id: String
created_at: Time
created_by: String
enabled: Bool
legacy: Bool
modified_at: Time
modified_by: String

cloudflare_ai_search_token

resource "cloudflare_ai_search_token" "example_ai_search_token" {
  account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
  cf_api_id = "cf_api_id"
  cf_api_key = "cf_api_key"
  name = "name"
}

data cloudflare_ai_search_token

required Expand Collapse
account_id: String
optional Expand Collapse
id?: String
filter?: Attributes
order_by?: String

Order By Column Name

order_by_direction?: String

Order By Direction

computed Expand Collapse
cf_api_id: String
created_at: Time
created_by: String
enabled: Bool
legacy: Bool
modified_at: Time
modified_by: String
name: String

cloudflare_ai_search_token

data "cloudflare_ai_search_token" "example_ai_search_token" {
  account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
  id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}

data cloudflare_ai_search_tokens

required Expand Collapse
account_id: String
optional Expand Collapse
order_by?: String

Order By Column Name

order_by_direction?: String

Order By Direction

max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String
cf_api_id: String
created_at: Time
modified_at: Time
name: String
created_by: String
enabled: Bool
legacy: Bool
modified_by: String

cloudflare_ai_search_tokens

data "cloudflare_ai_search_tokens" "example_ai_search_tokens" {
  account_id = "c3dc5f0b34a14ff8e1b3ec04895e1b22"
}