# Create a property

URL: https://api-docs.vestta.io/properties/create

Creates a private CRM property. Publication is a separate operation.

Operation, pricing, location, area and characteristics are separate validated objects. Each operation needs its price: `sale`, `rent` or `transfer`. `owner_id` is required and must identify an existing holder contact in the same workspace.

`subtype` is required, just as in the CRM creation modal. Send a canonical key that belongs to `type`, such as `{"type": "apartamento", "subtype": "atico"}`. Display labels such as `Ático`, empty values and subtypes from another property type return `422`.

| `type` | Allowed `subtype` keys |
| --- | --- |
| `apartamento` | `apartamento`, `atico`, `planta_baja`, `duplex`, `estudio` |
| `casa` | `adosado`, `unifamiliar`, `multifamiliar`, `rustica`, `chalet`, `villa` |
| `local` | `local_comercial` |
| `nave` | `industrial`, `warehouse`, `other` |
| `almacenaje` | `almacen`, `trastero` |
| `oficina` | `on_high`, `ground_floor` |
| `terreno` | `rustico`, `urbano`, `urbanizable`, `industrial`, `terciario`, `otros` |
| `aparcamiento` | `garaje`, `parking`, `amarre` |
| `edificio` | `hotel`, `edificio`, `apartahotel` |

The response is `201` with the new `id`. Creating a property does not make it public. Next: [upload images](/properties/uploads), then [publish](/properties/publication).

Send an optional `Idempotency-Key` header (1–200 characters). For 24 hours the same key, API key and operation with the same body returns the original result, without creating another record. Reusing it with a different body returns `409`.

### POST /v1/properties

Creates a private CRM property using the structured listing model. Requires the `properties:write` scope. Supports `Idempotency-Key`.

Required scope: `properties:write`

Request headers:
- `idempotency-key` (string, optional, nullable, 1–200 chars)

Request body (PropertyCreateRequest, required, application/json):
- `operations` (array of strings, required)
- `type` (PropertyType, required)
- `subtype` (PropertySubtype, required): Canonical subtype key for the property type: apartamento: apartamento, atico, planta_baja, duplex, estudio; casa: adosado, unifamiliar, multifamiliar, rustica, chalet, villa; local: local_comercial; nave: industrial, warehouse, other; almacenaje: almacen, trastero; oficina: on_high, ground_floor; terreno: rustico, urbano, urbanizable, industrial, terciario, otros; aparcamiento: garaje, parking, amarre; edificio: hotel, edificio, apartahotel. Responses return a Spanish display label instead of this key.
- `title` (string, required, 1–300 chars)
- `description` (string, optional, ≤ 50000 chars, default )
- `pricing` (PropertyPricing, required)
  - `sale` (number, optional, nullable, ≥ 0)
  - `rent` (number, optional, nullable, ≥ 0)
  - `transfer` (number, optional, nullable, ≥ 0)
- `location` (PropertyLocation, required)
  - `city` (string, required, 2–150 chars)
  - `province` (string, optional, nullable, ≤ 150 chars)
  - `country` (string, optional, 2–100 chars, default España)
  - `address` (string, required, 2–500 chars)
  - `full_address` (string, required, 5–1000 chars)
  - `postal_code` (string, optional, nullable, ≤ 20 chars)
  - `coordinates` (Coordinates, required)
    - `latitude` (number, required, ≥ -90, ≤ 90)
    - `longitude` (number, required, ≥ -180, ≤ 180)
  - `visibility` (string, optional, default approximate, values: `public` | `approximate` | `hidden`)
- `area` (PropertyArea, required)
  - `total` (number, required, ≥ 0)
  - `usable` (number, optional, nullable, ≥ 0)
  - `plot` (number, optional, nullable, ≥ 0)
- `bedrooms` (integer, optional, ≥ 0, ≤ 1000, default 0)
- `bathrooms` (integer, optional, ≥ 0, ≤ 1000, default 0)
- `characteristics` (PropertyCharacteristics, optional)
  - `translations` (TranslationSpec, optional, nullable): Traducciones de las descripciones
    - `ca` (TranslatedDescription, optional, nullable): Traduccion en catalán de la descripción
      - `title` (string, optional, nullable): Título de la descripción
      - `description` (string, optional, nullable): Descripción
    - `en` (TranslatedDescription, optional, nullable): Traduccion en ingles de la descripción
      - `title` (string, optional, nullable): Título de la descripción
      - `description` (string, optional, nullable): Descripción
    - `fr` (TranslatedDescription, optional, nullable): Traduccion en francés de la descripción
      - `title` (string, optional, nullable): Título de la descripción
      - `description` (string, optional, nullable): Descripción
    - `de` (TranslatedDescription, optional, nullable): Traduccion en alemán de la descripción
      - `title` (string, optional, nullable): Título de la descripción
      - `description` (string, optional, nullable): Descripción
    - `pt` (TranslatedDescription, optional, nullable): Traduccion en portuges de la descripción
      - `title` (string, optional, nullable): Título de la descripción
      - `description` (string, optional, nullable): Descripción
    - `it` (TranslatedDescription, optional, nullable): Traduccion en italiano de la descripción
      - `title` (string, optional, nullable): Título de la descripción
      - `description` (string, optional, nullable): Descripción
  - `size_built` (number, optional, nullable, ≥ 0): Superficie construida
  - `porch_size` (number, optional, nullable, ≥ 0): Metros cuadrados porche
  - `size_terraces` (number, optional, nullable, ≥ 0): Metros cuadrados terrazas
  - `attic_size` (number, optional, nullable, ≥ 0): Metros cuadrados ático
  - `storage_dimensions` (number, optional, nullable): Dimensiones del trastero
  - `doble_bedrooms` (integer, optional, nullable, ≥ 0): Número de habitaciones dobles
  - `suite_bathrooms` (integer, optional, nullable, ≥ 0): Número de baños en suite
  - `num_terraces` (integer, optional, nullable, ≥ 0): Número de terrazas
  - `conservation` (string, optional, nullable): Estado de conservación
  - `floor` (string, optional, nullable): Planta canónica para portales
  - `house_floors` (integer, optional, nullable, ≥ 1): Número de plantas de una casa
  - `elevator` (boolean, optional, nullable): Tiene ascensor (0/1 o Sí/No)
  - `views` (string, optional, nullable): Vistas de la propiedad
  - `orientation` (string, optional, nullable): Orientación (norte, sur, este, oeste)
  - `energy_certificate` (string, optional, nullable): Certificado energético A-G
  - `emissions` (string, optional, nullable): Emisiones A-G
  - `energy_consumption_value` (number, optional, nullable, ≥ 1, ≤ 999): Consumo (kWh/m² año)
  - `emissions_value` (number, optional, nullable, ≥ 1, ≤ 999): Emisiones (kg CO₂/m² año)
  - `height` (number, optional, nullable): Altura del local
  - `facade_meters` (number, optional, nullable): Metros de fachada
  - `meters_showcase` (number, optional, nullable): Metros de escaparate
  - `entrace_type` (string, optional, nullable): Tipo de entrada de la oficina
  - `position` (string, optional, nullable): 1ª/2ª Linea del mar
  - `offices` (integer, optional, nullable, ≥ 0): Número de despachos
  - `meeting_rooms` (integer, optional, nullable, ≥ 0): Número de salas de reuniones
  - `camino` (string, optional, nullable): Tipo de suelo
  - `terrain_extension` (string, optional, nullable): Tamaño (Grande/Pequeño)
  - `topography` (string, optional, nullable): Topografía del terreno
  - `num_seats` (integer, optional, nullable, ≥ 0): Número de plazas
  - `dimensions` (string, optional, nullable): Dimensiones del aparcamiento
  - `turistic_license` (string, optional, nullable): Licencia turística
  - `construction_year` (integer, optional, nullable): Año de construcción
  - `exposure` (string, optional, nullable): Interior o Exterior
  - `style` (string, optional, nullable): Conservación
  - `num_viviendas` (integer, optional, nullable): Número de viviendas
  - `num_locales` (integer, optional, nullable): Número de locales
  - `num_ascensores` (integer, optional, nullable): Número de ascensores
  - `num_parkings` (integer, optional, nullable, ≥ 0): Número de parkings incluidos
  - `num_floors` (integer, optional, nullable): Número de plantas
  - `luxury_property` (boolean, optional, nullable): Propiedad de lujo
  - `holiday_renting` (boolean, optional, nullable): Alquiler vacacional
  - `purchase_option_rental` (boolean, optional, nullable): Alquiler con opción a compra
  - `activities` (ActivitiesSpec, optional, nullable): Actividades permitidas
    - `predefined` (array of strings, optional): Actividades predefinidas
    - `custom` (array of strings, optional): Actividades personalizadas
  - `num_entrances` (NumEntrancesSpec, optional, nullable): Número de entradas
    - `total` (integer, optional, ≥ 0, default 0): Total de entradas
    - `peaton_entrances` (integer, optional, ≥ 0, default 0): Entradas de peatones
    - `moto_entrances` (integer, optional, ≥ 0, default 0): Entradas de motos
    - `van_entrances` (integer, optional, ≥ 0, default 0): Entradas de furgoneta
    - `car_entrances` (integer, optional, ≥ 0, default 0): Entradas de coche
  - `floor_breakdown` (FloorBreakdownSpec, optional, nullable): Desglose de plantas
    - `base_floor` (integer, optional, default 0): Metros ² de la planta baja
    - `first_floor` (integer, optional, default 0): Metros ² de la primera planta
    - `second_floor` (integer, optional, default 0): Metros ² de la segunda planta
- `features` (array of objects, optional)
  - `key` (string, required, 1–100 chars)
  - `label` (string, required, 1–200 chars)
  - `value` (string | boolean | integer | number, required)
  - `isextra` (boolean, optional, default false)
- `owner_id` (integer, required, ≥ 1): Required existing holder contact in the same business.
- `is_featured` (boolean, optional, default false)
- `status` (string, optional, default disponible, values: `disponible` | `reservada`)

Response 201: Successful response.
- `status` (string, optional, default ok, values: `ok`)
- `id` (integer, required)

```json
{
  "status": "ok",
  "id": 1355
}
```

Response 401: The API key is missing, malformed, unknown, revoked or expired.

Response 403: The API key lacks the required scope, or the business plan does not include API access.

Response 404: The resource does not exist in this business.

Response 409: Duplicate contact or idempotency key reused with a different payload.

Response 422: A path parameter, query parameter or body field is invalid.

Response 429: The API key reached its request limit. Wait for the number of seconds in `Retry-After` before retrying.

Response 500: Unexpected server error while processing the request.

### Example requests

#### cURL

```bash
curl -X POST "https://api.vestta.io/v1/properties" \
  -H "X-Api-Key: $VESTTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "operations": [
    "venta"
  ],
  "type": "apartamento",
  "subtype": "apartamento",
  "title": "Apartment in Madrid",
  "pricing": {
    "sale": 350000
  },
  "location": {
    "city": "Madrid",
    "address": "Calle de Serrano",
    "full_address": "Calle de Serrano 41, 3B",
    "coordinates": {
      "latitude": 40.425318,
      "longitude": -3.687934
    },
    "visibility": "approximate"
  },
  "area": {
    "total": 95
  },
  "bedrooms": 2,
  "bathrooms": 1,
  "owner_id": 71
}'
```

#### JavaScript

```javascript
const response = await fetch('https://api.vestta.io/v1/properties', {
  method: 'POST',
  headers: {
    'X-Api-Key': process.env.VESTTA_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operations": [
      "venta"
    ],
    "type": "apartamento",
    "subtype": "apartamento",
    "title": "Apartment in Madrid",
    "pricing": {
      "sale": 350000
    },
    "location": {
      "city": "Madrid",
      "address": "Calle de Serrano",
      "full_address": "Calle de Serrano 41, 3B",
      "coordinates": {
        "latitude": 40.425318,
        "longitude": -3.687934
      },
      "visibility": "approximate"
    },
    "area": {
      "total": 95
    },
    "bedrooms": 2,
    "bathrooms": 1,
    "owner_id": 71
  }),
})

const data = await response.json()
```

#### Python

```python
import os

import requests

response = requests.post(
    "https://api.vestta.io/v1/properties",
    headers={"X-Api-Key": os.environ["VESTTA_API_KEY"]},
    json={
        "operations": [
            "venta",
        ],
        "type": "apartamento",
        "subtype": "apartamento",
        "title": "Apartment in Madrid",
        "pricing": {
            "sale": 350000,
        },
        "location": {
            "city": "Madrid",
            "address": "Calle de Serrano",
            "full_address": "Calle de Serrano 41, 3B",
            "coordinates": {
                "latitude": 40.425318,
                "longitude": -3.687934,
            },
            "visibility": "approximate",
        },
        "area": {
            "total": 95,
        },
        "bedrooms": 2,
        "bathrooms": 1,
        "owner_id": 71,
    },
)
response.raise_for_status()
data = response.json()
```
