Skip to main content

Player Bookings API

Manage your padel court bookings, create new reservations, and cancel existing bookings.

Get My Bookings

Retrieve all bookings for the authenticated player.

Endpoint

GET /api/bookings/my

Response

Returns an array of booking objects.
id
string (UUID)
required
Unique identifier for the booking
resourceId
string (UUID)
required
ID of the booked resource (court)
playerId
string (UUID)
required
ID of the player who made the booking
bookingDate
string (date)
required
Date of the booking in ISO format (YYYY-MM-DD)
startTime
string (time)
required
Start time of the booking in ISO format (HH:MM:SS)
endTime
string (time)
required
End time of the booking in ISO format (HH:MM:SS)
pricePaid
number
required
Amount paid for the booking
currency
string
required
Currency code (e.g., EUR, USD)
status
string
required
Booking status: PENDING, CONFIRMED, CANCELLED, COMPLETED
paymentStatus
string
required
Payment status: PENDING, PAID, FAILED, REFUNDED
cancelledAt
string (timestamp)
Timestamp when the booking was cancelled (if applicable)
cancelReason
string
Reason provided for cancellation
createdAt
string (timestamp)
required
Timestamp when the booking was created
updatedAt
string (timestamp)
required
Timestamp when the booking was last updated
expiresAt
string (timestamp)
Expiration timestamp for pending bookings
resourceName
string
Name of the booked resource
venueName
string
Name of the venue where the resource is located
venueCity
string
City where the venue is located

Example Request

curl -X GET "https://api.hub.example.com/api/bookings/my" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "resourceId": "660e8400-e29b-41d4-a716-446655440001",
    "playerId": "770e8400-e29b-41d4-a716-446655440002",
    "bookingDate": "2026-03-15",
    "startTime": "10:00:00",
    "endTime": "11:30:00",
    "pricePaid": 35.00,
    "currency": "EUR",
    "status": "CONFIRMED",
    "paymentStatus": "PAID",
    "cancelledAt": null,
    "cancelReason": null,
    "createdAt": "2026-03-08T12:34:56Z",
    "updatedAt": "2026-03-08T12:35:10Z",
    "expiresAt": null,
    "resourceName": "Court 1",
    "venueName": "Padel Center Madrid",
    "venueCity": "Madrid"
  }
]

Create Booking

Create a new court booking and initiate payment.

Endpoint

POST /api/bookings

Request Body

resourceId
string (UUID)
required
ID of the resource (court) to book
bookingDate
string (date)
required
Date for the booking in ISO format (YYYY-MM-DD)
startTime
string (time)
required
Start time for the booking in ISO format (HH:MM:SS)

Response

booking
object
required
The created booking object (same structure as in Get My Bookings)
clientSecret
string
required
Payment client secret for completing the payment

Example Request

curl -X POST "https://api.hub.example.com/api/bookings" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceId": "660e8400-e29b-41d4-a716-446655440001",
    "bookingDate": "2026-03-20",
    "startTime": "14:00:00"
  }'

Example Response

{
  "booking": {
    "id": "880e8400-e29b-41d4-a716-446655440003",
    "resourceId": "660e8400-e29b-41d4-a716-446655440001",
    "playerId": "770e8400-e29b-41d4-a716-446655440002",
    "bookingDate": "2026-03-20",
    "startTime": "14:00:00",
    "endTime": "15:30:00",
    "pricePaid": 40.00,
    "currency": "EUR",
    "status": "PENDING",
    "paymentStatus": "PENDING",
    "cancelledAt": null,
    "cancelReason": null,
    "createdAt": "2026-03-08T15:30:00Z",
    "updatedAt": "2026-03-08T15:30:00Z",
    "expiresAt": "2026-03-08T15:45:00Z",
    "resourceName": "Court 1",
    "venueName": "Padel Center Madrid",
    "venueCity": "Madrid"
  },
  "clientSecret": "pi_1ABC2DEF3GHI4JKL_secret_5MNO6PQR7STU8VWX"
}
The clientSecret should be used with your payment provider to complete the payment process. The booking will expire after 15 minutes if payment is not completed.

Cancel Booking

Cancel an existing booking.

Endpoint

PATCH /api/bookings/{id}/cancel

Path Parameters

id
string (UUID)
required
ID of the booking to cancel

Request Body

reason
string
Optional reason for cancelling the booking

Response

Returns the updated booking object with cancellation details.

Example Request

curl -X PATCH "https://api.hub.example.com/api/bookings/880e8400-e29b-41d4-a716-446655440003/cancel" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Unable to attend due to injury"
  }'

Example Response

{
  "id": "880e8400-e29b-41d4-a716-446655440003",
  "resourceId": "660e8400-e29b-41d4-a716-446655440001",
  "playerId": "770e8400-e29b-41d4-a716-446655440002",
  "bookingDate": "2026-03-20",
  "startTime": "14:00:00",
  "endTime": "15:30:00",
  "pricePaid": 40.00,
  "currency": "EUR",
  "status": "CANCELLED",
  "paymentStatus": "REFUNDED",
  "cancelledAt": "2026-03-08T16:00:00Z",
  "cancelReason": "Unable to attend due to injury",
  "createdAt": "2026-03-08T15:30:00Z",
  "updatedAt": "2026-03-08T16:00:00Z",
  "expiresAt": null,
  "resourceName": "Court 1",
  "venueName": "Padel Center Madrid",
  "venueCity": "Madrid"
}
Cancellation policies may vary by venue. Refunds are typically processed automatically if the booking is cancelled within the allowed timeframe.