Overview
Submit a property appraisal or contact request. This endpoint stores the request in the database and sends an email notification to the administration team via Resend.
This endpoint requires authentication. Users must be logged in to submit contact requests.
Authentication
Requires an authenticated user via the requireAuth middleware. Include a valid session cookie or authentication token.
Request Body
Full name of the person making the request (minimum 1 character)
Email address (must be a valid email format)
Phone number (minimum 5 characters)
Preferred hours for contact (minimum 1 character)
Type of operation: "venta" (sale), "alquiler" (rent), or "valuacion" (appraisal)
Type of property (e.g., “Casa”, “Departamento”)
Property location or area of interest
Detailed description of the request (minimum 1 character)
Response
Indicates if the request was submitted successfully
Response data ID of the created contact request
Success Response (201)
Validation Error (400)
Server Error (500)
{
"success" : true ,
"data" : {
"id" : 42 ,
"message" : "Contact request submitted successfully"
}
}
Request Example
curl -X POST https://api.example.com/api/contact/appraisal \
-H "Content-Type: application/json" \
-H "Cookie: session=..." \
-d '{
"name": "María González",
"email": "[email protected] ",
"phone": "+54 11 1234-5678",
"availableHours": "Lunes a Viernes 14-18hs",
"operationType": "venta",
"propertyType": "Casa",
"location": "Palermo, CABA",
"description": "Necesito tasar mi casa de 3 ambientes en Palermo para ponerla en venta."
}'
const response = await fetch ( '/api/contact/appraisal' , {
method: 'POST' ,
headers: {
'Content-Type' : 'application/json' ,
},
credentials: 'include' ,
body: JSON . stringify ({
name: 'María González' ,
email: '[email protected] ' ,
phone: '+54 11 1234-5678' ,
availableHours: 'Lunes a Viernes 14-18hs' ,
operationType: 'venta' ,
propertyType: 'Casa' ,
location: 'Palermo, CABA' ,
description: 'Necesito tasar mi casa de 3 ambientes en Palermo para ponerla en venta.'
})
});
const data = await response . json ();
import requests
response = requests.post(
'https://api.example.com/api/contact/appraisal' ,
json = {
'name' : 'María González' ,
'email' : '[email protected] ' ,
'phone' : '+54 11 1234-5678' ,
'availableHours' : 'Lunes a Viernes 14-18hs' ,
'operationType' : 'venta' ,
'propertyType' : 'Casa' ,
'location' : 'Palermo, CABA' ,
'description' : 'Necesito tasar mi casa de 3 ambientes en Palermo para ponerla en venta.'
},
cookies = { 'session' : '...' }
)
data = response.json()
Validation Rules
The endpoint uses Zod schema validation:
name: Required, minimum 1 character
email: Required, must be valid email format
phone: Required, minimum 5 characters
availableHours: Required, minimum 1 character
operationType: Optional, must be one of: "venta", "alquiler", "valuacion"
propertyType: Optional string
location: Optional string
description: Required, minimum 1 character
Implementation Details
Stores request in the contactRequests database table
Associates request with authenticated user’s ID
Sends email notification via the email service (using Resend)
Uses database transaction for data integrity
Returns 201 status code on successful creation
Returns 400 for validation errors with detailed error information
Returns 500 for server errors
Optional fields default to “N/A” if not provided