Prompt
availability checking API for bookings
Latest observation
Oct 24, 2026
OpenAI APIWeb search: off
Here’s a practical availability checking API design for bookings.
Core idea
An availability API answers:
- Is this resource/bookable item available?
- For what date/time range?
- How many units are available?
- What are the conflicting bookings or constraints?
Typical endpoint
GET /availability
Check availability for a resource.
Query parameters
resource_id— ID of the item/service/roomstart— start datetime (ISO 8601)end— end datetime (ISO 8601)quantity— number requestedtimezone— optional, e.g.UTC,America/New_York
Example request
GET /availability?resource_id=room_123&start=2026-10-24T10:00:00Z&end=2026-10-24T12:00:00Z&quantity=1
Example response
{
"resource_id": "room_123",
"start": "2026-10-24T10:00:00Z",
"end": "2026-10-24T12:00:00Z",
"requested_quantity": 1,
"available": true,
"available_quantity": 3,
"conflicts": [],
"hold_expires_at": null
}
If unavailable
{
"resource_id": "room_123",
"start": "2026-10-24T10:00:00Z",
"end": "2026-10-24T12:00:00Z",
"requested_quantity": 1,
"available": false,
"available_quantity": 0,
"conflicts": [
{
"booking_id": "bk_789",
"start": "2026-10-24T09:30:00Z",
"end": "2026-10-24T12:30:00Z",
"status": "confirmed"
}
]
}
Recommended booking flow
- Check availability
- Create a temporary hold/reservation
- Confirm booking
- Release/expire hold if not completed
This avoids race conditions where two users see the same slot as available.
Better: use a hold API too
POST /availability/hold
Creates a short-lived hold.
{
"resource_id": "room_123",
"start": "2026-10-24T10:00:00Z",
"end": "2026-10-24T12:00:00Z",
"quantity": 1,
"customer_id": "cust_456"
}
Response:
{
"hold_id": "hold_001",
"status": "held",
"expires_at": "2026-10-24T10:10:00Z"
}
Then:
POST /bookings
Use the hold to create the booking safely.
Important availability rules
Define these clearly:
- Time overlap logic: does
end == another.startcount as available? - Buffer time: cleaning/setup before or after bookings
- Capacity: multiple simultaneous bookings allowed if quantity permits
- Blocked times: maintenance, holidays, blackout periods
- Timezone handling: store in UTC, display in local timezone
- Minimum/maximum stay or duration
- Booking lead time: cannot book within X hours of start
Useful response fields
available— booleanavailable_quantity— remaining unitsconflicts— overlapping bookings or blocksnext_available_at— next open timehold_expires_at— if a hold is createdrules_applied— optional list of constraints used
Example: date-based availability
For hotel-style bookings, you may want:
GET /availability/calendar?resource_id=hotel_1&month=2026-10
Returns daily availability for a month.
{
"resource_id": "hotel_1",
"month": "2026-10",
"days": [
{ "date": "2026-10-24", "available": true, "available_quantity": 5 },
{ "date": "2026-10-25", "available": false, "available_quantity": 0 }
]
}
If you want, I can also provide:
- a REST API spec (OpenAPI)
- a database schema for availability/bookings
- a Node.js / Python implementation for the endpoint