Skip to content

Create a booking

The Fstop API includes an endpoint that allows client applications to create new bookings in the database.

In this guide, you’ll make a POST request to the /api/bookings/ endpoint to create a new booking for a project.

Before you make a POST request, ensure that you have an access token. For instructions on requesting an access token, see Getting started with the Fstop API.

You’ll also need the UUID of an existing project to associate with the booking. To get the UUID, use the /api/projects endpoint.

  1. Open a terminal and run the following command:

    create_booking.sh
    curl -X POST http://localhost:8000/api/bookings/ \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
    "project_id": "660e8400-e29b-41d4-a716-446655440000",
    "date": "2026-06-15",
    "time": "14:00:00",
    "duration": 480,
    "location": "Downtown Venue"
    }'

    The API returns a 201 CREATED and the details of the newly created booking:

    create_booking_response.json
    {
    "id": "770e8400-e29b-41d4-a716-446655440001",
    "project": {
    "id": "660e8400-e29b-41d4-a716-446655440000",
    "project_name": "Wedding",
    "project_type": "event",
    "client": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "first_name": "John",
    "last_name": "Doe",
    "city": "Cleveland",
    "state": "OH",
    "zip_code": "44122",
    "email": "john.doe@example.com",
    "phone_number": "+12161231234",
    "created_at": "2026-05-21T10:00:00Z"
    },
    "created_at": "2026-05-21T10:15:00Z"
    },
    "date": "2026-06-15",
    "time": "14:00:00",
    "duration": 480,
    "location": "Downtown Venue",
    "created_at": "2026-05-21T10:30:00Z"
    }
  2. Using the Python SDK:

    create_booking.py
    from fstop import Fstop
    from datetime import date
    with Fstop(jwt_auth="YOUR_ACCESS_TOKEN") as f_client:
    created_booking = f_client.bookings.create_booking(
    project_id="660e8400-e29b-41d4-a716-446655440000",
    date_=date.fromisoformat("2026-06-15"),
    time="14:00:00",
    duration=480,
    location="Downtown Venue"
    )
    print(f"Booking created with ID: {created_booking.id}")

You can use the returned booking data in your application. The id field uniquely identifies the booking and can be used to create galleries or update the booking details.

See POST /api/bookings/ for a full list of request parameters and response schemas.