Sync API Reference
This document provides detailed information about the Sync API endpoints, which are designed for data synchronization between the BlockBet platform and external systems, as well as internal data synchronization.
Authentication​
All endpoints in the Sync API require:
- Valid API key in the request header
- Specific roles depending on the endpoint:
- CLOUD_TASKS role for task-related operations
- CLOUD_SCHEDULES role for scheduled job operations
Endpoints​
Sync Tasks​
Create Sync Tasks For Users​
Creates distributed tasks to synchronize user details.
GET /sync-tasks/sync-users-master
Query Parameters​
Parameter | Type | Description | Required |
---|---|---|---|
index | number | The starting index for pagination | Yes |
count | number | The number of records to retrieve | Yes |
Response​
{
"status": "success"
}
Error Responses​
400 Bad Request
: When the parameters are missing or invalid401 Unauthorized
: When the API key is invalid or missing403 Forbidden
: When the request doesn't have the required CLOUD_TASKS role
Sync Jobs​
Sync Sportsbook Promo Feed​
Synchronizes the sports book promotional feed data from the Betby provider.
GET /sync-jobs/sync-sportsbook-promo-feed
Response​
{
"status": "success"
}
Error Responses​
401 Unauthorized
: When the API key is invalid or missing403 Forbidden
: When the request doesn't have the required CLOUD_SCHEDULES role
Usage Examples​
cURL Example - Create Sync Tasks For Users​
curl -X GET \
'http://api.example.com/sync-tasks/sync-users-master?index=0&count=100' \
-H 'X-API-KEY: your-api-key'
cURL Example - Sync Sportsbook Promo Feed​
curl -X GET \
'http://api.example.com/sync-jobs/sync-sportsbook-promo-feed' \
-H 'X-API-KEY: your-api-key'
Operational Considerations​
Rate Limiting​
These endpoints have strict rate limits to prevent system overload:
- 10 requests per minute for Create Sync Tasks For Users
- 1 request per minute for Sync Sportsbook Promo Feed
Processing Patterns​
The Sync API implements several important processing patterns:
- Pagination: Using offset-based pagination to process large datasets
- Chunking: Processing data in manageable batches to avoid memory issues
- Distributed Tasks: Creating cloud tasks for asynchronous processing
- Scheduled Execution: Controlling execution timing to prevent system overload
Best Practices​
- Pagination Parameters: Start with smaller page sizes (e.g., 100 records) to ensure efficient processing
- Scheduling: Schedule sync jobs during off-peak hours to minimize system impact
- Monitoring: Monitor task execution to ensure all synchronization tasks complete successfully
- Error Handling: Implement proper error handling in clients making API calls
Security Considerations​
- API Key Protection: Keep your API key secure and don't expose it in client-side code
- Role Assignment: Ensure that only appropriate services have the required roles
- Access Control: These endpoints should only be accessed by authorized internal systems