Skip to main content

API Overview

The GeSmart Sync API provides REST endpoints for managing synchronization operations, configuration, and monitoring.

Base URL

All API endpoints are relative to your application URL:

  • Development: http://localhost:3000/api
  • Production: https://your-domain.com/api

Authentication

Most endpoints require authentication using a Bearer token. Include the token in the Authorization header:

Authorization: Bearer YOUR_TOKEN_HERE

API Endpoints

Authentication

  • POST /api/auth/login - Login and get access token
  • GET /api/auth/me - Get current user information

Sync Operations

  • POST /api/sync/[entityType] - Sync specific entity (products, customers, brands, categories)
  • POST /api/sync/all - Sync all entities
  • GET /api/sync/status - Get sync status for all entities
  • GET /api/sync/progress - Get real-time sync progress
  • POST /api/sync/control - Control sync (pause, resume, stop)

Configuration

  • GET /api/config - Get sync configurations
  • PUT /api/config - Update sync configuration

Logs

  • GET /api/logs - Get sync logs (with pagination)
  • GET /api/errors - Get error logs (with pagination)
  • PATCH /api/errors - Mark error as resolved

Cron

  • GET /api/cron/sync - Trigger sync via external cron (requires API key)

Response Format

All API responses follow a consistent format:

{
"success": true,
"data": { ... },
"error": null
}

Error responses:

{
"success": false,
"error": "Error message",
"data": null
}

Rate Limiting

API requests are rate-limited to prevent abuse. If you exceed the limit, you'll receive a 429 Too Many Requests response.

Next Steps