Cloud Bet Bot API Documentation

Overview

The Cloud Bet Bot API provides endpoints for managing bets, users, and retrieving betting information. This documentation outlines the available endpoints, their functionality, and usage.

Base URL

The base URL for the API is: https://www.cloudbetbot.com/api/rpc/hooks

Authentication

All API requests require authentication using a service ID and access key. These should be included in the request body under the service object:

{ "service": { "id": "YOUR_SERVICE_ID", "access_key": "YOUR_ACCESS_KEY" } }

Endpoints

1. Get Bets

Endpoint: /get_bets

Method: POST

Description: Retrieves bet information within a specified date range.

Request Body:

{ "service": { "id": "YOUR_SERVICE_ID", "access_key": "YOUR_ACCESS_KEY" }, "params": { "from": "YYYY-MM-DD", "to": "YYYY-MM-DD" } }

Response: Returns a JSON object with bet information, including runner details, market data, and outcome if available.

Sample Response:

{ "success": true, "bets": [ { "runner": { "runner_id": "12345", "selectionId": "67890", "name": "Horse Name", "points": 2, "active": 1, "processed": 0, "settings_key": "strat1", "status": "ACTIVE", "marketId": "1.234567890" }, "market": { "marketId": "1.234567890", "startTime": "2023-05-15 14:30:00", "marketName": "Horse Race Winner", "marketType": "WIN", "venue": "Ascot" }, "outcome": { "side": "B", "ave_price": 3.5, "ave_points": 1.25, "outcome": "W" } } ] }

2. Get Users

Endpoint: /get_users

Method: POST

Description: Retrieves user information for the authenticated service.

Request Body:

{ "service": { "id": "YOUR_SERVICE_ID", "access_key": "YOUR_ACCESS_KEY" }, "params": [{}] }

Response: Returns a JSON array of user objects, including name, email, max stake, expiration date, and strategies.

Sample Response:

[ { "name": "John Doe", "email": "john@example.com", "max_stake": 100, "added": "2023-01-01 10:00:00", "expires": "2024-01-01", "strats": "strat1,strat2" }, { "name": "Jane Smith", "email": "jane@example.com", "max_stake": 200, "added": "2023-02-15 14:30:00", "expires": "2024-02-15", "strats": "strat1,strat3" } ]

3. Upsert Bets

Endpoint: /upsert_bets

Method: POST

Description: Adds or updates bet information in the system.

Request Body:

{ "service": { "id": "YOUR_SERVICE_ID", "access_key": "YOUR_ACCESS_KEY" }, "bets": [ { "marketId": "MARKET_ID", "selectionId": "SELECTION_ID", "active": true, "settings_key": "STRATEGY_KEY", "overrides": null, "points": 2 } ] }

Response: Returns a JSON object with the status of each bet upsert operation.

Sample Response:

{ "success": true, "bets": [ { "success": true, "message": "runner added", "runner_id": 12345, "active": 1, "points": 2, "marketId": "1.234567890", "selectionId": "67890", "settings_key": "strat1" } ] }

4. Upsert Users

Endpoint: /upsert_users

Method: POST

Description: Adds or updates user information in the system.

Request Body:

{ "service": { "id": "YOUR_SERVICE_ID", "access_key": "YOUR_ACCESS_KEY" }, "users": [ { "name": "USER_NAME", "email": "USER_EMAIL", "max_stake": 100, "expires": "YYYY-MM-DD", "strats": "strat1,strat2,strat3" } ] }

Response: Returns a JSON array with the status and details of each user upsert operation.

Sample Response:

[ { "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "email": "john@example.com", "expires": "2024-01-01", "max_stake": 100, "strats": "strat1,strat2,strat3" } ]

Error Handling

The API returns appropriate HTTP status codes along with error messages in the response body when requests fail. Common error scenarios include:

Always check the success field in the response to determine if the operation was successful.