# Crear cita

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

Agenda una cita con un contacto y programa sus recordatorios. `endTime` debe ser posterior a `startTime`. Respeta el tope mensual de citas del plan (`403 PLAN_LIMIT_REACHED`).

Permiso que pide

`appointments:write`

Encabezado obligatorio

`X-API-Key` · clave secreta

Nivel de acceso

Nivel 3 · con revisión de soporte

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

12 · 5 obligatorios

`title` string · **obligatorio**

2–200 chars

`startTime` string · **obligatorio**

`endTime` string · **obligatorio**

`contactId` string · **obligatorio**

`assigneeId` string · **obligatorio**

`description` string · opcional

≤ 2000 chars

**Ver los otros 6 parámetros**

`type` string · opcional

SHOWING · MEETING · CALL · FOLLOW_UP · SIGNING · DEMO · OTHER · por defecto "MEETING"

`color` string · opcional

`location` string · opcional

≤ 500 chars

`dealId` string · opcional

`propertyId` string · opcional

`reminders` object[] · opcional

## Respuesta 201

`AppointmentRecord` · 22 campos

**`data` Cita tal como queda al crearla, actualizarla o cancelarla.**

`id` string

`title` string

`description` string

`type` string SHOWING, MEETING, CALL, FOLLOW_UP, SIGNING, DEMO

`status` string SCHEDULED, CONFIRMED, COMPLETED, CANCELLED, NO_SHOW

`startTime` string

`endTime` string

`color` string

`location` string

`createdAt` string

`cancelReason` string

`source` string `MANUAL`, `BOOKING` o `NOA`

`contactId` string

`dealId` string

`propertyId` string

`assigneeId` string

`createdById` string

`updatedAt` string

**`contact` id · firstName · lastName · phone**

`id` string

`firstName` string

`lastName` string

`phone` string No viene al cancelar; `null` si el contacto no tiene teléfono

**`deal` id · title**

`id` string

`title` string

**`assignee` id · firstName · lastName**

`id` string

`firstName` string

`lastName` string

**`reminders[]` Recordatorios programados. No vienen al cancelar**

`id` string

`channel` string

`minutesBefore` integer

`scheduledFor` string

`status` string

## 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
- **404** NOT_FOUND
- **409** DUPLICATE
- **429** RATE_LIMITED
- **500** INTERNAL_ERROR

cURL:

```bash
curl -X POST "https://api.bydomu.com/v1/appointments" \
  -H "X-API-Key: $BYDOMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Visita Apto Chapinero",
  "type": "SHOWING",
  "startTime": "2026-10-02T15:00:00.000Z",
  "endTime": "2026-10-02T16:00:00.000Z",
  "location": "Cra 7 #45-12, Bogotá",
  "contactId": "clx1con001",
  "propertyId": "clx1prop001",
  "assigneeId": "clx1usr001",
  "reminders": [
    {
      "channel": "WHATSAPP",
      "minutesBefore": 60
    }
  ]
}'
```

JavaScript:

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

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

const { data } = await bydomu.appointments.create({
  "title": "Visita Apto Chapinero",
  "type": "SHOWING",
  "startTime": "2026-10-02T15:00:00.000Z",
  "endTime": "2026-10-02T16:00:00.000Z",
  "location": "Cra 7 #45-12, Bogotá",
  "contactId": "clx1con001",
  "propertyId": "clx1prop001",
  "assigneeId": "clx1usr001",
  "reminders": [
    {
      "channel": "WHATSAPP",
      "minutesBefore": 60
    }
  ]
});
```

Python:

```python
import os, requests

r = requests.post(
    "https://api.bydomu.com/v1/appointments",
    headers={"X-API-Key": os.environ["BYDOMU_API_KEY"]},
    json={
        "title": "Visita Apto Chapinero",
        "type": "SHOWING",
        "startTime": "2026-10-02T15:00:00.000Z",
        "endTime": "2026-10-02T16:00:00.000Z",
        "location": "Cra 7 #45-12, Bogotá",
        "contactId": "clx1con001",
        "propertyId": "clx1prop001",
        "assigneeId": "clx1usr001",
        "reminders": [
            {
                "channel": "WHATSAPP",
                "minutesBefore": 60
            }
        ]
    }
)
data = r.json()
```

**Respuesta · 201 · ejemplo**

```json
{
  "data": {
    "id": "clx1apt001",
    "title": "Visita Apto Chapinero",
    "description": "Segunda visita; llevar el certificado de libertad.",
    "type": "SHOWING",
    "status": "SCHEDULED",
    "startTime": "2026-10-02T15:00:00.000Z",
    "endTime": "2026-10-02T16:00:00.000Z",
    "color": "#6366F1",
    "location": "Cra 7 #45-12, Bogotá",
    "createdAt": "2026-09-25T09:00:00.000Z",
    "cancelReason": "El cliente reagendará",
    "source": "MANUAL",
    "contactId": "clx1con001",
    "dealId": "clx1deal001",
    "propertyId": "clx1prop001",
    "assigneeId": "clx1usr001",
    "createdById": "clx1usr002",
    "updatedAt": "2026-09-25T09:00:00.000Z",
    "contact": {
      "id": "clx1con001",
      "firstName": "María",
      "lastName": "González",
      "phone": "+573001234567"
    },
    "deal": {
      "id": "clx1deal001",
      "title": "Venta Apto Chapinero"
    },
    "assignee": {
      "id": "clx1usr001",
      "firstName": "Carlos",
      "lastName": "Rodríguez"
    },
    "reminders": [
      {
        "id": "clx1rem001",
        "channel": "WHATSAPP",
        "minutesBefore": 60,
        "scheduledFor": "2026-10-02T14:00:00.000Z",
        "status": "PENDING"
      }
    ]
  }
}
```
