GreenFlow docs

Bookings

Create, fetch, and cancel reservations. Each booking owns a booking_code from the provider and a local_number internal to GreenFlow; both are accepted as {code}.

POST /bookings — create

Consumes the tokenc minted by POST /fleet/show. On 201, the server persists a Booking + Sale, queues the voucher PDF job, and sends the confirmation email.

Fields

Field Type Notes
brandintrequired. Same vendor id as in /fleet/list.
pickup_location / dropoff_locationstringrequired. Office code.
pickup_date / dropoff_datedatetimerequired. Format Y-m-d\TH:i:s (no offset).
ratestringrequired. From rates[].code.
vehicle_codestringrequired. From cars[].vehicle_code.
tokencuuidrequired. From /fleet/show.
coupon_codestringoptional. See coupons.
customer.*objectrequired. See curl below.
airline / frequent_flyerobjectoptional. Propagated to ABG/ANE adapters.
mail_notification / sms_notificationboolDefaults true / false.
bash
curl -X POST https://greenflow.live/api/v1/bookings \
  -H "Authorization: Bearer gfc_7s2wprmy_DWTZRBGBEV6La4dTOoFdMkEhWmWCsXdwc3zVMnqP" \
  -H "Content-Type: application/json" \
  -d '{
    "brand": 11,
    "pickup_location": "AACGH", "dropoff_location": "AACGH",
    "pickup_date": "2026-05-15T10:00:00", "dropoff_date": "2026-05-18T10:00:00",
    "rate": "011880", "vehicle_code": "B",
    "tokenc": "836c7fb31f624ca2a8b5a519f26825d2",
    "customer": {
      "name": "Joao", "lastname": "Silva", "email": "joao@example.com", "age": 30,
      "address": { "country_code": "BR" },
      "telephone": { "phone_number": "11987654321" }
    }
  }'
json
{
  "data": {
    "uuid": "01935f1e-9b0a-7c88-b9e3-3f7c8e9d1a02",
    "booking_code": "BR-1234567",
    "local_number": "GFC042389XY",
    "brand": "LOCALIZA",
    "name": "Joao", "last_name": "Silva",
    "voucher": { "status": "queued" }
  }
}

Side effects

  1. Creates a Booking (status RESERVED) and Sale (PENDING) in a DB transaction.
  2. Queues the voucher PDF emission + booking confirmation email.
  3. Dispatches the booking.created webhook event.
  4. Writes a booking.created audit log row.

GET /bookings/{code}

Requires lastname as a query parameter — lightweight pseudo-auth so the code alone is not sufficient to read the booking.

bash
curl -s "https://greenflow.live/api/v1/bookings/BR-1234567?lastname=Silva" \
  -H "Authorization: Bearer gfc_7s2wprmy_DWTZRBGBEV6La4dTOoFdMkEhWmWCsXdwc3zVMnqP"
json
{
  "data": {
    "uuid": "01935f1e-9b0a-7c88-b9e3-3f7c8e9d1a02",
    "booking_code": "BR-1234567",
    "local_number": "GFC042389XY",
    "status": "RESERVED",
    "pickup_date": "2026-05-15 10:00:00",
    "dropoff_date": "2026-05-18 10:00:00",
    "gds": { "booking_code": "BR-1234567", "status": "RESERVED" }
  }
}

DELETE /bookings/{code}

Cancels upstream. If a coupon was applied, it is reverted and the usage slot freed.

bash
curl -X DELETE https://greenflow.live/api/v1/bookings/BR-1234567 \
  -H "Authorization: Bearer gfc_7s2wprmy_DWTZRBGBEV6La4dTOoFdMkEhWmWCsXdwc3zVMnqP"
json
{ "data": { "success": true, "booking_code": "BR-1234567", "local_number": "GFC042389XY" } }

Errors

HTTPBody
401{"message": "Invalid API key"}
422{"error": {"message": "RATE NOT AVAILABLE FOR THIS CAR CLASS"}}
422{"error": "coupon_validation_failed", "reason": "coupon_expired"}
404Cross-tenant booking or mismatched lastname.