API Documentation
Overview
This API provides various functionalities related to order management for a voting website. The following endpoints are available:
- Get Services
- Add Order
- Get Order Status
- Get Balance
- Cancel Order
Each endpoint is accessed via a POST request to the
/v2
URL with a specific action parameter in the request body.Authentication
All endpoints require authentication using an API token.
Endpoints
Base URL
All endpoints must be sent to the base URL:
https://backend.toplistbot.com/api/v2
1. Get Services
Description
Retrieves a list of available services.
HTTP Method
POST
API URL
/v2
Request Body
{ "action": "services" }
Response Body
[ { "service": 1, "name": "Example Service 1000 votes", "type": "Default", "category": "Votes", "rate": 10.0, "min": 1, "max": 50000, "refill": false, "cancel": true } ]
2. Add Order
Description
Adds a new order for a voting service.
HTTP Method
POST
API URL
/v2
Request Body
{ "action": "add", "service": 1, "link": "<http://example.com>", "quantity": 100, "interval": 60 }
Response Body
{ "order_id": 123 }
3. Get Order Status
Description
Retrieves the status of one or multiple orders.
HTTP Method
POST
API URL
/v2
Request Body
{ "action": "status", "orders": "123,124,125" }
Response Body
{ "123": { "charge": 0, "start_count": 50, "status": "in progress", "remains": 50, "currency": "USD" }, "124": { "charge": 0, "start_count": 100, "status": "completed", "remains": 0, "currency": "USD" } }
4. Get Balance
Description
Retrieves the balance of the authenticated user.
HTTP Method
POST
API URL
/v2
Request Body
{ "action": "balance" }
Response Body
{ "balance": 100.0, "currency": "USD" }
5. Cancel Order
Description
Cancels one or multiple orders.
HTTP Method
POST
API URL
/v2
Request Body
{ "action": "cancel", "orders": "123,124,125" }
Response Body
[ { "order": "123", "cancel": 1, "refund": 10.0 }, { "order": "124", "cancel": { "error": "Order already completed and cannot be canceled" } } ]
Error Responses
For validation errors or any other issues, the API will respond with an appropriate error message and a corresponding HTTP status code.
Example Error Response
Validation Error
{ "errors": { "action": [ "The action field is required." ] } }
Unauthorized Access
{ "error": "Unauthorized access to order status" }
Invalid Action
{ "error": "Invalid action" }