# Enviar preferencias del buscador

POST `https://api.bydomu.com/v1/finder`

Registra lo que busca un prospecto (tipo, zona, presupuesto, características) como contacto y devuelve hasta 12 propiedades que encajan, con su puntaje y el detalle del cálculo. Dispara el webhook `FINDER_SUBMITTED`.

Permiso que pide

`finder:write`

Encabezado obligatorio

`X-API-Key` · clave publicable o secreta

Nivel de acceso

Nivel 1 · sin solicitud

## Encabezados

1 · todos opcionales

`Idempotency-Key` string · opcional

Clave única de la operación (8-128 caracteres de `[a-zA-Z0-9._:-]`). Un reintento con la misma clave y el mismo cuerpo devuelve la respuesta original sin repetir la operación. Vive 24 horas. 8–128 chars

## Cuerpo (JSON)

15 · 4 obligatorios

`transactionType` string · **obligatorio**

SALE · RENT

`propertyType` string · **obligatorio**

APARTMENT · HOUSE · OFFICE · COMMERCIAL · LAND · WAREHOUSE · ROOM · FARM · OTHER

`firstName` string · **obligatorio**

2–100 chars

`phone` string · **obligatorio**

7–20 chars

`city` string · opcional

≤ 100 chars

`neighborhood` string · opcional

≤ 100 chars

**Ver los otros 9 parámetros**

`budgetMin` number · opcional

≥ 0 · nullable

`budgetMax` number · opcional

≥ 0 · nullable

`minBedrooms` integer · opcional

≥ 0 · nullable

`minBathrooms` integer · opcional

≥ 0 · nullable

`minArea` number · opcional

≥ 0 · nullable

`amenities` string[] · opcional

`email` string | string · opcional

`message` string · opcional

≤ 1000 chars

`subscribedToAlerts` boolean · opcional

por defecto false

## Respuesta 201

`FinderResult` · 3 campos

**`data` contact · properties · total**

**`contact` id**

`id` string

**`properties[]` Hasta 12 propiedades, de mejor a peor puntaje**

`id` string

`code` string

`title` string

`type` string APARTMENT, HOUSE, OFFICE, COMMERCIAL, LAND, WAREHOUSE

`transactionType` string SALE, RENT, SALE_OR_RENT

`price` number

`currency` string

`city` string

`neighborhood` string

`bedrooms` integer

`bathrooms` integer

`area` number

`matchScore` integer Qué tan bien encaja (0-100)

**`breakdown[]` criterio · puntos · estado**

`criterio` string

`puntos` integer

`estado` string match, partial, mismatch, unknown

`image` string

`total` integer Propiedades que encajan

## Errores posibles

con la forma `{ "error": { "code", "message" } }`

- **400** Datos inválidos: el cuerpo o la query no cumplen el esquema, o `Idempotency-Key` está mal formada.
- **401** UNAUTHORIZED
- **402** PAYMENT_REQUIRED
- **403** FORBIDDEN
- **409** DUPLICATE
- **429** RATE_LIMITED
- **500** INTERNAL_ERROR

cURL:

```bash
curl -X POST "https://api.bydomu.com/v1/finder" \
  -H "X-API-Key: $BYDOMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "transactionType": "SALE",
  "propertyType": "APARTMENT",
  "city": "Bogotá",
  "neighborhood": "Chapinero",
  "budgetMin": 250000000,
  "budgetMax": 400000000,
  "minBedrooms": 2,
  "amenities": [
    "parking",
    "gym"
  ],
  "firstName": "Juan",
  "phone": "+573005551234",
  "subscribedToAlerts": true
}'
```

JavaScript:

```js
import { ByDomu } from "@bydomu/sdk";

const bydomu = new ByDomu({
  apiKey: process.env.BYDOMU_API_KEY,
});

const { data } = await bydomu.finder.submit({
  "transactionType": "SALE",
  "propertyType": "APARTMENT",
  "city": "Bogotá",
  "neighborhood": "Chapinero",
  "budgetMin": 250000000,
  "budgetMax": 400000000,
  "minBedrooms": 2,
  "amenities": [
    "parking",
    "gym"
  ],
  "firstName": "Juan",
  "phone": "+573005551234",
  "subscribedToAlerts": true
});
```

Python:

```python
import os, requests

r = requests.post(
    "https://api.bydomu.com/v1/finder",
    headers={"X-API-Key": os.environ["BYDOMU_API_KEY"]},
    json={
        "transactionType": "SALE",
        "propertyType": "APARTMENT",
        "city": "Bogotá",
        "neighborhood": "Chapinero",
        "budgetMin": 250000000,
        "budgetMax": 400000000,
        "minBedrooms": 2,
        "amenities": [
            "parking",
            "gym"
        ],
        "firstName": "Juan",
        "phone": "+573005551234",
        "subscribedToAlerts": True
    }
)
data = r.json()
```

**Respuesta · 201 · ejemplo**

```json
{
  "data": {
    "contact": {
      "id": "clx1con009"
    },
    "properties": [
      {
        "id": "clx1prop001",
        "code": "P-0042",
        "title": "Apartamento en Chapinero con vista",
        "type": "APARTMENT",
        "transactionType": "SALE",
        "price": 450000000,
        "currency": "COP",
        "city": "Bogotá",
        "neighborhood": "Chapinero",
        "bedrooms": 3,
        "bathrooms": 2,
        "area": 85,
        "matchScore": 87,
        "breakdown": [
          {
            "criterio": "Presupuesto",
            "puntos": 30,
            "estado": "match"
          }
        ],
        "image": "https://cdn.bydomu.com/props/clx1prop001/1.jpg"
      }
    ],
    "total": 7
  }
}
```
