# Agendar cita

POST `https://api.bydomu.com/v1/booking/{slug}`

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

Agenda una cita con el agente en un espacio libre (`date` + `startTime` en la zona horaria de la página). Queda `CONFIRMED` si la página confirma sola, si no `SCHEDULED`. Dispara el webhook `BOOKING_CREATED`. OJO: la respuesta viene doblemente envuelta, `{ data: { data: ... } }`.

Permission required

`booking:write`

Required header

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

Access level

Level 1 · no request

## Path parameters

1 · required

`slug` string · **required**

Slug de la página de agendamiento del agente

## 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)

9 · 4 required

`firstName` string · **required**

2–100 chars

`phone` string · **required**

7–20 chars

`date` string · **required**

`startTime` string · **required**

`lastName` string · optional

≤ 100 chars

`email` string · optional

email

**See the other 3 parameters**

`propertyId` string · optional

`message` string · optional

≤ 500 chars

`type` string · optional

SHOWING · MEETING · CALL · FOLLOW_UP · SIGNING · DEMO · OTHER · default "SHOWING"

## Response 201

`object` · 1 fields

**`data` data**

**`data` appointmentId · status · ownerNotified**

`appointmentId` string

`status` string CONFIRMED, SCHEDULED

**`ownerNotified` Agente al que se avisó**

`firstName` string

`lastName` string

## 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/booking/carlos-rodriguez" \
  -H "X-API-Key: $BYDOMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "firstName": "María",
  "lastName": "González",
  "phone": "+573001234567",
  "email": "maria.gonzalez@email.com",
  "date": "2026-10-05",
  "startTime": "09:00",
  "type": "SHOWING",
  "propertyId": "clx1prop001"
}'
```

JavaScript:

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

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

const { data } = await bydomu.booking.submit("carlos-rodriguez", {
  "firstName": "María",
  "lastName": "González",
  "phone": "+573001234567",
  "email": "maria.gonzalez@email.com",
  "date": "2026-10-05",
  "startTime": "09:00",
  "type": "SHOWING",
  "propertyId": "clx1prop001"
});
```

Python:

```python
import os, requests

r = requests.post(
    "https://api.bydomu.com/v1/booking/carlos-rodriguez",
    headers={"X-API-Key": os.environ["BYDOMU_API_KEY"]},
    json={
        "firstName": "María",
        "lastName": "González",
        "phone": "+573001234567",
        "email": "maria.gonzalez@email.com",
        "date": "2026-10-05",
        "startTime": "09:00",
        "type": "SHOWING",
        "propertyId": "clx1prop001"
    }
)
data = r.json()
```

**Response · 201 · example**

```json
{
  "data": {
    "data": {
      "appointmentId": "clx1apt009",
      "status": "CONFIRMED",
      "ownerNotified": {
        "firstName": "Carlos",
        "lastName": "Rodríguez"
      }
    }
  }
}
```
