EstateHub

Customer Lease APIs

Base URL: http://localhost:8000/api/v1
Prefix: /customers
Auth: Bearer token with customer role
Headers: Content-Type: application/json


1. Submit Lease Reservation

Creates a rental application and submits the configured lease-reservation payment for admin verification.

POST/customers/properties/{property_id}/lease-reservations/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "preferred_move_in_date": "2026-10-01",
  "preferred_duration_months": 12,
  "message": "I would like to lease this property for 12 months.",
  "transaction_id": "BFT-LEASE-RESERVATION-001",
  "payment_proof_url": "https://example.com/payment-proofs/lease-reservation-001.jpg"
}

Success Example

JSON
{
  "success": true,
  "message": "Lease reservation payment submitted for verification.",
  "data": {
    "rental_application": {
      "id": "923089a0-69e0-4377-a107-2d0289831203",
      "status": "submitted",
      "preferred_move_in_date": "2026-10-01",
      "preferred_duration_months": 12,
      "preferred_move_out_date": "2027-09-30",
      "message": "I would like to lease this property for 12 months.",
      "created_at": "2026-09-15T10:00:00Z"
    },
    "payment": {
      "id": "183e7ac0-df37-4f5a-8f09-a360a54037b4",
      "payment_for": "rental_reservation",
      "method": "bank_transfer",
      "status": "submitted",
      "transaction_id": "BFT-LEASE-RESERVATION-001",
      "payment_proof_url": "https://example.com/payment-proofs/lease-reservation-001.jpg"
    },
    "next_action": "Your lease reservation payment is awaiting admin verification."
  }
}

Notes

  • property_id must identify a property listed for rent.

  • The property must have available status.

  • The backend calculates the reservation amount from the administrator rental reservation setting: percentage or fixed amount, defaulting to 2% of the listed price.

  • The customer cannot provide or modify the reservation amount.

  • preferred_move_in_date is required.

  • preferred_duration_months is required and must be between 1 and 120.

  • message is optional.

  • transaction_id is required and may contain up to 120 characters.

  • payment_proof_url is optional but must be a valid URL when supplied.

  • The payment method is bank_transfer.

  • The payment is created with submitted status.

  • The rental application is created with submitted status.

  • The property remains available until the reservation payment is verified by an admin.

  • Another active rental application prevents a new reservation for the same property.

  • Save data.rental_application.id; it is required by the remaining-payment API.

  • A successful request returns HTTP 201 Created.

  • HTTP 400 Bad Request is returned when validation fails or the property cannot be reserved.

  • HTTP 401 Unauthorized is returned when authentication is missing or invalid.

  • HTTP 403 Forbidden is returned when the authenticated user is not a customer.


2. Submit Lease Remaining Payment

Submits a full or partial bank-transfer payment against the outstanding initial lease balance.

POST/customers/remaining-payments/leases/{rental_application_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "amount": "2000.00",
  "transaction_id": "BFT-LEASE-REMAINING-001",
  "payment_proof_url": "https://example.com/payment-proofs/lease-remaining-001.jpg"
}

Success Example

JSON
{
  "success": true,
  "message": "Remaining lease payment submitted for verification.",
  "data": {
    "rental_application_id": "923089a0-69e0-4377-a107-2d0289831203",
    "payment": {
      "id": "05bf6841-b2e4-4fc5-b034-c60271451170",
      "payment_for": "rent",
      "amount": "2000.00",
      "currency": "USD",
      "method": "bank_transfer",
      "status": "submitted",
      "transaction_id": "BFT-LEASE-REMAINING-001",
      "payment_proof_url": "https://example.com/payment-proofs/lease-remaining-001.jpg",
      "created_at": "2026-09-16T11:30:00Z"
    },
    "total_amount": "2250.00",
    "verified_amount": "45.00",
    "remaining_amount": "2205.00",
    "next_action": "This payment is awaiting admin verification."
  }
}

Notes

  • rental_application_id is obtained from data.rental_application.id in the lease-reservation response.

  • The rental application must belong to the authenticated customer.

  • The rental application must have reserved status.

  • The initial lease-reservation payment must have verified or paid status.

  • The total initial lease amount is the property’s listed rental price.

  • The outstanding balance is calculated as the total amount minus all verified reservation and rent payments.

  • amount is required and must be at least 1.00.

  • The payment can cover part or all of the outstanding balance.

  • The submitted amount cannot exceed the outstanding balance.

  • transaction_id is required and may contain up to 120 characters.

  • payment_proof_url is optional but must be a valid URL when supplied.

  • The payment method is bank_transfer.

  • The payment is created with payment_for: rent and status: submitted.

  • Only one pending, submitted, or partial remaining lease payment may exist at a time.

  • verified_amount includes the verified reservation payment and any previously verified remaining payments.

  • remaining_amount represents the balance before the newly submitted payment is verified.

  • The submitted amount is deducted only after admin verification.

  • Admins receive a payment-verification notification.

  • A successful request returns HTTP 201 Created.

  • HTTP 400 Bad Request is returned for an invalid amount, unverified reservation, invalid status, or an existing payment awaiting verification.

  • HTTP 401 Unauthorized is returned when authentication is missing or invalid.

  • HTTP 403 Forbidden is returned when the authenticated user is not a customer.

  • HTTP 404 Not Found is returned when the rental application does not exist or belongs to another customer.


Common Success Format

JSON
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {}
}

Common Error Format

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "field_name": [
      "Error description."
    ]
  }
}