API Reference
Complete reference for all sync server endpoints.
Authentication
Section titled “Authentication”All endpoints require a bearer token in the Authorization header:
Authorization: Bearer your-auth-tokenUnauthorized requests return 401 Unauthorized.
Endpoints
Section titled “Endpoints”Health Check
Section titled “Health Check”GET /health
Check if the server is running.
Response:
{ "status": "ok", "version": "2.0.0"}Full Sync - Download
Section titled “Full Sync - Download”GET /sync
Download the entire dataset from the server.
Response:
{ "exportedAt": "2024-01-15T10:30:00.000Z", "version": "2.0", "formatVersion": "2.0", "gyms": [...], "problems": [...], "sessions": [...], "attempts": [...], "deletedItems": [...]}Returns 200 OK with the backup data, or 404 Not Found if no data exists.
Full Sync - Upload
Section titled “Full Sync - Upload”POST /sync
Upload your entire dataset to the server. This overwrites all server data.
Request Body:
{ "exportedAt": "2024-01-15T10:30:00.000Z", "version": "2.0", "formatVersion": "2.0", "gyms": [...], "problems": [...], "sessions": [...], "attempts": [...], "deletedItems": [...]}Response:
200 OKDelta Sync
Section titled “Delta Sync”POST /sync/delta
Sync only changed data since your last sync. Much faster than full sync.
Request Body:
{ "lastSyncTime": "2024-01-15T10:00:00.000Z", "gyms": [...], "problems": [...], "sessions": [...], "attempts": [...], "deletedItems": [...]}Include only items modified after lastSyncTime. The server merges your changes with its data using last-write-wins based on updatedAt timestamps.
Response:
{ "serverTime": "2024-01-15T10:30:00.000Z", "gyms": [...], "problems": [...], "sessions": [...], "attempts": [...], "deletedItems": [...]}Returns only server items modified after your lastSyncTime. Save serverTime as your new lastSyncTime for the next delta sync.
Image Upload
Section titled “Image Upload”POST /images/upload?filename={name}
Upload an image file.
Query Parameters:
filename: Image filename (e.g.,problem_abc123_0.jpg)
Request Body: Binary image data (JPEG, PNG, GIF, or WebP)
Response:
200 OKImage Download
Section titled “Image Download”GET /images/download?filename={name}
Download an image file.
Query Parameters:
filename: Image filename
Response:
Binary image data with appropriate Content-Type header.
Returns 404 Not Found if the image doesn’t exist.
- All timestamps are ISO 8601 format with milliseconds
- Active sessions (status
active) are excluded from sync - Images are stored separately and referenced by filename
- The server stores everything in a single
ascently.jsonfile - No versioning or history - last write wins