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 |
/pos/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.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date |
string | No | Start date in YYYY-MM-DD format (defaults to today) |
end_date |
string | No | End date in YYYY-MM-DD format (defaults to today) |
location_id |
integer | No | Filter by location ID |
Example Request
curl -X GET "https://docsapi.bookandgo.app/api/payments/summary?start_date=2024-03-01&end_date=2024-03-31" \
-H "Authorization: Bearer YOUR_TOKEN"
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) |
start_date |
string | No | Start date in YYYY-MM-DD format (defaults to today) |
end_date |
string | No | End date in YYYY-MM-DD format (defaults to today, max 1 month range) |
page |
integer | No | Page number (default: 1) |
limit |
integer | No | Items per page (max 100) |
Example Request
curl -X GET "https://docsapi.bookandgo.app/api/payments/transactions?location_id=1&start_date=2024-03-01&end_date=2024-03-31" \
-H "Authorization: Bearer YOUR_TOKEN"
POS Transactions
Retrieve detailed Point of Sale product transaction records with pagination support. Covers all POS product sales including rentals.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
location_id |
integer | Yes | Location ID (required for indexing) |
start_date |
string | No | Start date in YYYY-MM-DD format (defaults to today) |
end_date |
string | No | End date in YYYY-MM-DD format (defaults to today, max 1 month range) |
page |
integer | No | Page number (default: 1) |
limit |
integer | No | Items per page (max 100, default: 50) |
created_at (when the sale was made), not by booking date. All dates are interpreted in Asia/Singapore timezone.
Example Request
curl -X GET "https://docsapi.bookandgo.app/api/pos/transactions?location_id=87&start_date=2026-04-14&end_date=2026-04-15" \
-H "Authorization: Bearer YOUR_TOKEN"
Response Structure
{
"date_range": { "start": "2026-04-14", "end": "2026-04-15" },
"club_id": 43,
"club_name": "Jungle Padel",
"location_id": 87,
"location_name": "pererenan",
"total_count": 1,
"page": 1,
"limit": 50,
"total_pages": 1,
"transactions": [
{
"payment_id": 85740,
"created_at": "2026-04-15T20:25:19+08:00",
"updated_at": "2026-04-15T20:25:19+08:00",
"location_id": 87,
"location": "pererenan",
"coupon_name": "",
"service_booking_id": 799021,
"user": {
"name": "John Doe",
"email": "[email protected]",
"phone_number": "+628123456"
},
"product": {
"id": 84,
"name": "Racket Rental",
"category_id": 65,
"category_name": "rental racket",
"quantity": 4
},
"rental": {
"hours": 2,
"start_time": "2026-04-15T10:00:00+08:00",
"end_time": "2026-04-15T12:00:00+08:00"
},
"payment": {
"method": "credit card",
"price": 200000,
"discount": 0,
"refund_amount": 0,
"refund_method": "",
"total_price": 200000
},
"sold_by": "[email protected]"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
product.name |
string | Product name |
product.category_name |
string | Product category |
product.quantity |
integer | Quantity sold |
product.variant_sku |
string | Variant SKU (if applicable) |
rental |
object | Only present for rental products (hours, start/end time) |
sold_by |
string | Staff email who processed the sale |
service_booking_id |
integer | Linked booking ID (if POS sale is tied to a booking) |
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 |