> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Cloudflare (Vectorize and Browser Rendering)

Connect your Cloudflare account to store and search vectors in Cloudflare Vectorize, and to crawl and render web pages with Cloudflare Browser Rendering. You set up each service separately in **Settings > Integrations**:

* **Cloudflare Vectorize** is a vector store for the **Vector Search** and **Store Vector** Flow steps.
* **Cloudflare Browser Rendering** runs the **Crawl Website** Flow step and the Browser quick-action tools.

## Before you begin

Make sure that you have the following:

* Your Cloudflare account ID. It appears in the Cloudflare dashboard URL and under **Account Settings**.
* A Cloudflare API token for each service that you connect:
  * For Vectorize, create a token with Vectorize read and write permissions.
  * For Browser Rendering, create a token with Browser Rendering edit permission.

## Connect Cloudflare Vectorize

To connect a Vectorize index to Runtype, follow these steps:

1. Click **Settings > Integrations**.
2. In **Vector Databases**, find **Cloudflare Vectorize** and click **Add Configuration**.
3. In **Configuration Name**, enter a name for the connection.
4. In **API Token**, enter your Cloudflare API token. If you paste a Cloudflare `curl` command that contains your account ID and a bearer token, Runtype fills in both fields.
5. In **Cloudflare Account ID**, enter your account ID.
6. In **Index Name**, select an index. Runtype lists the indexes in your account after you enter the account ID and token.
7. Optional: To make this connection the default, turn on **Set as default Vectorize configuration**. Your first Vectorize configuration becomes the default automatically.
8. On the **Test Connection** tab, click **Test Connection**. Confirm that the connection succeeds.
9. Click **Save Configuration**.

Each configuration points to one index. To use several indexes, add one configuration for each.

### Create an index

To create an index from Runtype, follow these steps:

1. In the configuration dialog, click **Create new index**.
2. In **Index Name**, enter a name. Use lowercase letters, numbers, and hyphens.
3. In **Embedding Model**, select the model that you plan to use. Runtype sets **Dimensions** to match. To enter your own value, select **Custom dimensions**.
4. In **Distance Metric**, keep **Cosine**.
5. Click **Create Index**.

You can't change an index's dimensions or metric after you create it. The dimensions must match the embedding model that you use to write and search the index.

You can also manage Vectorize connections through the API. The following request creates a configuration:

**`Create a Vectorize configuration`**

```bash title="Create a Vectorize configuration"
curl -X POST https://api.runtype.com/v1/integrations/vectorize \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Docs index",
    "accountId": "YOUR_CLOUDFLARE_ACCOUNT_ID",
    "apiToken": "YOUR_CLOUDFLARE_API_TOKEN",
    "indexName": "docs-embeddings"
  }'
```

Replace the following:

* `YOUR_API_KEY`: a Runtype API key with the `INTEGRATIONS:WRITE` permission.
* `YOUR_CLOUDFLARE_ACCOUNT_ID`: your Cloudflare account ID.
* `YOUR_CLOUDFLARE_API_TOKEN`: a Cloudflare API token with Vectorize read and write permissions.

## Write vectors to Vectorize

To write vectors from a Flow, follow these steps:

1. Add a **Generate Embedding** step that embeds your text.
2. Add a **Store Vector** step after it.
3. In **Store vectors from**, enter the embedding variable, for example `{{embedding_result}}`.
4. In the destination list, select **Cloudflare Vectorize**. Then select a connection. If you don't select one, the step uses your default configuration.
5. Optional: In **namespace**, enter a namespace to group the vectors, for example `documents`.
6. In **with ID template**, enter the ID for each vector, for example `{{_record.id}}` when the Flow runs on a Record.
7. Expand **Metadata** and add the fields to store with each vector, for example `content` set to the source text.

The Vectorize destination requires an ID template. If you leave **with ID template** empty, every vector step in the Flow fails when the Flow runs. The error says that the configuration can't be executed. Writing a vector with an existing ID replaces that vector.

Metadata values must be strings, numbers, or booleans.

## Search Vectorize in a Flow

To search a Vectorize index from a Flow, follow these steps:

1. Add a **Vector Search** step.
2. In **Search for**, enter the query text or a variable, for example `{{userMessage}}`.
3. In the provider list, select **Cloudflare Vectorize**. Then select **Default connection** or a specific connection.
4. Optional: In **namespace**, enter the namespace that you wrote the vectors to.
5. Set how many results to return and the minimum similarity. The defaults are `5` results and a similarity of `0.7`.
6. In the embedding model list, select the model that you used to write the vectors.

The step saves its results to its output variable. The default name is `search_results`. The variable holds an array of matches, and each match has the following shape:

**`One Vectorize search result`**

```json title="One Vectorize search result"
{
  "id": "doc-42",
  "score": 0.86,
  "similarity": 0.86,
  "metadata": {
    "content": "Customers can request a refund within 30 days of purchase."
  }
}
```

The step keeps matches whose score is at least the similarity value. With the cosine metric, a higher score is a closer match. With the euclidean metric, Vectorize returns a distance, where a lower score is a closer match, so the similarity filter removes the best matches. Use cosine indexes with Runtype.

To filter by metadata, set `metadataFilters` on the step through the API or an SDK. Each entry is an exact match. Vectorize filters only on metadata properties that have a metadata index in Cloudflare.

### Search Vectorize from an Agent

The **Semantic Search** built-in tool lists **Cloudflare Vectorize** as a provider, but it doesn't return Vectorize results. Every call returns an error that says Vectorize support isn't implemented. To search Vectorize from an Agent, build a Flow with a **Vector Search** step and add that Flow to the Agent as a Flow tool.

## Connect Cloudflare Browser Rendering

If you don't add credentials, the **Crawl Website** step and the Browser quick-action tools use a Runtype platform key. To use your own Cloudflare account, follow these steps:

1. Click **Settings > Integrations**.
2. In **Web Scraping**, find **Cloudflare Browser Rendering**.
3. In **Cloudflare Account ID**, enter your account ID.
4. In **API Token**, enter your Cloudflare API token.
5. Click **Save Credentials**.

To go back to the platform key, click **Remove Credentials**.

Your credentials apply to the following features:

* The **Crawl Website** Flow step.
* The Browser quick-action tools: `browser:screenshot`, `browser:content`, `browser:markdown`, `browser:scrape`, `browser:json`, `browser:links`, and `browser:snapshot`.

## Crawl a website

To crawl a site from a Flow, add a **Crawl Website** step and configure it:

1. In **Start crawl from URL**, enter the first page to crawl.
2. Set the maximum number of pages and the crawl depth.
3. In **Formats**, select the output formats, for example **Markdown**.
4. Optional: To run JavaScript before Runtype reads each page, turn on **render pages**.

The step saves the crawl to its output variable. The default name is `crawl_result`. Each crawled page is in `result.records`, with its content under the format name, for example `markdown`. Large crawls return more than one result page, and every page is in `resultPages`.

## Verify the setup

To confirm that Vectorize works, run a Flow that stores one vector and then searches for it with the same text. The search returns that vector's ID with a score near `1`.

To confirm that Browser Rendering works, run a Flow with a **Crawl Website** step on a page that you know. The output contains that page's content.

## Troubleshoot Cloudflare

The following table lists common errors and how to fix them:

| Error or symptom                                             | Fix                                                                                                                                       |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `Vectorize configuration not found`                          | Add a Vectorize configuration, or set an existing one as the default.                                                                     |
| `Index not found: INDEX_NAME`                                | Check that the index exists in your Cloudflare account and that the configuration uses its exact name.                                    |
| `Authentication failed: 401` or `Authentication failed: 403` | Check the account ID, and check that the API token has Vectorize read and write permissions.                                              |
| `This vector step's configuration cannot be executed`        | Add an ID template to every **Store Vector** step that writes to Vectorize.                                                               |
| Vector searches return no matches                            | Check that the embedding model matches the model that wrote the vectors, and that the namespace matches. Then lower the similarity value. |
| **Semantic Search** returns a Vectorize error                | Search Vectorize with a **Vector Search** step in a Flow instead.                                                                         |
| `Browser Rendering credentials not configured`               | Add Browser Rendering credentials in **Settings > Integrations**.                                                                         |

## Next steps

Use these pages to continue:

* [Flow step types overview](/user-guide/flows/flow-step-types-overview): add **Vector Search**, **Store Vector**, and **Crawl Website** steps to a Flow
* [Building retrieval that works](/user-guide/records/building-retrieval-that-works): chunk content and tune vector search
* [Built-in tools](/user-guide/tools/built-in-tools#browser-tools): configure the Browser tools
* [Agent tools](/user-guide/agents/agent-tools#flow-tools): give an Agent a Flow as a tool
* [Weaviate (vector search)](/user-guide/integrations/weaviate-vector-search): compare another external vector store
* [Firecrawl (web scraping)](/user-guide/integrations/firecrawl-web-scraping): scrape pages that block direct requests