# Actualizar cita

PATCH `https://api.bydomu.com/v1/appointments/{id}`

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.

Actualiza solo los campos enviados. Para cancelar usa `POST /appointments/{id}/cancel`.

Permissão pedida

`appointments:write`

Cabeçalho obrigatório

`X-API-Key` · chave secreta

Nível de acesso

Nível 3 · com revisão do suporte

## Parâmetros de rota

1 · obrigatórios

`id` string · **obrigatório**

ID de la cita

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

12 · todos opcionais

`title` string · opcional

2–200 chars

`description` string · opcional

≤ 2000 chars

`type` string · opcional

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

`color` string · opcional

`startTime` string · opcional

nullable

`endTime` string · opcional

nullable

**Ver os outros 6 parâmetros**

`location` string · opcional

≤ 500 chars

`contactId` string · opcional

`dealId` string · opcional

nullable

`assigneeId` string · opcional

`status` string · opcional

SCHEDULED · CONFIRMED · COMPLETED · CANCELLED · NO_SHOW

`reminders` object[] · opcional

## Resposta 200

`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

## 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 PATCH "https://api.bydomu.com/v1/appointments/clx1apt001" \
  -H "X-API-Key: $BYDOMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "startTime": "2026-10-02T16:00:00.000Z",
  "endTime": "2026-10-02T17:00:00.000Z",
  "status": "CONFIRMED"
}'
```

JavaScript:

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

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

const { data } = await bydomu.appointments.update("clx1apt001", {
  "startTime": "2026-10-02T16:00:00.000Z",
  "endTime": "2026-10-02T17:00:00.000Z",
  "status": "CONFIRMED"
});
```

Python:

```python
import os, requests

r = requests.patch(
    "https://api.bydomu.com/v1/appointments/clx1apt001",
    headers={"X-API-Key": os.environ["BYDOMU_API_KEY"]},
    json={
        "startTime": "2026-10-02T16:00:00.000Z",
        "endTime": "2026-10-02T17:00:00.000Z",
        "status": "CONFIRMED"
    }
)
data = r.json()
```

**Resposta · 200 · exemplo**

```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"
      }
    ]
  }
}
```
