Skip to content

API Reference

Complete reference for all sync server endpoints.

All endpoints require a bearer token in the Authorization header:

Authorization: Bearer your-auth-token

Unauthorized requests return 401 Unauthorized.

GET /health

Check if the server is running.

Response:

{
"status": "ok",
"version": "2.0.0"
}

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.

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 OK

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.

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 OK

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.json file
  • No versioning or history - last write wins