API Reference
REST API endpoints for quota management, usage tracking, and session history
Authentication
All API endpoints require Bearer token authentication
/api/quotaGET /api/quota
Check remaining quota before launching jobs
Response: Returns total, used, remaining quota and percentage used
Example Request:
Example Response:
{
"remainingQuota": 7650,
"pricing": {
"baseRate": 1,
"multiplier": 1.0,
"effectiveRate": 1.0,
"breakdown": {
"base": 1.0,
"maxSessions": 1,
"sessionMultiplier": 1.0,
"userDataMax": 5,
"userDataPremium": 0,
"hasLiveURLAccess": false,
"liveURLPremium": 0
}
}
}/api/usageGET /api/usage
Get usage statistics for reporting and cost analysis
Response: Returns total sessions, total minutes, and active sessions count
Example Request:
Example Response:
{
"totalSessions": 142,
"totalMinutes": 2350,
"activeSessions": 1
}/api/historyGET /api/history
Retrieve session history for audit trails
Optional start and end query parameters (ISO 8601 timestamps)
Response: Returns array of session objects with duration and disconnect reasons
Example Request:
Example Response:
{
"sessions": [
{
"id": 1,
"startedAt": "2025-01-15T10:30:00Z",
"endedAt": "2025-01-15T10:33:25Z",
"durationMinutes": 3,
"quotaConsumed": 3,
"disconnectReason": "client_closed"
}
],
"total": 1
}/api/user-dataPOST /api/user-data
Create a new User Data container for persistent browser state (cookies, localStorage, etc.)
Response: Returns the created User Data ID and timestamp
Example Request:
Example Response:
{
"id": "udd_abc123xyz789defg",
"createdAt": "2025-01-15T10:30:00Z"
}/api/user-dataGET /api/user-data
List all User Data containers for the authenticated user
Response: Returns array of User Data objects with quota information
Example Request:
Example Response:
{
"items": [
{
"id": "udd_abc123xyz789defg",
"createdAt": "2025-01-15T10:30:00Z",
"lastUsedAt": "2025-01-15T12:45:00Z",
"isLocked": false
}
],
"total": 1,
"quota": {
"used": 1,
"max": 5,
"canCreate": true
}
}/api/user-data/:idDELETE /api/user-data/:id
Delete a User Data container and release quota
Response: Returns success status
Example Request:
Example Response:
{
"success": true
}Billing Model
Usage-based billing: 1 minute of browser session time = 1 quota unit
Disconnect Reasons
client_closed— Client called browser.close()client_disconnected— WebSocket connection closed unexpectedlyserver_closed— Browser server closed the connectioninsufficient_balance— Quota exhausted during sessionsocket_timeout— No data transferred for 5 minutestcp_error— Network error