Build with Book & Go
A powerful, secure REST API for integrating court booking data, payments, and live events into your automation systems.
Authentication
All API endpoints (except login) require JWT authentication. Tokens are designed for long-term automation, valid for 10 years.
Bearer Token
Include your JWT token in the Authorization header of every request.
Authorization: Bearer YOUR_JWT_TOKEN
Rate Limiting
To ensure system stability, API endpoints have rate limits based on their database load. Limits are applied per JWT token.
| Endpoint | Limit | Period |
|---|---|---|
/locations |
60 requests | per minute |
/bookings |
60 requests | per minute |
/payments/summary |
30 requests | per minute |
/payments/transactions |
10 requests | per minute |
/events/live |
30 requests | per minute |
Login
Authenticate with email and password to receive a long-lived JWT token.
Request Body
{
"email": "[email protected]",
"password": "your-password"
}
Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"club_id": 1,
"club_name": "Your Club Name",
"user_name": "Admin User",
"expires_at": 2073037187
}
Locations
Retrieve all locations for your club. Use this to get location IDs required by other endpoints.
Example Request
curl -X GET "https://docsapi.bookandgo.app/api/locations" \
-H "Authorization: Bearer YOUR_TOKEN"
Response Fields
| Field | Type | Description |
|---|---|---|
id |
integer | Unique location identifier (use this for location_id parameter) |
location_name |
string | Display name of the location |
currency |
string | Currency code (e.g., IDR, SGD) |
Bookings
Retrieve court bookings for your club within a date range.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date |
string | No | Start date (YYYY-MM-DD) |
end_date |
string | No | End date (YYYY-MM-DD) |
location_id |
integer | No | Filter by location |
Example Request
curl -X GET "https://docsapi.bookandgo.app/api/bookings?start_date=2024-03-01&end_date=2024-03-31" \
-H "Authorization: Bearer YOUR_TOKEN"
Payments Summary
Get aggregated payment data including revenue, refunds, and breakdowns by payment method.
Response Structure
{
"date_range": {
"start": "2024-03-01",
"end": "2024-03-31"
},
"summary": {
"total_revenue": 150000.00,
"service_payments": 100000.00,
"pos_payments": 40000.00,
"refunds": 5000.00
},
"by_status": {
"paid": 145000.00,
"pending": 2000.00,
"cancelled": 3000.00
},
"by_method": [
{
"method": "Credit Card",
"amount": 50000.00,
"count": 25
}
]
}
Payment Transactions
Retrieve detailed payment transaction records with pagination support.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
location_id |
integer | Yes | Location ID (required for indexing) |
page |
integer | No | Page number (default: 1) |
limit |
integer | No | Items per page (max 100) |
Live Events
Retrieve upcoming and current events with participant counts, details, and images.
Response
{
"club_id": 1,
"club_name": "Example Club",
"total_count": 5,
"events": [
{
"event_id": 835,
"event_name": "Morning Americano Tournament",
"current_participants": 8,
"maximum_capacity": 12,
"price": 250000,
"date": "2025-10-20",
"location": { "id": 145, "name": "Main Location" }
}
]
}
Quick Start
1. Get your Token
Authenticate using the Login endpoint to receive your JWT.
2. Find Locations
Call /locations to get the IDs needed for other requests.
3. Make Requests
Use the token in the Authorization header for all other calls.
Example: Get Token
curl -X POST https://docsapi.bookandgo.app/api/login \
-H "Content-Type: application/json" \
-d '{"email": "your-email", "password": "your-password"}'
Pagination Pattern
Handle paginated responses in the transactions endpoint.
async function fetchAllTransactions(locationId) {
let allTransactions = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const response = await fetch(
`.../payments/transactions?location_id=${locationId}&page=${page}`,
{ headers: { 'Authorization': 'Bearer TOKEN' } }
);
const data = await response.json();
allTransactions = allTransactions.concat(data.transactions);
hasMore = page < data.total_pages;
page++;
// Wait to respect rate limits
await new Promise(r => setTimeout(r, 6000));
}
return allTransactions;
}
Error Handling
| Code | Description | Action |
|---|---|---|
200 |
Success | Process the response |
400 |
Bad Request | Check your parameters |
401 |
Unauthorized | Check your JWT token |
429 |
Too Many Requests | Wait and retry |