Streaming Search
⚠️ Important Note: The auto-generated code samples in the playground will not work for this WebSocket endpoint, with the exception of the Python and JavaScript examples shown below. Please use these provided examples instead of the playground’s auto-generated stubs.
This endpoint provides a WebSocket connection for streaming search results in real-time.
Connection
Connect to: wss://api.critiquebrowser.app/v1/ws/search
Headers
- X-API-Key: (Required) Your unique API key for authentication.
Message Format
After connecting, send a JSON message with the following structure:
{
"prompt": "your search query",
"image": "optional base64 image or URL",
"source_blacklist": ["optional list of domains to exclude"],
"output_format": {
// Optional structured output format
}
}
Streaming Responses
The server will stream responses as JSON messages with the following structure:
{
"type": "response" | "context" | "error",
"content": "the actual content"
}
type: "response"
- Contains generated response contenttype: "context"
- Contains source context informationtype: "error"
- Contains error messages if any occur
Headers
Your API key for authentication
Body
The search query, can be as extended or succinct as you like
Optional, This string can be the url of the image you want to send. Alternatively, (and the preferred method) is providing a base64 encoded string of the image. If providing a url, the link must start with https:// and ends with a common image file extension like .jpg, .jpeg, .png, .gif, etc.
Optional, a json schema for the response. This will be used to format the response of the agentic search. The types allowed can be any of: string, number, boolean, integer, array
Optional, a list of strings representing domains you want to exclude from the agentic search. ['cnn.com','foxnews.com'].