EstateHub

Administrator Deal Workflow API

Base URL: http://localhost:8000/api/v1
Prefix: /admins
Auth: Admin JWT Bearer token
Headers: Content-Type: application/json


1. List Deals

Returns paginated purchase or lease deals for the admin deals page.

GET/admins/deals/?type=buy

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Deals retrieved successfully.",
  "data": {
    "deals": {
      "count": 1,
      "next": null,
      "previous": null,
      "results": [
        {
          "transaction_type": "buy",
          "transaction_id": "3fd29cd3-4d59-4b91-9ca4-5957b0a515bc",
          "status": "payment_pending",
          "current_stage": "complete_purchase",
          "workflow_completed": false,
          "property": {
            "id": "790656dd-169d-4612-a890-5f42ce49ef22",
            "title": "Luxury Apartment, London",
            "price": "435000.00",
            "currency": "USD",
            "address": "591 Example Lane, Austin, TX 78701",
            "image_url": "https://example.com/properties/apartment.jpg"
          },
          "customer": {
            "id": "5ef04185-af03-47af-bb59-c58cc8867b76",
            "full_name": "Mac Williamson",
            "email": "mac@example.com",
            "phone": "+15125550100"
          },
          "checklist_summary": {
            "total_items": 16,
            "completed_items": 3,
            "current_stage_required_items": 5,
            "current_stage_completed_items": 2,
            "can_complete_stage": false
          },
          "created_at": "2026-10-05T10:15:00+06:00",
          "updated_at": "2026-10-05T11:30:00+06:00"
        }
      ]
    }
  }
}

Notes

  • type is required and accepts buy or lease.

  • Optional filters: status, stage, search, and page.

  • search matches the deal UUID, property title, customer name, or customer email.

  • Buy stages: reserved, complete_purchase, ownership_transfer, buy_handover.

  • Lease stages: reserved, complete_lease, move_in_handover.

  • Returns 400 when filters are missing or invalid.

  • Returns 401 for missing or invalid authentication.

  • Returns 403 when the authenticated user is not an admin.


2. Get Deal Checklist

Returns the property, customer, current stage, milestones, and checklist progress for one deal.

GET/admins/deals/{transaction_type}/{transaction_id}/checklist/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Deal checklist retrieved successfully.",
  "data": {
    "transaction_type": "buy",
    "transaction_id": "3fd29cd3-4d59-4b91-9ca4-5957b0a515bc",
    "status": "payment_pending",
    "current_stage": "complete_purchase",
    "workflow_completed": false,
    "property": {
      "id": "790656dd-169d-4612-a890-5f42ce49ef22",
      "title": "Luxury Apartment, London",
      "price": "435000.00",
      "currency": "USD"
    },
    "customer": {
      "id": "5ef04185-af03-47af-bb59-c58cc8867b76",
      "full_name": "Mac Williamson",
      "email": "mac@example.com",
      "phone": "+15125550100"
    },
    "summary": {
      "total_items": 16,
      "completed_items": 3,
      "current_stage_required_items": 5,
      "current_stage_completed_items": 2,
      "can_complete_stage": false
    },
    "milestones": [
      {
        "stage": "reserved",
        "title": "Reserved",
        "sort_order": 1,
        "status": "completed",
        "items": []
      },
      {
        "stage": "complete_purchase",
        "title": "Complete Purchase",
        "sort_order": 2,
        "status": "in_progress",
        "items": [
          {
            "id": 4,
            "key": "agreement_prepared",
            "title": "Agreement prepared",
            "sort_order": 3,
            "assigned_to": "seller",
            "verified_by_role": "admin",
            "status": "pending",
            "is_required": true,
            "requires_attachment": false,
            "note": "",
            "attachment_url": "",
            "completed_by": null,
            "verified_by": null,
            "completed_at": null
          }
        ]
      },
      {
        "stage": "ownership_transfer",
        "title": "Ownership Transfer",
        "sort_order": 3,
        "status": "locked",
        "items": []
      },
      {
        "stage": "buy_handover",
        "title": "Completed / Handover",
        "sort_order": 4,
        "status": "locked",
        "items": []
      }
    ]
  }
}

Notes

  • {type} accepts buy or lease.

  • transaction_id is the purchase or rental-application UUID, not a bank transaction reference.

  • Future milestones have the locked status.

  • Returns 400 for an invalid deal type.

  • Returns 401 for missing or invalid authentication.

  • Returns 403 when the user is not an admin.

  • Returns 404 when the deal does not exist.


3. Update Deal Checklist

Updates one or more checklist items in a single request.

PATCH/admins/deals/{transaction_type}/{transaction_id}/checklist/

Auth: Required

Headers

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

Request Body

JSON
{
  "items": [
    {
      "checklist_item_id": 4,
      "status": "completed",
      "note": "Agreement checked by the legal team.",
      "attachment_url": "https://example.com/documents/agreement.pdf"
    },
    {
      "checklist_item_id": 5,
      "status": "blocked",
      "note": "Waiting for the buyer's signature.",
      "attachment_url": ""
    }
  ]
}

Success Example

JSON
{
  "success": true,
  "message": "Deal checklist updated successfully.",
  "data": {
    "transaction_type": "buy",
    "transaction_id": "3fd29cd3-4d59-4b91-9ca4-5957b0a515bc",
    "status": "payment_pending",
    "current_stage": "complete_purchase",
    "workflow_completed": false,
    "property": {
      "id": "790656dd-169d-4612-a890-5f42ce49ef22",
      "title": "Luxury Apartment, London",
      "price": "435000.00",
      "currency": "USD"
    },
    "customer": {
      "id": "5ef04185-af03-47af-bb59-c58cc8867b76",
      "full_name": "Mac Williamson",
      "email": "mac@example.com",
      "phone": "+15125550100"
    },
    "summary": {
      "total_items": 16,
      "completed_items": 4,
      "current_stage_required_items": 5,
      "current_stage_completed_items": 3,
      "can_complete_stage": false
    },
    "milestones": []
  }
}

Notes

  • Supported statuses: pending, completed, and blocked.

  • Checklist item IDs must be unique within the request.

  • A blocked item requires a non-empty note.

  • An item requiring an attachment cannot be completed without attachment_url.

  • Current-stage and previous-stage items can be updated.

  • Future-stage items cannot be updated.

  • Completing an item does not automatically advance the stage.

  • Returns 400 for invalid, inactive, wrong-type, duplicate, or future-stage items.

  • Returns 401 for missing or invalid authentication.

  • Returns 403 when the user is not an admin.

  • Returns 404 when the deal does not exist.


4. Complete Current Stage

Validates the current checklist and advances the deal to its next stage.

POST/admins/deals/{transaction_type}/{transaction_id}/checklist/complete-stage/

Auth: Required

Headers

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

Request Body

JSON
{
  "lease": {
    "start_date": "2026-11-01",
    "end_date": "2027-10-31",
    "monthly_rent": "2500.00",
    "security_deposit": "2500.00",
    "additional_fees": "0.00",
    "payment_due_day": 1,
    "agreement_url": "https://example.com/documents/signed-lease.pdf",
    "auto_billing_enabled": false
  }
}

Success Example

JSON
{
  "success": true,
  "message": "Current deal stage completed successfully.",
  "data": {
    "transaction_type": "lease",
    "transaction_id": "2df6481e-41f3-44d8-b91c-b64526fc1e5d",
    "status": "approved",
    "current_stage": "move_in_handover",
    "workflow_completed": false,
    "property": {
      "id": "790656dd-169d-4612-a890-5f42ce49ef22",
      "title": "Luxury Apartment, London",
      "price": "2500.00",
      "currency": "USD"
    },
    "customer": {
      "id": "5ef04185-af03-47af-bb59-c58cc8867b76",
      "full_name": "Mac Williamson",
      "email": "mac@example.com",
      "phone": "+15125550100"
    },
    "summary": {
      "total_items": 11,
      "completed_items": 6,
      "current_stage_required_items": 5,
      "current_stage_completed_items": 0,
      "can_complete_stage": false
    },
    "milestones": []
  }
}

Notes

  • Purchase stage completion uses an empty body: {}.

  • Lease details are required only when moving from complete_lease to move_in_handover.

  • All required current-stage checklist items must be completed.

  • Purchase progression requires the applicable reservation or full purchase payment to be verified.

  • Lease progression requires the applicable reservation or full initial lease amount to be verified.

  • Completing ownership_transfer marks the purchase completed and the property sold.

  • Completing complete_lease creates an active lease and marks the property rented.

  • Closed purchase or lease deals cannot advance.

  • A canceled lease cannot be reopened through this endpoint.

  • Another active lease for the same property blocks completion.

  • Every successful completion creates an audit record.

  • Returns 400 for incomplete checklist items, unverified payments, invalid transitions, invalid lease details, or conflicting active leases.

  • Returns 401 for missing or invalid authentication.

  • Returns 403 when the user is not an admin.

  • Returns 404 when the deal does not exist.



5. List Checklist Items

Lists configurable deal checklist definitions.

GET/admins/checklist-items/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Checklist items retrieved successfully.",
  "data": {
    "checklist_items": []
  }
}

Notes

  • Optional filters are transaction_type, stage, and is_active.

6. Create Checklist Item

Creates a deal checklist definition.

POST/admins/checklist-items/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Request Body

JSON
{
  "transaction_type": "buy",
  "stage": "reservation",
  "title": "Verify reservation payment",
  "sort_order": 10,
  "assigned_to": "admin",
  "verified_by": "admin",
  "requires_attachment": false,
  "is_required": true,
  "is_active": true
}

Success Example

JSON
{
  "success": true,
  "message": "Checklist item created successfully.",
  "data": {
    "checklist_item": {
      "id": 17,
      "transaction_type": "buy",
      "stage": "reservation",
      "title": "Verify reservation payment",
      "is_active": true
    }
  }
}

Notes

  • The stage and assigned roles must belong to the selected transaction type.

7. Get Checklist Item

Returns one checklist definition.

GET/admins/checklist-items/{checklist_item_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Checklist item retrieved successfully.",
  "data": {
    "checklist_item": {
      "id": 17,
      "key": "verify-reservation-payment",
      "is_in_use": false,
      "can_delete": true
    }
  }
}

8. Update Checklist Item

Partially updates one checklist definition.

PATCH/admins/checklist-items/{checklist_item_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Request Body

JSON
{
  "title": "Confirm reservation payment",
  "sort_order": 20
}

Success Example

JSON
{
  "success": true,
  "message": "Checklist item updated successfully.",
  "data": {
    "checklist_item": {
      "id": 17,
      "title": "Confirm reservation payment",
      "sort_order": 20
    }
  }
}

Notes

  • The transaction type cannot change after the item has progress records.

9. Delete Checklist Item

Deletes an unused checklist definition.

DELETE/admins/checklist-items/{checklist_item_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Checklist item deleted successfully.",
  "data": {}
}

Notes

  • Checklist definitions already referenced by progress records cannot be deleted.

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."
    ]
  }
}