The sync API provides visibility into the background synchronization process between the local SQLite database and Supabase. Use it to monitor pending operations, identify sync errors, and check connectivity status.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Carlos-Gnd/FERRED-Inventario-y-Ventas/llms.txt
Use this file to discover all available pages before exploring further.
Synchronization happens automatically in the background — you do not need to call any endpoint to trigger it. This API is for monitoring and manual control only.
Background sync behavior
TheSyncService runs a drain loop in the background with the following characteristics:
- Interval: every 30 seconds.
- Batch size: up to 50
SyncLogentries are processed per cycle. - Retry limit: each entry is retried up to 5 times before being marked
ERROR. - Scope: entries are filtered to
status = PENDIENTE; entries inSINCRONIZADOorERRORstate are not retried automatically.
GET /api/inventario/status
Quick connectivity check. Returns whether the server can currently reach Supabase. Roles: ADMIN, BODEGA, CAJEROResponse
true if the server successfully reached Supabase; false if operating in offline mode.GET /api/inventario/sync-pendientes
Returns counts of sync log entries by status for the current user. ADMIN users see all entries across the system; other roles see only their own entries. Roles: All authenticated usersResponse
Number of
SyncLog entries with status = PENDIENTE. These are operations that have been recorded locally but not yet pushed to Supabase.Number of entries with
status = SINCRONIZADO. These operations have been successfully uploaded.Number of entries with
status = ERROR. These operations failed after the maximum number of retry attempts and require manual attention.Current connectivity status. Reflects the same value as
GET /api/inventario/status.The branch ID of the authenticated user.
null for ADMIN users without an assigned branch.GET /api/sync/snapshot/status
Returns the timestamp of the last successful snapshot sync for the authenticated user’s branch, along with current connectivity. Roles: ADMIN, BODEGA, CAJEROResponse
Whether the server can reach Supabase.
The branch ID of the authenticated user.
ISO 8601 timestamp of the last successful snapshot refresh for this branch, or
null if no snapshot has been taken yet.Errors
| Status | Condition |
|---|---|
| 400 | The authenticated user has no branch assigned. |
POST /api/sync/snapshot
Manually triggers a snapshot refresh for the authenticated user’s branch. Pulls current data from Supabase into the local SQLite database. Fails if the server is offline. Roles: ADMIN, BODEGA, CAJEROQuery parameters
When
true, runs a full bootstrap snapshot (all data). When false (default), runs an incremental refresh that only fetches data changed since the last snapshot.Response 200
Always
true on success.Number of records synced per table during this snapshot operation. Shape depends on the snapshot implementation.
ISO 8601 timestamp of the snapshot that was just completed.
Errors
| Status | Condition |
|---|---|
| 400 | The authenticated user has no branch assigned. |
| 503 | The server is offline — cannot sync without a Supabase connection. |