Video API
API endpoints and SDK methods for video management
Video API
The Video API allows you to programmatically upload, manage, and process videos. This page documents both the REST API endpoints and the corresponding SDK methods.
Video Upload
Upload a new video for analysis.
SDK Method
HTTP Request
Headers:
Form Parameters:
firebase_collection_name
(string, required): Collection name for storage (default: “videos”)source
(string, required): Source type (“file”, “youtube”, or “saved”)file
(file, required for “file” source): The video file to uploadyoutube_url
(string, required for “youtube” source): YouTube URL to processvideo_id
(string, required for “saved” source): ID of an existing videocreated_by
(string, optional): User identifier for tracking
Response:
Video Analysis
Start analysis for an uploaded video.
SDK Method
HTTP Request
Headers:
Form Parameters:
firebase_collection_name
(string, required): Collection name (default: “videos”)created_by
(string, optional): User identifier for tracking
Response:
Upload and Analyze
Upload a video and start analysis in a single operation.
SDK Method
HTTP Request
This is a convenience method in the SDK that combines the upload and analyze endpoints. There is no direct equivalent in the REST API - you would need to call the upload endpoint and then the analyze endpoint.
Video Status
Check the status of a video upload and analysis.
SDK Method
HTTP Request
Headers:
Query Parameters:
firebase_collection_name
(string, required): Collection name (default: “videos”)
Response:
Wait for Analysis
Wait for video analysis to complete.
SDK Method
HTTP Request
This is a convenience method in the SDK. There is no direct equivalent in the REST API - you would need to poll the status endpoint until the analysis is complete.
Video Analysis Results
Get the complete analysis results for a video.
SDK Method
HTTP Request
Headers:
Query Parameters:
firebase_collection_name
(string, required): Collection name (default: “videos”)
Response:
Video Events
Get just the events detected in a video.
SDK Method
HTTP Request
Headers:
Query Parameters:
firebase_collection_name
(string, required): Collection name (default: “videos”)severity
(string, optional): Filter by severity (“low”, “medium”, “high”)event_type
(string, optional): Filter by event type (“Traffic Violation”, “Safety Alert”, etc.)
Response:
Stream Video
Stream a video file.
SDK Method
The SDK doesn’t provide a direct method for streaming video content, as this is typically handled by the frontend application.
HTTP Request
Headers:
Response: Binary video data with appropriate content type and streaming headers.
Error Handling
The API returns standard HTTP status codes:
- 200 OK: Request succeeded
- 400 Bad Request: Invalid input parameters
- 401 Unauthorized: Invalid or missing API key
- 403 Forbidden: Valid API key but insufficient permissions
- 404 Not Found: Resource not found
- 409 Conflict: Resource conflict
- 429 Too Many Requests: Rate limit exceeded
- 500 Internal Server Error: Server error
Error responses include a JSON body with details:
In the SDK, errors are raised as exceptions:
AuthenticationError
: Authentication issuesVideoUploadError
: Problems with video uploadAnalysisError
: Issues during video analysisValidationError
: Invalid input parametersAPIError
: General API errorsNomadicMLError
: Base class for all SDK errors
Rate Limits
The API has the following rate limits:
- Uploads: 10 per minute, 100 per day
- API Calls: 60 per minute, 10,000 per day
Rate limit headers are included in all responses: