New AI Search REST API endpoints for search and chat
AI Search introduces new OpenAI-compatible REST API endpoints for /search and /chat/completions, supporting a messages array format that enables multi-turn conversations with context retention. The previous AutoRAG API endpoints remain supported.
AI Search now offers new REST API endpoints for search and chat that use an OpenAI compatible format. This means you can use the familiar messages array structure that works with existing OpenAI SDKs and tools. The messages array also lets you pass previous messages within a session, so the model can maintain context across multiple turns.
| Endpoint | Path |
|---|---|
| Chat Completions | POST /accounts/{account_id}/ai-search/instances/{name}/chat/completions |
| Search | POST /accounts/{account_id}/ai-search/instances/{name}/search |
Here is an example request to the Chat Completions endpoint using the new messages array format:
curl https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai-search/instances/{NAME}/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {API_TOKEN}" \
-d '{
"messages": [
{
"role": "system",
"content": "You are a helpful documentation assistant."
},
{
"role": "user",
"content": "How do I get started?"
}
]
}'
For more details, refer to the AI Search REST API guide.
Migration from existing AutoRAG API (recommended)
If you are using the previous AutoRAG API endpoints (/autorag/rags/), we recommend migrating to the new endpoints. The previous AutoRAG API endpoints will continue to be fully supported.
Refer to the migration guide for step-by-step instructions.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for macOS 2026.8.2100.0
GA release for macOS Cloudflare One Client with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster connects with lower memory use, and numerous reliability fixes across DNS, reauthentication, and client stability.
Cloudflare One Client for Windows 2026.8.2100.0
This GA release improves split tunnel reliability, adds support for non-RFC 1918 local networks, optimizes connection performance with faster reconnections and lower memory usage, and includes numerous bug fixes for DNS, registration, and network handling. The client now features a service recovery mechanism that automatically restarts on system unlock and better handles large hosts files without blocking traffic.
Cloudflare One Client for Linux 2026.8.2100.0
New GA release for Linux with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster tunnel reconnections, and lower memory usage. Includes numerous stability and reliability fixes for DNS, reconnection behavior, and crash issues.