Skip to main content

API Reference Overview

Complete API reference documentation for the SBM CRM Platform. All endpoints are RESTful and return JSON responses.

Base URL

All API services use the same base URL with service-specific paths:

https://api.sbmcrm.example.com/{service}/api

Where {service} is one of:

  • auth - Authentication and member management
  • point - Points management
  • reward - Rewards management
  • cluster - Tiers, badges, and interests
  • notification - Notifications and messaging

Authentication

All API requests require authentication. See the Authentication Guide for details.

Authorization: Bearer YOUR_ACCESS_TOKEN

API Endpoints

Auth Service API

Authentication, authorization, and member management.

Point Service API

Points management, transactions, and receipt verification.

Reward Service API

Reward management, redemption, and catalog system.

Cluster Service API

Membership tiers, badges, and member interests.

Notification Service API

In-app notifications, email templates, and messaging.

Common Patterns

Request Format

All requests use the service-specific base path:

POST /{service}/api/resource
Authorization: Bearer TOKEN
Content-Type: application/json

{
"field1": "value1",
"field2": "value2"
}

For endpoints that accept file uploads, use multipart/form-data:

POST /{service}/api/resource
Authorization: Bearer TOKEN
Content-Type: multipart/form-data

[form data with fields and files]

Response Format

Success responses follow this structure:

{
"statusCode": 200,
"data": {
"id": "12345",
"name": "Example"
}
}

For paginated responses:

{
"statusCode": 200,
"data": {
"meta": {
"page": 1,
"limit": 20,
"total": 150,
"totalPages": 8
},
"data": [...]
}
}

Error Format

Error responses follow this structure:

{
"statusCode": 400,
"data": {
"message": "Error description",
"errors": [
{
"field": "field_name",
"message": "Validation message"
}
]
}
}

Rate Limiting

  • Standard: 1,000 requests/hour
  • Premium: 10,000 requests/hour
  • Enterprise: Custom limits

Rate limit headers:

  • X-RateLimit-Limit - Total requests allowed
  • X-RateLimit-Remaining - Remaining requests
  • X-RateLimit-Reset - Reset timestamp

Pagination

List endpoints support pagination:

GET /{service}/api/resource?page=1&limit=20

Response includes pagination metadata in the meta field:

{
"statusCode": 200,
"data": {
"meta": {
"page": 1,
"limit": 20,
"total": 150,
"totalPages": 8
},
"data": [...]
}
}

Default pagination values vary by service, typically:

  • Default page: 1
  • Default limit: 10-20 (varies by endpoint)
  • Maximum limit: 100

Filtering

Many endpoints support filtering using query parameters:

GET /api/resource?status=active&type=voucher

Some endpoints support advanced filtering with multiple criteria. Check individual service documentation for specific filter options.

Sorting

Sorting support varies by endpoint. Some endpoints support sorting using query parameters:

GET /api/resource?sortBy=createdAt&sortOrder=desc

Check individual service documentation for specific sorting capabilities.

HTTP Status Codes

  • 200 OK - Success
  • 201 Created - Resource created
  • 400 Bad Request - Invalid request
  • 401 Unauthorized - Authentication required
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Resource not found
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error

API Versioning

The API uses URL versioning. Current version is v1. Future versions will be at /v2, /v3, etc.

SDKs

Official SDKs available:

  • JavaScript/Node.js: @sbmcrm/sdk-js
  • Python: sbmcrm-python
  • PHP: sbmcrm-php

Support

For API support, contact the development team or refer to the Developer Guide.