AI Search public endpoints allow you to expose AI Search capabilities without requiring authentication. This enables you to integrate AI Search into public-facing applications or share it with external users.
For pre-built search and chat components you can embed on your website using the public endpoints, refer to UI snippets.
Enable public endpoints for your AI Search instance:
- Go to AI Search in the Cloudflare dashboard. Go to AI Search ↗
- Select your AI Search instance.
- Go to Settings > Public Endpoint.
- Turn on Enable Public Endpoint.
- Copy the public endpoint URL.
For configuration options like rate limiting and CORS, refer to Public endpoint configuration.
The /chat/completions endpoint searches your data source and generates a response using the model and retrieved context. It uses the same OpenAI-compatible format as the REST API.
curl https://<INSTANCE_ID>.search.ai.cloudflare.com/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"content": "How do I configure AI Search?",
"role": "user"
}
]
}'For the full list of options, refer to the Chat Completions API reference.
The /search endpoint returns relevant chunks from your data source without generating a response. It uses the same format as the REST API.
curl https://<INSTANCE_ID>.search.ai.cloudflare.com/search \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"content": "How do I configure AI Search?",
"role": "user"
}
]
}'For the full list of options, refer to the Search API reference.
- UI snippets - Add pre-built search and chat components to your website.
- MCP - Connect AI agents using the Model Context Protocol.
- Public endpoint configuration - Configure rate limiting, CORS, and security settings.