POST /accounts/{account_id}/ai-search/instances

Create a new AI Search instance with the given configuration.

Servers

Path parameters

Name Type Required Description
account_id String Yes

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
source String No
ai_search_model String No
reranking Boolean No

Default value: false

chunk Boolean No

Default value: true

metadata Object No
metadata.worker_domain String No
metadata.created_from_aisearch_wizard Boolean No
id String Yes

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

indexing_options Object No
indexing_options.keyword_tokenizer String No

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.

Valid values:

  • "trigram"
  • "porter"

Default value: "porter"

fusion_method String No

Valid values:

  • "max"
  • "rrf"

Default value: "rrf"

cache Boolean No

Default value: true

max_num_results Integer No

Default value: 10

reranking_model String No
chunk_size Integer No
rewrite_model String No
type String No

Valid values:

  • "r2"
  • "web-crawler"
  • null
source_params Object No
source_params.prefix String No
source_params.web_crawler Object No

Default value: { "parse_type": "sitemap" }

source_params.web_crawler.parse_type String No

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

Valid values:

  • "discover"
  • "sitemap"

Default value: "sitemap"

source_params.web_crawler.parse_options Object No
source_params.web_crawler.parse_options.include_headers Object No

Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 token characters (no spaces, colons, or control characters); values must be HTAB + printable ASCII (no CR/LF).

source_params.web_crawler.parse_options.use_browser_rendering Boolean No

Default value: true

source_params.web_crawler.parse_options.include_images Boolean No

Default value: false

source_params.web_crawler.parse_options.content_selector[] Array No

List of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. Only the matched HTML fragment is stored and indexed. Omit the field to disable content selection — empty arrays are rejected.

source_params.web_crawler.parse_options.content_selector[].selector String Yes

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

source_params.web_crawler.parse_options.content_selector[].path String Yes

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

source_params.web_crawler.parse_options.specific_sitemaps[] Array No

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

source_params.web_crawler.discover_options Object No

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

source_params.web_crawler.discover_options.include_subdomains Boolean No

Follow links to subdomains of the source host.

Default value: false

source_params.web_crawler.discover_options.source String No

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

Valid values:

  • "links"
  • "sitemaps"
  • "all"

Default value: "all"

source_params.web_crawler.discover_options.limit Number No

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

Default value: 100000

source_params.web_crawler.discover_options.depth Number No

Maximum link-follow depth from the seed URL.

Default value: 5

source_params.web_crawler.discover_options.max_age Number No

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

Default value: 86400

source_params.web_crawler.discover_options.include_external_links Boolean No

Follow links that point outside the source domain. Must stay false — discover crawls are restricted to the zone you own.

Default value: false

source_params.include_items[] Array No

List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.

source_params.r2_jurisdiction String No

Default value: "default"

source_params.exclude_items[] Array No

List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.

retrieval_options Object No
retrieval_options.boost_by[] Array No

Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric/datetime fields and 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field.

retrieval_options.boost_by[].field String Yes

Metadata field name to boost by. Use 'timestamp' for document freshness, or any custom_metadata field. Numeric and datetime fields support all four directions (asc, desc, exists, not_exists); text/boolean fields only support exists/not_exists.

retrieval_options.boost_by[].direction String No

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.

Valid values:

  • "exists"
  • "not_exists"
  • "desc"
  • "asc"
retrieval_options.keyword_match_mode String No

Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.

Valid values:

  • "and"
  • "or"
custom_metadata[] Array No
custom_metadata[].data_type String Yes

Valid values:

  • "text"
  • "boolean"
  • "datetime"
  • "number"
custom_metadata[].field_name String Yes
cache_ttl No

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

Default value: 172800

chunk_overlap Integer No

Default value: 10

token_id String No
rewrite_query Boolean No

Default value: false

score_threshold Number No

Default value: 0.4

hybrid_search_enabled Boolean No

Deprecated — use index_method instead.

Default value: false

public_endpoint_params Object No
public_endpoint_params.custom_domains[] Array No

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

public_endpoint_params.chat_completions_endpoint Object No
public_endpoint_params.chat_completions_endpoint.disabled Boolean No

Disable chat completions endpoint for this public endpoint

Default value: false

public_endpoint_params.search_endpoint Object No
public_endpoint_params.search_endpoint.disabled Boolean No

Disable search endpoint for this public endpoint

Default value: false

public_endpoint_params.default_domain_enabled Boolean No

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

Default value: true

public_endpoint_params.enabled Boolean No

Default value: false

public_endpoint_params.authorized_hosts[] Array No
public_endpoint_params.mcp Object No
public_endpoint_params.mcp.description String No

Default value: "Finds exactly what you're looking for"

public_endpoint_params.mcp.disabled Boolean No

Disable MCP endpoint for this public endpoint

Default value: false

public_endpoint_params.rate_limit Object No
public_endpoint_params.rate_limit.requests Integer No
public_endpoint_params.rate_limit.period_ms Integer No
public_endpoint_params.rate_limit.technique String No

Valid values:

  • "fixed"
  • "sliding"
cache_threshold String No

Valid values:

  • "flexible_friend"
  • "super_strict_match"
  • "anything_goes"
  • "close_enough"

Default value: "close_enough"

index_method Object No

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

Default value: { "vector": true, "keyword": false }

index_method.vector Boolean Yes

Enable vector (embedding) storage backend.

index_method.keyword Boolean Yes

Enable keyword (BM25) storage backend.

ai_gateway_id String No
sync_interval No

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

Default value: 21600

embedding_model String No

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.