> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.reka.ai/vision/video-qa/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.reka.ai/_mcp/server. # Video Q&A > Ask questions about your videos and get AI-powered answers The Vision API provides powerful question-answering capabilities for your videos. Once a video has been indexed, you can ask natural language questions about its content and receive AI-powered answers. > **Info** > > The Video Q\&A API is designed for videos **longer than 30 seconds**. It indexes your video for efficient retrieval and analysis across longer content. > > For videos **30 seconds or shorter**, use the [Chat API with multimodal inputs](/chat/chat-with-image-video-and-audio) instead — it accepts video directly in the conversation without requiring a separate indexing step. ## Prerequisites Before using Video Q\&A, ensure your video has been successfully indexed: 1. **Upload a video** with `index=true` 2. **Check indexing status** - it should be `"indexed"` 3. **Wait for processing** if status is `"indexing"` ## Ask Questions #### Bash Use the `/v1/qa/chat` endpoint to ask questions about your videos: ```bash curl -X POST https://vision-agent.api.reka.ai/v1/qa/chat \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "video_id": "550e8400-e29b-41d4-a716-446655440000", "messages": [ { "role": "user", "content": "What is happening in this video?" } ] }' ``` #### Python ```python import requests import json url = f"{BASE_URL}/v1/qa/chat" # Chat request body payload = { "video_id": "550e8400-e29b-41d4-a716-446655440000", "messages": [ { "role": "user", "content": "What is happening in this video?" } ] } headers = { "X-Api-Key": REKA_API_KEY, "Content-Type": "application/json", } response = requests.post(url, json=payload, headers=headers) print(response.status_code, response.json()) ``` ### Request Parameters * **`video_id`** (optional): ID of the video to analyze * **`messages`** (optional): List of chat messages ### Using Chat Messages For multi-turn conversations, use the `messages` parameter: #### Bash ```bash curl -X POST https://vision-agent.api.reka.ai/v1/qa/chat \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "video_id": "550e8400-e29b-41d4-a716-446655440000", "messages": [ { "role": "user", "content": "What is happening in this video?" }, { "role": "assistant", "content": "The video shows a person walking on the beach during sunset." }, { "role": "user", "content": "What is the color of the car in the video?" } ] }' ``` #### Python ```python import requests import json url = f"{BASE_URL}/v1/qa/chat" # Chat request body payload = { "video_id": "550e8400-e29b-41d4-a716-446655440000", "messages": [ { "role": "user", "content": "What is happening in this video?" }, { "role": "assistant", "content": "The video shows a person walking on the beach during sunset." }, { "role": "user", "content": "What is the color of the car in the video?" } ] } headers = { "X-Api-Key": REKA_API_KEY, "Content-Type": "application/json", } response = requests.post(url, json=payload, headers=headers) print(response.status_code, response.json()) ``` ## Streaming Responses For real-time responses, set `stream=true` in your request: #### Bash ```bash curl -X POST https://vision-agent.api.reka.ai/v1/qa/chat \ -H "X-Api-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "video_id": "550e8400-e29b-41d4-a716-446655440000", "stream": true, "messages": [ { "role": "user", "content": "What is happening in this video?" } ] }' ``` #### Python ```python import requests import json url = f"{BASE_URL}/v1/qa/chat" payload = { "video_id": "550e8400-e29b-41d4-a716-446655440000", "stream": True, "messages": [ { "role": "user", "content": "What is happening in this video?" } ] } headers = { "X-Api-Key": REKA_API_KEY, "Content-Type": "application/json", } response = requests.post(url, json=payload, headers=headers, stream=True) for line in response.iter_lines(): if line: print(line.decode('utf-8')) ``` This returns a Server-Sent Events (SSE) stream with real-time updates. ## Response Format ### Chat Response ```json { "chat_response": "The video shows a person walking on the beach during sunset.", "status": "success", } ``` ### Stream Response ```json { "event": "qa_stream", "data": { "chat_response": "The video shows a person walking on the beach during sunset.", "status": "success", } } ``` When the stream is complete, a final event is sent: ```json { "event": "done", "data": "[DONE]" } ``` ## Question Examples Here are some example questions you can ask: * **General**: "What is happening in this video?" * **Specific**: "What color is the car in the video?" * **Temporal**: "What happens at the beginning of the video?" * **Analytical**: "How many people are in the scene?" * **Descriptive**: "Describe the setting and atmosphere" ## Best Practices 1. **Be specific** in your questions for better answers 2. **Check indexing status** before asking questions 3. **Use streaming** for long videos or complex questions ## Error Handling * **Video not found**: Ensure the video\_id is correct * **Video not indexed**: Wait for indexing to complete * **Indexing failed**: Re-upload the video with `index=true` > Documentation for Reka AI APIs.