Skip to main content
POST
/
api
/
contact
/
appraisal
Submit Contact Request
curl --request POST \
  --url https://api.example.com/api/contact/appraisal \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "email": "<string>",
  "phone": "<string>",
  "availableHours": "<string>",
  "operationType": "<string>",
  "propertyType": "<string>",
  "location": "<string>",
  "description": "<string>"
}
'
{
  "success": true,
  "data": {
    "id": 42,
    "message": "Contact request submitted successfully"
  }
}

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

name
string
required
Full name of the person making the request (minimum 1 character)
email
string
required
Email address (must be a valid email format)
phone
string
required
Phone number (minimum 5 characters)
availableHours
string
required
Preferred hours for contact (minimum 1 character)
operationType
string
Type of operation: "venta" (sale), "alquiler" (rent), or "valuacion" (appraisal)
propertyType
string
Type of property (e.g., “Casa”, “Departamento”)
location
string
Property location or area of interest
description
string
required
Detailed description of the request (minimum 1 character)

Response

success
boolean
required
Indicates if the request was submitted successfully
data
object
required
Response data
{
  "success": true,
  "data": {
    "id": 42,
    "message": "Contact request submitted successfully"
  }
}

Request Example

cURL
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."
  }'
JavaScript
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();
Python
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

Build docs developers (and LLMs) love