Skip to main content

API Overview

The SuperFast backend exposes a RESTful HTTP API built with Go and the Gin framework. All client apps (desktop, Android, web) communicate with this API for sync, authentication, WhatsApp, and server metrics.

Base URLโ€‹

https://api.yourdomain.com/api/v1

All endpoints are prefixed with /api/v1.


Authenticationโ€‹

All endpoints (except /auth/*) require a JWT Bearer token in the Authorization header:

Authorization: Bearer <access_token>

Additionally, all requests must include the device identifier:

X-Device-ID: <device_uuid>

See the Authentication API page for how to obtain tokens.


Rate Limitsโ€‹

Endpoint GroupRate Limit
/auth/*10 requests/minute per IP
/sync/*60 requests/minute per device
/whatsapp/*30 requests/minute per device
/server/*10 requests/minute per device

Rate limit headers are included in every response:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1753094400

When the limit is exceeded, the server returns 429 Too Many Requests.


Response Formatโ€‹

Successโ€‹

{
"success": true,
"data": { ... },
"message": "optional message"
}

Errorโ€‹

{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human-readable error description",
"details": { ... }
}
}

HTTP Status Codesโ€‹

CodeMeaning
200Success
201Created
400Bad request / validation error
401Unauthorized (missing or expired token)
403Forbidden (valid token but insufficient permissions)
404Resource not found
409Conflict (e.g. duplicate entity)
429Rate limit exceeded
500Internal server error
503Service unavailable

All Endpointsโ€‹

Authenticationโ€‹

MethodPathDescription
POST/auth/store/registerRegister a new store
POST/auth/device/loginLogin / register a device
POST/auth/device/refreshRefresh access token

Syncโ€‹

MethodPathDescription
POST/sync/pushPush local changes to server
GET/sync/pullPull changes from server

WhatsAppโ€‹

MethodPathDescription
GET/whatsapp/statusGet connection status
GET/whatsapp/qrGet QR code for linking
POST/whatsapp/sendSend a WhatsApp message
DELETE/whatsapp/logoutLogout WhatsApp session
GET/whatsapp/chatsList all chats
GET/whatsapp/contactsList all contacts
GET/whatsapp/messagesGet messages for a chat

Serverโ€‹

MethodPathDescription
GET/server/metricsGet server health metrics
GET/healthSimple health check (no auth)

Paginationโ€‹

List endpoints that return multiple items support pagination via query parameters:

GET /sync/pull?since=2026-07-01T00:00:00Z&limit=100&offset=0
ParameterDefaultMax
limit100500
offset0โ€”

Timestampsโ€‹

All timestamps in the API use ISO 8601 format in UTC:

2026-07-21T08:30:00Z

The client is responsible for converting to/from local time for display.


CORSโ€‹

The API allows cross-origin requests from configured origins. The CORS_ORIGINS environment variable controls the allowed origins list. By default, all origins are allowed (*) in development mode.