Skip to main content

Hooks API Reference

The Hooks API provides a set of RESTful endpoints for managing various automated tasks and background jobs in the system. This API is designed to be used by internal services and scheduled jobs to perform system-wide operations.

Overview​

The Hooks API is primarily used for:

  • Managing automated buyback operations
  • Synchronizing blockchain transactions
  • Processing background jobs
  • Handling system-wide events

Authentication​

All endpoints in the Hooks API are protected by:

  • API Key authentication
  • Role-based access control
  • Specific role requirements for each endpoint

Base URL​

https://api.blockbet.gg/hooks

Common Response Format​

All endpoints follow a standard response format:

Success Response​

{
"status": "success"
}

Error Response​

{
"status": "failed",
"error": "Error message description"
}

Rate Limiting​

  • Rate limits are applied per API key
  • Standard rate limit: 100 requests per minute
  • Rate limit headers are included in responses:
    • X-RateLimit-Limit
    • X-RateLimit-Remaining
    • X-RateLimit-Reset

Error Handling​

The API uses standard HTTP status codes:

  • 200: Success
  • 400: Bad Request
  • 401: Unauthorized
  • 403: Forbidden
  • 404: Not Found
  • 429: Too Many Requests
  • 500: Internal Server Error

Available Endpoints​

BuyBack Operations​

  • Sync Buy Backs - Synchronizes buyback transactions from the blockchain

WebSocket Events​

Some operations may trigger WebSocket events that can be subscribed to for real-time updates. These events are documented in their respective endpoint sections.

Best Practices​

  1. Error Handling

    • Always check response status codes
    • Implement proper error handling for failed requests
    • Use exponential backoff for retries
  2. Rate Limiting

    • Monitor rate limit headers
    • Implement proper request throttling
    • Handle rate limit exceeded scenarios
  3. Security

    • Keep API keys secure
    • Rotate API keys regularly
    • Use environment variables for sensitive data
  4. Monitoring

    • Monitor endpoint health
    • Track response times
    • Log important events