Leads API
Endpoints for managing leads and the sales pipeline.
Lead Object​
{
"id": "lead_abc123",
"name": "John Smith",
"email": "john@example.com",
"phone": "+1234567890",
"source": "website",
"stage": "qualified",
"score": 75,
"assigned_agent": "agent_456def",
"interested_properties": ["unit_789xyz"],
"budget": {
"min": 500000,
"max": 750000,
"currency": "USD"
},
"timeline": "3_months",
"notes": "Looking for 3BR villa with pool",
"tags": ["hot", "investor"],
"last_contacted": "2024-01-24T10:00:00Z",
"next_follow_up": "2024-01-26T10:00:00Z",
"created_at": "2024-01-15T08:00:00Z",
"updated_at": "2024-01-24T10:00:00Z"
}
List Leads​
GET /v1/leads
Query Parameters​
| Parameter | Type | Description |
|---|---|---|
stage | string | Filter by pipeline stage |
source | string | Filter by lead source |
agent_id | string | Filter by assigned agent |
min_score | number | Minimum lead score |
property_id | string | Interested in property |
tags | string | Filter by tags (comma-separated) |
created_after | string | Created after date |
created_before | string | Created before date |
search | string | Search name/email/phone |
Example Request​
curl -X GET "https://api.propertybase.ai/v1/leads?stage=qualified&min_score=60" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response​
{
"success": true,
"data": [
{
"id": "lead_abc123",
"name": "John Smith",
"email": "john@example.com",
"stage": "qualified",
"score": 75,
"assigned_agent": "agent_456def",
"last_contacted": "2024-01-24T10:00:00Z"
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 150
}
}
Get Lead​
GET /v1/leads/:id
Query Parameters​
| Parameter | Type | Description |
|---|---|---|
expand | string | Include related data |
include_activity | boolean | Include activity log |
Example Request​
curl -X GET "https://api.propertybase.ai/v1/leads/lead_abc123?expand=agent,properties&include_activity=true" \
-H "Authorization: Bearer YOUR_API_KEY"
Create Lead​
POST /v1/leads
Request Body​
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Lead's full name |
email | string | Yes | Email address |
phone | string | No | Phone number |
source | string | No | Lead source |
interested_properties | array | No | Property/unit IDs |
budget | object | No | Budget range |
timeline | string | No | Purchase timeline |
notes | string | No | Initial notes |
assigned_agent | string | No | Agent to assign |
tags | array | No | Tags to apply |
Example Request​
curl -X POST "https://api.propertybase.ai/v1/leads" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Doe",
"email": "jane@example.com",
"phone": "+1987654321",
"source": "referral",
"interested_properties": ["unit_789xyz"],
"budget": {
"min": 600000,
"max": 900000,
"currency": "USD"
},
"timeline": "6_months",
"notes": "Referred by existing client",
"tags": ["referral", "serious_buyer"]
}'
Example Response​
{
"success": true,
"data": {
"id": "lead_new456",
"name": "Jane Doe",
"email": "jane@example.com",
"stage": "new",
"score": 65,
"created_at": "2024-01-25T14:00:00Z"
}
}
Update Lead​
PUT /v1/leads/:id
Example Request​
curl -X PUT "https://api.propertybase.ai/v1/leads/lead_abc123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"stage": "viewing",
"next_follow_up": "2024-01-28T10:00:00Z",
"notes": "Viewing scheduled for Villa A"
}'
Change Stage​
POST /v1/leads/:id/stage
Move a lead to a different pipeline stage.
Request Body​
| Field | Type | Required | Description |
|---|---|---|---|
stage | string | Yes | New stage |
reason | string | No | Reason for change |
notes | string | No | Additional notes |
Example Request​
curl -X POST "https://api.propertybase.ai/v1/leads/lead_abc123/stage" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"stage": "negotiation",
"notes": "Client made an offer"
}'
Mark as Won​
POST /v1/leads/:id/won
Request Body​
| Field | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Purchased property |
deal_value | number | Yes | Final deal value |
commission | number | No | Commission amount |
notes | string | No | Closing notes |
Example Request​
curl -X POST "https://api.propertybase.ai/v1/leads/lead_abc123/won" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"property_id": "unit_789xyz",
"deal_value": 825000,
"commission": 24750,
"notes": "Closed at asking price"
}'
Mark as Lost​
POST /v1/leads/:id/lost
Request Body​
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | Yes | Loss reason code |
notes | string | No | Additional details |
Example Request​
curl -X POST "https://api.propertybase.ai/v1/leads/lead_abc123/lost" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "bought_elsewhere",
"notes": "Purchased from competitor"
}'
Add Note​
POST /v1/leads/:id/notes
Example Request​
curl -X POST "https://api.propertybase.ai/v1/leads/lead_abc123/notes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Call summary: Discussed financing options",
"type": "call"
}'
Get Activity​
GET /v1/leads/:id/activity
Returns the activity timeline for a lead.
Example Response​
{
"success": true,
"data": [
{
"id": "activity_001",
"type": "stage_change",
"description": "Stage changed from 'qualified' to 'viewing'",
"user": "agent_456def",
"timestamp": "2024-01-24T10:00:00Z"
},
{
"id": "activity_002",
"type": "note",
"description": "Added note: Viewing scheduled for Friday",
"user": "agent_456def",
"timestamp": "2024-01-24T10:05:00Z"
}
]
}
Lead Stages​
| Stage | Description |
|---|---|
new | Newly created, not contacted |
contacted | Initial contact made |
qualified | Budget and needs confirmed |
viewing | Property viewing scheduled |
negotiation | Offer and terms discussion |
won | Deal closed successfully |
lost | Deal not closed |
Lead Sources​
| Source | Description |
|---|---|
website | Website inquiry |
referral | Client referral |
portal | Property portal |
social | Social media |
walk_in | Walk-in inquiry |
api | API integration |
manual | Manual entry |
Loss Reasons​
| Reason | Description |
|---|---|
price_too_high | Price too high |
location_not_suitable | Location not suitable |
bought_elsewhere | Bought from competitor |
no_longer_interested | Lost interest |
unresponsive | No response |
financing_failed | Could not secure financing |
other | Other reason |