QuperSync API Endpoints
QuperSync exposes a REST API for managing sync jobs, triggering on-demand syncs, and inspecting sync history. The API is implemented with FastAPI and runs on the same process as the scheduler.
Sync Management
/api/v1/sync/statusGet the current status of all registered sync jobs including last run time, next scheduled run, and row counts
/api/v1/sync/triggerTrigger an immediate on-demand sync for a specific job or all jobs
/api/v1/sync/jobsList all registered sync jobs with their configurations and schedule intervals
/api/v1/sync/jobs/{job_id}/pausePause a specific sync job (APScheduler pause)
/api/v1/sync/jobs/{job_id}/resumeResume a paused sync job
Sync History
/api/v1/sync/historyList sync log entries with optional filtering by job, date range, and status
/api/v1/sync/history/{log_id}Get detailed information about a specific sync run including error details
/api/v1/sync/historyPurge sync history older than a specified number of days
Health & Monitoring
/healthService health check — verifies both Redshift and PostgreSQL connectivity
/metricsPrometheus-format metrics for sync job duration, row counts, and error rates
Trigger On-Demand Sync
// Request — trigger all jobs
{}
// Request — trigger specific job
{
"job_id": "table_stats_sync"
}
// Response
{
"success": true,
"triggered_jobs": ["table_stats_sync"],
"message": "Sync triggered successfully"
}Sync Status Response
{
"status": "running",
"scheduler_timezone": "US/Pacific",
"jobs": [
{
"job_id": "table_stats_sync",
"name": "Table Statistics Sync",
"status": "active",
"last_run": "2024-01-15T10:00:04.231Z",
"next_run": "2024-01-15T10:05:00.000Z",
"interval_seconds": 300,
"last_result": {
"rows_extracted": 1247,
"rows_upserted": 1247,
"duration_ms": 4231,
"status": "success"
}
},
{
"job_id": "query_history_sync",
"name": "Query History Sync (7d)",
"status": "active",
"last_run": "2024-01-15T10:00:12.891Z",
"next_run": "2024-01-15T10:05:00.000Z",
"interval_seconds": 300,
"last_result": {
"rows_extracted": 8432,
"rows_upserted": 8432,
"duration_ms": 12891,
"status": "success"
}
}
]
}Server-Sent Events for Real-Time Updates
QuperSync uses sse-starlette to stream sync progress events in real-time:
from sse_starlette.sse import EventSourceResponse
@router.get("/sync/stream")
async def sync_event_stream(request: Request):
async def event_generator():
while True:
if await request.is_disconnected():
break
# Emit sync status update every 5 seconds
status = await get_sync_status()
yield {
"event": "sync_update",
"data": json.dumps(status)
}
await asyncio.sleep(5)
return EventSourceResponse(event_generator())Web UI Integration