# Solicitar visita

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

Esta referência é gerada a partir do código da API, por isso as descrições estão em espanhol. Nomes, parâmetros e exemplos são iguais em qualquer idioma.

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.

Permissão pedida

`leads:write`

Cabeçalho obrigatório

`X-API-Key` · chave publicável ou secreta

Nível de acesso

Nível 1 · sem solicitação

## Cabeçalhos

1 · todos opcionais

`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

## Corpo (JSON)

13 · 5 obrigatórios

`firstName` string · **obrigatório**

2–100 chars

`phone` string · **obrigatório**

7–20 chars

`propertyId` string · **obrigatório**

`preferredDate` string · **obrigatório**

`preferredTime` string · **obrigatório**

morning · afternoon · evening

`email` string | string · opcional

**Ver os outros 7 parâmetros**

`preferredClock` string · opcional

`message` string · opcional

≤ 500 chars

`adCampaignId` string · opcional

`utmSource` string · opcional

≤ 100 chars

`utmMedium` string · opcional

≤ 100 chars

`utmCampaign` string · opcional

≤ 200 chars

`utmContent` string · opcional

≤ 200 chars

## Resposta 201

`SuccessFlag` · 1 campos

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

`success` boolean true

## Erros possíveis

com a 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
- **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()
```

**Resposta · 201 · exemplo**

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