Skip to main content
Cloudflare Vectorize is a globally distributed vector database for building AI-powered applications. Use the API to create indexes, insert vectors, and perform similarity searches.

Overview

Access the Vectorize API:

Indexes

Manage vector indexes for similarity search.

Create an index

Create a new vector index.
string
required
Your Cloudflare account ID
string
required
Name for the index
object
required
Index configuration object
number
required
Vector dimensions (e.g., 768 for many embedding models)
string
required
Distance metric: ‘cosine’, ‘euclidean’, or ‘dot-product’
string
Optional description for the index
string
The index name
object
The index configuration
string
ISO 8601 timestamp when the index was created

List indexes

Retrieve all vector indexes in your account.
string
required
Your Cloudflare account ID

Get an index

Retrieve details about a specific index.
string
required
The index name
string
required
Your Cloudflare account ID

Delete an index

Delete a vector index and all its data.
string
required
The index name to delete
string
required
Your Cloudflare account ID

Vectors

Manage vectors within an index.

Insert vectors

Insert vectors into an index.
string
required
The index name
string
required
Your Cloudflare account ID
array
required
Array of vector objects to insert (up to 1000 vectors per request)
string
required
Unique identifier for the vector
array
required
Vector values (must match index dimensions)
object
Optional metadata to store with the vector (up to 10KB)
number
Number of vectors successfully inserted

Upsert vectors

Insert or update vectors.
string
required
The index name
string
required
Your Cloudflare account ID
array
required
Array of vector objects to upsert

Query vectors

Perform a similarity search.
string
required
The index name
string
required
Your Cloudflare account ID
array
required
Query vector (must match index dimensions)
number
Number of results to return (default: 5, max: 100)
boolean
Whether to return vector values (default: false)
boolean
Whether to return metadata (default: true)
object
Metadata filters for the search
array
Array of matching vectors
string
The vector ID
number
Similarity score (interpretation depends on metric)
object
The vector metadata (if return_metadata=true)
array
The vector values (if return_values=true)

Get vectors by ID

Retrieve specific vectors by their IDs.
string
required
The index name
string
required
Your Cloudflare account ID
array
required
Array of vector IDs to retrieve (up to 100 IDs)

Delete vectors by ID

Delete specific vectors from an index.
string
required
The index name
string
required
Your Cloudflare account ID
array
required
Array of vector IDs to delete (up to 1000 IDs)

List vectors

List all vectors in an index.
string
required
The index name
string
required
Your Cloudflare account ID
number
Maximum number of vectors to return (default: 100, max: 1000)
string
Pagination cursor for fetching the next page

Index information

Get statistics about an index.
number
Total number of vectors in the index
number
Vector dimensions
string
Distance metric used

Using Vectorize in Workers

Bind a Vectorize index to your Worker:
Then query from your Worker: