Overview
The Search API enables you to create AI-powered searches and receive streaming responses in real-time. It supports multiple AI models, search modes, and tool integrations for comprehensive research capabilities.Endpoints
POST /api/search
Create a new search and stream AI-generated results.Request Body
Unique identifier for the chat/conversation. Use UUIDv7 for optimal performance.
Array of message objects representing the conversation history.
AI model to use for generation. Examples:
"scira-default"- Default balanced model"scira-gpt5"- OpenAI GPT-5 (Pro only)"scira-anthropic"- Claude 3.5 Sonnet"scira-google"- Gemini 2.0 Flash"scira-grok-4-fast-think"- xAI Grok-4 with thinking
Search mode/group determining tool availability:
"research"- Standard research mode"extreme"- Deep research mode (Pro only, limited usage)"code"- Code-focused mode"general"- General conversation mode
Chat visibility:
"private" or "public". Defaults to "private".User’s timezone (e.g.,
"America/New_York") for time-aware responses.Whether to include user’s custom instructions. Defaults to
true.Search provider preference:
"tavily" or "exa". Defaults to "tavily".Extreme search provider:
"exa" or "tavily". Defaults to "exa".Array of connector IDs to enable for this search.
Example Request
Response Format
The endpoint returns a Server-Sent Events (SSE) stream with multiple event types: Stream Event Types:Incremental text chunks for the AI response
Tool execution notification
Tool execution results
Stream completion with metadata
Auto-generated chat title (for new chats)
JavaScript Example
Python Example
GET /api/search/[id]/stream
Resume or reconnect to an existing search stream. This endpoint enables resumable streams, allowing clients to reconnect if the connection is interrupted.Path Parameters
The chat ID to resume streaming for
Authentication
Requires valid session cookie. Returns 401 if not authenticated.Authorization
Users can only resume streams for:- Their own private chats
- Public chats (any user)
Example Request
Response
Returns an SSE stream with the same event types as POST /api/search. Behavior:- Active Stream: If the stream is still active, resumes from the current position
- Recently Completed: If the stream completed within 15 seconds, returns the final message
- Older Completion: Returns empty stream (204 No Content)
JavaScript Example
Available Tools
Depending on thegroup parameter, different tools are available:
Research Mode Tools
- web_search - Web search via Tavily or Exa
- academic_search - Search academic papers and publications
- youtube_search - Search YouTube videos
- reddit_search - Search Reddit discussions
- x_search - Search X/Twitter posts
- retrieve - Retrieve and parse web page content
- extreme_search - Deep multi-step research (limited)
General Tools (All Modes)
- weather - Get weather data
- datetime - Get current date/time
- text_translate - Translate text
- currency_converter - Convert currencies
- stock_chart - Get stock data
- coin_data - Get cryptocurrency data
- find_place_on_map - Find locations
- nearby_places_search - Search nearby places
- track_flight - Track flight status
- movie_or_tv_search - Search movies/TV shows
Pro User Tools
- code_interpreter - Execute Python code
- search_memories - Search user’s saved memories
- add_memory - Save information to memory
- connectors_search - Search connected data sources
Rate Limits
Unauthenticated:- 3 searches per 7 days
- 100 searches per day
- Limited extreme search usage
- Unlimited searches
- Unlimited extreme search
Error Responses
Authentication required
Model requires authentication
Pro subscription required
Rate limit exceeded
Daily search limit reached
Chat access denied
Stream not found
Best Practices
Use UUIDv7 for IDs
Use UUIDv7 for IDs
Use UUIDv7 (time-ordered UUIDs) for chat and message IDs for better database performance and sortability.
Handle stream interruptions
Handle stream interruptions
Implement reconnection logic using the GET /api/search/[id]/stream endpoint to resume interrupted streams.
Process events incrementally
Process events incrementally
Process SSE events as they arrive rather than buffering the entire response for better user experience.
Limit message history
Limit message history
The API automatically prunes messages when history exceeds 10 messages. Consider managing context client-side for better control.
Choose appropriate models
Choose appropriate models
Select models based on your needs:
scira-defaultfor balanced performancescira-gpt5for highest quality (Pro)scira-googlefor fast responsesscira-grok-4-fast-thinkfor reasoning tasks
