TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nelrondon/backend-proyecto-estructuras/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/properties endpoint creates a new property listing and persists it to the properties table. Authentication is required — the request must include a valid token cookie issued at login. The server extracts the authenticated user’s ID from the decoded JWT and stores it as user_id on the new record, so you must not include user_id in the request body. The request body is validated against the full property schema using Zod; if any required field is missing or any value is of the wrong type, a 422 error is returned with the first failing validation message.
Endpoint
Authentication
Required. The request must include a validtoken cookie obtained from a successful login. The middleware reads this cookie, verifies the JWT, and attaches the decoded user object to req.user before the controller runs.
| Condition | Status | Body |
|---|---|---|
No token cookie present | 401 | { "message": "No Token, Unauthorized" } |
token cookie present but invalid or expired | 403 | { "message": "Invalid Token" } |
Request Body
Send a JSON body withContent-Type: application/json.
Do not include
user_id in the request body. The server sets this automatically from the authenticated user’s JWT payload (req.user.id). Any user_id value you send will be ignored.Short descriptive title for the property listing. Must be a string.
Longer free-text description of the property. Must be a string if provided.
Listing availability status. Must be exactly one of:
Venta— For saleAlquiler— For rentAmbas— Available for both sale and rent
Category of the property. Must be exactly one of:
Casa— Residential houseApartamento— Apartment or condominium unitTerreno— Land or undeveloped plotComercial— Commercial property
Full street address of the property. Must be a string.
City where the property is located. Must be a string.
State or region where the property is located. Must be a string.
Listed price of the property. Must be a number (not a string).
Number of bedrooms. Must be a number if provided.
Number of bathrooms. Must be a number if provided.
Total area of the property in square feet. Must be a number if provided.
Number of parking spaces. Must be a number if provided.
URL pointing to the primary image of the property. Optional. This field is accepted and stored by the model but is not present in the Zod schema — it is passed through to the database without validation.
Response
Success
id.
Error Responses
| Status | Body | Description |
|---|---|---|
401 | { "message": "No Token, Unauthorized" } | No token cookie was present on the request. |
403 | { "message": "Invalid Token" } | The token cookie was present but the JWT could not be verified (invalid signature or expired). |
422 | { "error": "<first validation message>" } | Request body failed Zod schema validation. The message describes which field failed and why. |
500 | { "error": "<database error message>" } | An unexpected database error occurred while inserting the record. |