Units API
Endpoints for managing individual property units.
Unit Object​
{
"id": "unit_789xyz",
"property_id": "prop_123abc",
"name": "Villa A",
"unit_number": "A-101",
"type": "3BR Villa",
"status": "available",
"bedrooms": 3,
"bathrooms": 3,
"size": {
"interior": 250,
"land": 400,
"unit": "sqm"
},
"price": {
"amount": 850000,
"currency": "USD"
},
"features": ["private_pool", "garden", "garage"],
"floor_plan": "https://cdn.propertybase.ai/...",
"gallery": ["https://cdn.propertybase.ai/..."],
"visibility": "public",
"assigned_agent": "agent_456",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:00:00Z"
}
List Units​
GET /v1/units
Query Parameters​
| Parameter | Type | Description |
|---|---|---|
property_id | string | Filter by property |
status | string | Filter by status |
min_price | number | Minimum price |
max_price | number | Maximum price |
bedrooms | number | Number of bedrooms |
min_size | number | Minimum size |
visibility | string | Filter by visibility |
agent_id | string | Filter by assigned agent |
Example Request​
curl -X GET "https://api.propertybase.ai/v1/units?status=available&bedrooms=3" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response​
{
"success": true,
"data": [
{
"id": "unit_789xyz",
"property_id": "prop_123abc",
"name": "Villa A",
"status": "available",
"bedrooms": 3,
"price": {
"amount": 850000,
"currency": "USD"
}
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 45,
"total_pages": 3
}
}
Get Unit​
GET /v1/units/:id
Query Parameters​
| Parameter | Type | Description |
|---|---|---|
expand | string | Include related data (property, agent) |
Example Request​
curl -X GET "https://api.propertybase.ai/v1/units/unit_789xyz?expand=property,agent" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response​
{
"success": true,
"data": {
"id": "unit_789xyz",
"property_id": "prop_123abc",
"name": "Villa A",
"status": "available",
"bedrooms": 3,
"bathrooms": 3,
"price": {
"amount": 850000,
"currency": "USD"
},
"property": {
"id": "prop_123abc",
"name": "Sunset Villas",
"location": {
"area": "Canggu",
"city": "Badung"
}
},
"agent": {
"id": "agent_456",
"name": "Sarah Martinez",
"email": "sarah@agency.com"
}
}
}
Create Unit​
POST /v1/units
Request Body​
| Field | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Parent property ID |
name | string | Yes | Unit name |
unit_number | string | No | Unit number/code |
type | string | No | Unit type |
status | string | No | Status (default: available) |
bedrooms | number | No | Number of bedrooms |
bathrooms | number | No | Number of bathrooms |
size | object | No | Size information |
price | object | Yes | Pricing |
features | array | No | Feature list |
visibility | string | No | Visibility setting |
assigned_agent | string | No | Agent ID |
Example Request​
curl -X POST "https://api.propertybase.ai/v1/units" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"property_id": "prop_123abc",
"name": "Villa D",
"unit_number": "A-104",
"type": "4BR Villa",
"status": "available",
"bedrooms": 4,
"bathrooms": 4,
"size": {
"interior": 320,
"land": 500,
"unit": "sqm"
},
"price": {
"amount": 1200000,
"currency": "USD"
},
"features": ["private_pool", "garden", "garage", "sea_view"],
"visibility": "public"
}'
Example Response​
{
"success": true,
"data": {
"id": "unit_new123",
"property_id": "prop_123abc",
"name": "Villa D",
"status": "available",
"created_at": "2024-01-25T11:00:00Z"
}
}
Update Unit​
PUT /v1/units/:id
Example Request​
curl -X PUT "https://api.propertybase.ai/v1/units/unit_789xyz" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "reserved",
"price": {
"amount": 825000,
"currency": "USD"
}
}'
Delete Unit​
DELETE /v1/units/:id
Example Request​
curl -X DELETE "https://api.propertybase.ai/v1/units/unit_789xyz" \
-H "Authorization: Bearer YOUR_API_KEY"
Bulk Operations​
Bulk Create​
POST /v1/units/bulk
Create multiple units at once:
curl -X POST "https://api.propertybase.ai/v1/units/bulk" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"units": [
{
"property_id": "prop_123abc",
"name": "Unit 101",
"bedrooms": 2,
"price": { "amount": 250000, "currency": "USD" }
},
{
"property_id": "prop_123abc",
"name": "Unit 102",
"bedrooms": 2,
"price": { "amount": 260000, "currency": "USD" }
}
]
}'
Bulk Update Status​
PATCH /v1/units/bulk/status
Update status for multiple units:
curl -X PATCH "https://api.propertybase.ai/v1/units/bulk/status" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"unit_ids": ["unit_123", "unit_456", "unit_789"],
"status": "off_market"
}'
Unit Status​
| Value | Description |
|---|---|
available | Available for sale |
reserved | Reserved by buyer |
sold | Sold and closed |
off_market | Temporarily unavailable |
rented | Currently rented |
Visibility Settings​
| Value | Description |
|---|---|
public | Visible on public website |
agents | Visible to all agents |
team | Visible to assigned team |
private | Visible to admins only |