# Solicitar visita

POST `https://api.bydomu.com/v1/leads/schedule`

This reference is generated from the API’s code, so descriptions are in Spanish. Names, parameters and examples are the same in every language.

Registra una solicitud de visita a una propiedad con fecha y franja preferidas y dispara el webhook `VISIT_SCHEDULED`. No agenda una cita: la inmobiliaria confirma después.

Permission required

`leads:write`

Required header

`X-API-Key` · publishable or secret key

Access level

Level 1 · no request

## Headers

1 · all optional

`Idempotency-Key` string · optional

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

## Body (JSON)

13 · 5 required

`firstName` string · **required**

2–100 chars

`phone` string · **required**

7–20 chars

`propertyId` string · **required**

`preferredDate` string · **required**

`preferredTime` string · **required**

morning · afternoon · evening

`email` string | string · optional

**See the other 7 parameters**

`preferredClock` string · optional

`message` string · optional

≤ 500 chars

`adCampaignId` string · optional

`utmSource` string · optional

≤ 100 chars

`utmMedium` string · optional

≤ 100 chars

`utmCampaign` string · optional

≤ 200 chars

`utmContent` string · optional

≤ 200 chars

## Response 201

`SuccessFlag` · 1 fields

**`data` La operación se aceptó.**

`success` boolean true

## Possible errors

shaped as `{ "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
- **404** NOT_FOUND
- **409** DUPLICATE
- **429** RATE_LIMITED
- **500** INTERNAL_ERROR

cURL:

```bash
curl -X POST "https://api.bydomu.com/v1/leads/schedule" \
  -H "X-API-Key: $BYDOMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "firstName": "Ana",
  "phone": "+573009876543",
  "propertyId": "clx1prop001",
  "preferredDate": "2026-10-04",
  "preferredTime": "morning"
}'
```

JavaScript:

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

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

const { data } = await bydomu.leads.scheduleVisit({
  "firstName": "Ana",
  "phone": "+573009876543",
  "propertyId": "clx1prop001",
  "preferredDate": "2026-10-04",
  "preferredTime": "morning"
});
```

Python:

```python
import os, requests

r = requests.post(
    "https://api.bydomu.com/v1/leads/schedule",
    headers={"X-API-Key": os.environ["BYDOMU_API_KEY"]},
    json={
        "firstName": "Ana",
        "phone": "+573009876543",
        "propertyId": "clx1prop001",
        "preferredDate": "2026-10-04",
        "preferredTime": "morning"
    }
)
data = r.json()
```

**Response · 201 · example**

```json
{
  "data": {
    "success": true
  }
}
```
