{"openapi":"3.1.0","info":{"title":"Kuida API","version":"2026-09-28","summary":"Conecte el sistema de su institución con Kuida.","description":"API REST para que clínicas, laboratorios, farmacias y prestadores conecten su sistema de gestión con Kuida: pacientes, turnos, consultas, solicitudes de ingreso, tratamientos, eventos y webhooks. Autenticación con clave de API (`Authorization: Bearer kd_live_…`), JSON en camelCase, ids con prefijo, listas con cursor, `Idempotency-Key` en todos los POST y versiones fechadas con el header `Kuida-Version`.","contact":{"name":"Kuida","url":"https://www.kuida.ar/desarrolladores","email":"desarrolladores@kuida.ar"},"license":{"name":"Propietaria — los SDKs son MIT","url":"https://www.kuida.ar/desarrolladores"}},"servers":[{"url":"https://www.kuida.ar/api","description":"Producción"}],"security":[{"apiKey":[]}],"tags":[{"name":"Cuenta"},{"name":"Pacientes"},{"name":"Profesionales"},{"name":"Turnos"},{"name":"Consultas"},{"name":"Solicitudes de ingreso"},{"name":"Tratamientos"},{"name":"Eventos"},{"name":"Webhooks"}],"paths":{"/v1/account":{"get":{"operationId":"account.retrieve","summary":"Obtener la cuenta","description":"La organización dueña de la clave, con sus líneas de servicio y los permisos de la clave. Sirve para probar que la integración está bien configurada.","tags":["Cuenta"],"x-kuida-resource":"account","x-kuida-method":"retrieve","x-kuida-scope":null,"parameters":[{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/patients":{"post":{"operationId":"patients.create","summary":"Crear o identificar un paciente","description":"Da de alta a un paciente sin mandarle nada. Si ya existe uno con ese teléfono (o ese DNI), devuelve el existente y completa los datos que le faltaban; nunca pisa datos cargados. Crear un paciente no lo contacta: el contacto lo dispara un turno, una consulta o una solicitud de ingreso.","tags":["Pacientes"],"x-kuida-resource":"patients","x-kuida-method":"create","x-kuida-scope":"patients:write","x-kuida-service":"follow_up","x-kuida-idempotent":true,"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientCreateParams"},"example":{"phone":"+54 9 342 555 0000","fullName":"Paciente Demo","dni":"11111111","externalId":"HC-1234"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Patient"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"patients.list","summary":"Listar pacientes","description":"Pacientes de la organización, del más nuevo al más viejo. Filtre por teléfono, DNI o id externo para buscar uno.","tags":["Pacientes"],"x-kuida-resource":"patients","x-kuida-method":"list","x-kuida-scope":"patients:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"phone","in":"query","required":false,"description":"Filtre por teléfono (cualquier formato).","schema":{"type":"string"}},{"name":"dni","in":"query","required":false,"schema":{"type":"string"}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/patients/{id}":{"get":{"operationId":"patients.retrieve","summary":"Obtener un paciente","description":"Devuelve un paciente por su id.","tags":["Pacientes"],"x-kuida-resource":"patients","x-kuida-method":"retrieve","x-kuida-scope":"patients:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^pat_.*","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Patient"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patients.update","summary":"Actualizar un paciente","description":"Cambia solo los campos que envía. El teléfono no se puede cambiar porque es la identidad del paciente en WhatsApp.","tags":["Pacientes"],"x-kuida-resource":"patients","x-kuida-method":"update","x-kuida-scope":"patients:write","x-kuida-service":"follow_up","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^pat_.*","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientUpdateParams"},"example":{"email":"paciente.demo@example.com"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Patient"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/doctors":{"get":{"operationId":"doctors.list","summary":"Listar profesionales","description":"El padrón de profesionales de la organización. Lo cura la organización dentro de Kuida; los turnos y consultas que envía lo usan para identificar a quién atiende.","tags":["Profesionales"],"x-kuida-resource":"doctors","x-kuida-method":"list","x-kuida-scope":"doctors:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"active","in":"query","required":false,"description":"Filtre por activos o inactivos.","schema":{"type":"string","enum":["true","false"]}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DoctorList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/doctors/{id}":{"get":{"operationId":"doctors.retrieve","summary":"Obtener un profesional","description":"Devuelve un profesional por su id.","tags":["Profesionales"],"x-kuida-resource":"doctors","x-kuida-method":"retrieve","x-kuida-scope":"doctors:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^doc_.*","example":"doc_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Doctor"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/appointments":{"post":{"operationId":"appointments.create","summary":"Crear un turno","description":"Registra un turno y agenda los recordatorios por WhatsApp que la organización tiene configurados (por ejemplo, 24 y 3 horas antes). Si envía `externalId` y ya existe un turno con ese id, devuelve ese y no crea otro.","tags":["Turnos"],"x-kuida-resource":"appointments","x-kuida-method":"create","x-kuida-scope":"appointments:write","x-kuida-service":"follow_up","x-kuida-idempotent":true,"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentCreateParams"},"example":{"patient":{"phone":"+54 9 342 555 0000","fullName":"Paciente Demo"},"doctor":{"externalId":"MED-12","fullName":"Dra. Demo"},"startAt":"2026-10-05T10:30:00-03:00","type":"Control","externalId":"turno-123"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"appointments.list","summary":"Listar turnos","description":"Turnos de la organización, del más nuevo al más viejo según cuándo se cargaron. Filtre por paciente, estado, id externo o rango de horario.","tags":["Turnos"],"x-kuida-resource":"appointments","x-kuida-method":"list","x-kuida-scope":"appointments:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"patient","in":"query","required":false,"description":"Id del paciente (`pat_…`).","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["confirmed","pending","rescheduled","cancelled","completed"]}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string"}},{"name":"startAtGte","in":"query","required":false,"description":"Turnos desde esta fecha y hora.","schema":{"type":"string","format":"date-time","example":"2026-10-01T14:30:00-03:00"}},{"name":"startAtLt","in":"query","required":false,"description":"Turnos antes de esta fecha y hora.","schema":{"type":"string","format":"date-time","example":"2026-10-01T14:30:00-03:00"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/appointments/{id}":{"get":{"operationId":"appointments.retrieve","summary":"Obtener un turno","description":"Devuelve un turno por su id.","tags":["Turnos"],"x-kuida-resource":"appointments","x-kuida-method":"retrieve","x-kuida-scope":"appointments:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^apt_.*","example":"apt_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"appointments.update","summary":"Reprogramar o modificar un turno","description":"Cambia horario, profesional o tipo. Un horario nuevo mueve los recordatorios pendientes al horario nuevo. Un turno cancelado o atendido no se puede modificar.","tags":["Turnos"],"x-kuida-resource":"appointments","x-kuida-method":"update","x-kuida-scope":"appointments:write","x-kuida-service":"follow_up","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^apt_.*","example":"apt_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentUpdateParams"},"example":{"startAt":"2026-10-06T11:00:00-03:00"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/appointments/{id}/cancel":{"post":{"operationId":"appointments.cancel","summary":"Cancelar un turno","description":"Marca el turno como cancelado y da de baja sus recordatorios pendientes. Cancelar un turno ya cancelado no hace nada.","tags":["Turnos"],"x-kuida-resource":"appointments","x-kuida-method":"cancel","x-kuida-scope":"appointments:write","x-kuida-service":"follow_up","x-kuida-idempotent":true,"parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^apt_.*","example":"apt_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentCancelParams"},"example":{"reason":"El paciente pidió cancelar"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/visits":{"post":{"operationId":"visits.create","summary":"Registrar una consulta atendida","description":"Registra que el paciente fue atendido y arranca su seguimiento post-consulta: unas horas después Kuida le escribe por WhatsApp. Si viene de un turno, envíe `appointment` y el turno queda como atendido. Con `externalId` repetido devuelve la consulta existente.","tags":["Consultas"],"x-kuida-resource":"visits","x-kuida-method":"create","x-kuida-scope":"visits:write","x-kuida-service":"follow_up","x-kuida-idempotent":true,"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitCreateParams"},"example":{"patient":{"phone":"+54 9 342 555 0000","fullName":"Paciente Demo","dni":"11111111"},"doctor":{"externalId":"MED-12","fullName":"Dra. Demo"},"visitedAt":"2026-10-05T10:45:00-03:00","type":"Control","externalId":"consulta-987","appointment":"turno-123"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Visit"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"visits.list","summary":"Listar consultas","description":"Consultas registradas, de la más nueva a la más vieja según cuándo se cargaron.","tags":["Consultas"],"x-kuida-resource":"visits","x-kuida-method":"list","x-kuida-scope":"visits:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"patient","in":"query","required":false,"description":"Id del paciente (`pat_…`).","schema":{"type":"string"}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/visits/{id}":{"get":{"operationId":"visits.retrieve","summary":"Obtener una consulta","description":"Devuelve una consulta por su id.","tags":["Consultas"],"x-kuida-resource":"visits","x-kuida-method":"retrieve","x-kuida-scope":"visits:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^vis_.*","example":"vis_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Visit"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/intake_requests":{"post":{"operationId":"intake_requests.create","summary":"Crear una solicitud de ingreso","description":"Alguien pide el servicio para un paciente. Kuida registra la solicitud, identifica al paciente y a sus referentes y, si la organización lo configuró, le escribe por WhatsApp para completar lo que falta (`missing`). Cuando queda completa pasa a `ready` y se dispara el webhook `intake.ready`.","tags":["Solicitudes de ingreso"],"x-kuida-resource":"intake_requests","x-kuida-method":"create","x-kuida-scope":"intake_requests:write","x-kuida-service":"follow_up","x-kuida-idempotent":true,"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeRequestCreateParams"},"example":{"patient":{"fullName":"Paciente Demo","dni":"11111111"},"contacts":[{"name":"Familiar Demo","relationship":"hija","phone":"+54 9 342 555 0001"}],"coverage":{"insurer":"OSDEMO","memberId":"000123"},"requestedService":"Internación domiciliaria","summary":"Alta sanatorial prevista para el viernes; requiere enfermería diaria.","hospitalized":true}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeRequest"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"intake_requests.list","summary":"Listar solicitudes de ingreso","description":"Solicitudes de la organización, de la más nueva a la más vieja.","tags":["Solicitudes de ingreso"],"x-kuida-resource":"intake_requests","x-kuida-method":"list","x-kuida-scope":"intake_requests:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["new","validating","ready","loaded","discarded"]}},{"name":"patient","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeRequestList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/intake_requests/{id}":{"get":{"operationId":"intake_requests.retrieve","summary":"Obtener una solicitud de ingreso","description":"Devuelve una solicitud con su estado y lo que todavía falta.","tags":["Solicitudes de ingreso"],"x-kuida-resource":"intake_requests","x-kuida-method":"retrieve","x-kuida-scope":"intake_requests:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^int_.*","example":"int_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeRequest"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/treatments":{"post":{"operationId":"treatments.create","summary":"Registrar un tratamiento","description":"Registra un tratamiento indicado al paciente. Queda en su ficha y el agente lo tiene en cuenta en la conversación. Kuida no envía recordatorios de toma de medicación.","tags":["Tratamientos"],"x-kuida-resource":"treatments","x-kuida-method":"create","x-kuida-scope":"treatments:write","x-kuida-service":"follow_up","x-kuida-idempotent":true,"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreatmentCreateParams"},"example":{"patient":"pat_cm1a2b3c4d5e6f7g8h9i0j","name":"Enalapril 10 mg","dosage":"1 comprimido","frequency":"cada 12 horas","startDate":"2026-10-05T00:00:00-03:00"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Treatment"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"treatments.list","summary":"Listar tratamientos","description":"Tratamientos registrados, del más nuevo al más viejo.","tags":["Tratamientos"],"x-kuida-resource":"treatments","x-kuida-method":"list","x-kuida-scope":"treatments:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"patient","in":"query","required":false,"schema":{"type":"string"}},{"name":"active","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreatmentList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/treatments/{id}":{"get":{"operationId":"treatments.retrieve","summary":"Obtener un tratamiento","description":"Devuelve un tratamiento por su id.","tags":["Tratamientos"],"x-kuida-resource":"treatments","x-kuida-method":"retrieve","x-kuida-scope":"treatments:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^trt_.*","example":"trt_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Treatment"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/events":{"post":{"operationId":"events.create","summary":"Enviar eventos","description":"La puerta genérica: su sistema avisa lo que pasó con el sobre común y Kuida reacciona. Acepta un evento o un lote de hasta 100. Cada evento se procesa por separado y trae su propio resultado; el status HTTP es 200 si al menos uno se aceptó. Si ninguno entró, responde el error de siempre (400 si todos fallaron por esquema, 500 si fallaron al procesarse) y además `results` con el detalle de cada evento. Los recursos (`/v1/visits`, `/v1/appointments`, …) hacen lo mismo con una forma más cómoda.","tags":["Eventos"],"x-kuida-resource":"events","x-kuida-method":"create","x-kuida-scope":"events:write","x-kuida-service":"follow_up","x-kuida-idempotent":true,"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventBatchInput"},"example":{"id":"turno-123-atendido","type":"visit.completed","occurredAt":"2026-10-05T10:45:00-03:00","source":{"system":"mi-sistema","version":"3.2"},"data":{"patient":{"phone":"+54 9 342 555 0000","fullName":"Paciente Demo","dni":"11111111"},"visit":{"visitedAt":"2026-10-05T10:45:00-03:00","externalId":"turno-123"}}}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventBatchResponse"}}}},"400":{"description":"Ningún evento del lote es válido (trae `results` con el detalle por evento) o el pedido es inválido.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/Error/properties/error"},"object":{"type":"string","const":"event_batch"},"results":{"type":"array","items":{"$ref":"#/components/schemas/EventResult"}}}}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"No se pudo procesar ningún evento del lote (`api_error`). Trae `results`; reintente con los mismos id.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/Error/properties/error"},"object":{"type":"string","const":"event_batch"},"results":{"type":"array","items":{"$ref":"#/components/schemas/EventResult"}}}}}}}}},"get":{"operationId":"events.list","summary":"Listar eventos","description":"Todo lo que entró a Kuida para la organización (por la API, el conector, el correo), del más nuevo al más viejo. Sirve para depurar una integración: filtre por `status=failed`.","tags":["Eventos"],"x-kuida-resource":"events","x-kuida-method":"list","x-kuida-scope":"events:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["intake.requested","patient.upserted","appointment.created","appointment.rescheduled","appointment.cancelled","visit.completed","treatment.prescribed","order.issued"]}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["received","processed","failed","duplicate","unhandled"]}},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["api","pms","email","tool","manual","import"]}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/events/{id}":{"get":{"operationId":"events.retrieve","summary":"Obtener un evento","description":"Un evento que entró a Kuida, con su estado y lo que produjo.","tags":["Eventos"],"x-kuida-resource":"events","x-kuida-method":"retrieve","x-kuida-scope":"events:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^evt_.*","example":"evt_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook_endpoints":{"post":{"operationId":"webhook_endpoints.create","summary":"Crear un endpoint de webhooks","description":"Registra una URL de su sistema para recibir eventos de Kuida. La respuesta trae el `secret` para verificar la firma: guárdelo, no se vuelve a mostrar.","tags":["Webhooks"],"x-kuida-resource":"webhook_endpoints","x-kuida-method":"create","x-kuida-scope":"webhooks:write","x-kuida-idempotent":true,"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointCreateParams"},"example":{"url":"https://sistema.example/kuida/webhooks","enabledEvents":["intake.ready","intake.created"],"description":"Sistema de admisión"}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"webhook_endpoints.list","summary":"Listar endpoints de webhooks","description":"Los endpoints de la organización, del más nuevo al más viejo.","tags":["Webhooks"],"x-kuida-resource":"webhook_endpoints","x-kuida-method":"list","x-kuida-scope":"webhooks:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook_endpoints/{id}":{"get":{"operationId":"webhook_endpoints.retrieve","summary":"Obtener un endpoint de webhooks","description":"Devuelve un endpoint, sin el secreto.","tags":["Webhooks"],"x-kuida-resource":"webhook_endpoints","x-kuida-method":"retrieve","x-kuida-scope":"webhooks:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^we_.*","example":"we_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"webhook_endpoints.update","summary":"Actualizar un endpoint de webhooks","description":"Cambia URL, eventos o descripción, o lo pausa con `disabled: true`.","tags":["Webhooks"],"x-kuida-resource":"webhook_endpoints","x-kuida-method":"update","x-kuida-scope":"webhooks:write","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^we_.*","example":"we_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointUpdateParams"},"example":{"enabledEvents":["*"]}}}},"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"webhook_endpoints.delete","summary":"Borrar un endpoint de webhooks","description":"Lo borra con su historial de entregas. Las entregas pendientes se cancelan.","tags":["Webhooks"],"x-kuida-resource":"webhook_endpoints","x-kuida-method":"delete","x-kuida-scope":"webhooks:write","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^we_.*","example":"we_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedObject"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook_endpoints/{id}/ping":{"post":{"operationId":"webhook_endpoints.ping","summary":"Mandar un evento de prueba","description":"Encola un evento `webhook.ping` firmado hacia el endpoint, con los mismos reintentos que uno real. Siga la entrega con `GET /v1/webhook_deliveries/{id}`.","tags":["Webhooks"],"x-kuida-resource":"webhook_endpoints","x-kuida-method":"ping","x-kuida-scope":"webhooks:write","x-kuida-idempotent":true,"parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^we_.*","example":"we_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Otro pedido con la misma Idempotency-Key está en curso.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook_deliveries":{"get":{"operationId":"webhook_deliveries.list","summary":"Listar entregas de webhooks","description":"Cada envío a sus endpoints con sus intentos. Filtre por endpoint o por `status=failed` para ver qué no llegó.","tags":["Webhooks"],"x-kuida-resource":"webhook_deliveries","x-kuida-method":"list","x-kuida-scope":"webhooks:read","x-kuida-paginated":true,"parameters":[{"name":"limit","in":"query","required":false,"description":"Cantidad de objetos a devolver, entre 1 y 100. Default 10.","schema":{"default":10,"type":"integer","minimum":1,"maximum":100}},{"name":"startingAfter","in":"query","required":false,"description":"Cursor: id del último objeto de la página anterior. Devuelve los siguientes.","schema":{"type":"string"}},{"name":"endingBefore","in":"query","required":false,"description":"Cursor: id del primer objeto de la página actual. Devuelve los anteriores.","schema":{"type":"string"}},{"name":"webhookEndpoint","in":"query","required":false,"description":"Id del endpoint (`we_…`).","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","succeeded","failed"]}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryList"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhook_deliveries/{id}":{"get":{"operationId":"webhook_deliveries.retrieve","summary":"Obtener una entrega de webhook","description":"Una entrega con su estado, intentos y el cuerpo enviado.","tags":["Webhooks"],"x-kuida-resource":"webhook_deliveries","x-kuida-method":"retrieve","x-kuida-scope":"webhooks:read","parameters":[{"name":"id","in":"path","required":true,"description":"Id del objeto.","schema":{"type":"string","pattern":"^whd_.*","example":"whd_cm1a2b3c4d5e6f7g8h9i0j"}},{"$ref":"#/components/parameters/KuidaVersion"}],"responses":{"200":{"description":"OK","headers":{"Request-Id":{"$ref":"#/components/headers/RequestId"},"Kuida-Version":{"$ref":"#/components/headers/KuidaVersion"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"400":{"description":"Pedido inválido (`invalid_request_error`) o Idempotency-Key reusada (`idempotency_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Clave faltante, inválida, revocada o vencida (`authentication_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Falta el scope o la línea de servicio (`permission_error`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"El objeto no existe (`resource_missing`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 600 pedidos por minuto (`rate_limit_error`). Respete Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error de Kuida (`api_error`). Reintente con la misma Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"intake.requested":{"post":{"operationId":"webhook.intake.requested","summary":"intake.requested","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"patient.upserted":{"post":{"operationId":"webhook.patient.upserted","summary":"patient.upserted","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"appointment.created":{"post":{"operationId":"webhook.appointment.created","summary":"appointment.created","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"appointment.rescheduled":{"post":{"operationId":"webhook.appointment.rescheduled","summary":"appointment.rescheduled","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"appointment.cancelled":{"post":{"operationId":"webhook.appointment.cancelled","summary":"appointment.cancelled","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"visit.completed":{"post":{"operationId":"webhook.visit.completed","summary":"visit.completed","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"treatment.prescribed":{"post":{"operationId":"webhook.treatment.prescribed","summary":"treatment.prescribed","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"order.issued":{"post":{"operationId":"webhook.order.issued","summary":"order.issued","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"intake.created":{"post":{"operationId":"webhook.intake.created","summary":"intake.created","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"intake.ready":{"post":{"operationId":"webhook.intake.ready","summary":"intake.ready","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"conversation.handoff":{"post":{"operationId":"webhook.conversation.handoff","summary":"conversation.handoff","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"patient.silent":{"post":{"operationId":"webhook.patient.silent","summary":"patient.silent","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}},"webhook.ping":{"post":{"operationId":"webhook.webhook.ping","summary":"webhook.ping","description":"Kuida hace POST a su endpoint con este cuerpo, firmado con HMAC-SHA256 (headers `x-kuida-signature` y `x-kuida-timestamp`). Responda 2xx en menos de 10 s; si no, se reintente hasta 9 veces en ~3 días.","parameters":[{"name":"x-kuida-signature","in":"header","required":true,"schema":{"type":"string"},"description":"`sha256=<hex>` de HMAC-SHA256(secret, `${timestamp}.${body}`)."},{"name":"x-kuida-timestamp","in":"header","required":true,"schema":{"type":"string"},"description":"Epoch en segundos. Rechace más de 5 minutos de diferencia."},{"name":"x-kuida-event-type","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-kuida-delivery-attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Recibido."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"kd_<live|test>_<prefijo>_<secreto>","description":"Clave de API de la organización. La emite Kuida; el secreto se ve una sola vez."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Clave única por operación (un UUID v4). Reintentar con la misma clave devuelve la respuesta original sin repetir la operación. Vive 24 h. Los SDKs la generan solos."},"KuidaVersion":{"name":"Kuida-Version","in":"header","required":false,"schema":{"type":"string","example":"2026-09-28"},"description":"Versión fechada de la API. Sin header, la vigente. Los SDKs mandan la suya."}},"headers":{"RequestId":{"schema":{"type":"string"},"description":"Id del pedido (`req_…`). Envíelo si escribe a soporte."},"KuidaVersion":{"schema":{"type":"string"},"description":"Versión con la que se armó la respuesta."}},"schemas":{"Account":{"type":"object","properties":{"id":{"type":"string","pattern":"^org_.*","description":"Id de la organización.","example":"org_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"account"},"name":{"type":"string"},"type":{"type":"string","description":"Tipo de institución (clinic, pharmacy, lab, …)."},"timeZone":{"type":"string","example":"America/Argentina/Buenos_Aires"},"serviceLines":{"type":"array","items":{"type":"string","enum":["follow_up","network"]},"description":"Líneas de servicio contratadas: seguimiento de pacientes y red de derivaciones."},"livemode":{"type":"boolean","description":"`true` en producción, `false` en el entorno de pruebas."},"apiKey":{"type":"object","properties":{"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}},"required":["name","prefix","scopes"],"additionalProperties":false}},"required":["id","object","name","type","timeZone","serviceLines","livemode","apiKey"],"additionalProperties":false,"description":"La organización dueña de la clave de API."},"Appointment":{"type":"object","properties":{"id":{"type":"string","pattern":"^apt_.*","description":"Id del turno.","example":"apt_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"appointment"},"patient":{"type":"string","pattern":"^pat_.*","description":"Paciente del turno.","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"},"doctor":{"anyOf":[{"type":"string","pattern":"^doc_.*","description":"Profesional.","example":"doc_cm1a2b3c4d5e6f7g8h9i0j"},{"type":"null"}]},"startAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"status":{"type":"string","enum":["confirmed","pending","rescheduled","cancelled","completed"]},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tipo de turno o práctica."},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Id del turno en su sistema."},"source":{"type":"string","enum":["api","pms","agent","manual"],"description":"Por dónde entró: su API, el conector del sistema de gestión, el agente de Kuida o el equipo."},"cancelledAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"updatedAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","patient","doctor","startAt","status","type","externalId","source","cancelledAt","createdAt","updatedAt"],"additionalProperties":false,"description":"Un turno. Kuida le manda al paciente los recordatorios que la organización configuró."},"AppointmentCancelParams":{"type":"object","properties":{"reason":{"description":"Motivo, para el registro.","type":"string","minLength":1,"maxLength":500}}},"AppointmentCreateParams":{"type":"object","properties":{"patient":{"$ref":"#/components/schemas/PatientReference"},"doctor":{"$ref":"#/components/schemas/DoctorReference"},"startAt":{"type":"string","format":"date-time","description":"Inicio del turno.","example":"2026-10-01T14:30:00-03:00"},"type":{"description":"Tipo de turno o práctica.","example":"Control","type":"string","minLength":1,"maxLength":200},"externalId":{"description":"Id del turno en su sistema. Si ya existe un turno con ese id, se devuelve ese y no se crea otro.","example":"turno-123","type":"string","minLength":1,"maxLength":200}},"required":["patient","startAt"]},"AppointmentList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Appointment"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/appointments"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"AppointmentUpdateParams":{"type":"object","properties":{"startAt":{"description":"Nuevo horario. Reprograma los recordatorios.","type":"string","format":"date-time","example":"2026-10-01T14:30:00-03:00"},"doctor":{"$ref":"#/components/schemas/DoctorReference"},"type":{"type":"string","minLength":1,"maxLength":200}}},"DeletedObject":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"deleted":{"type":"boolean","const":true}},"required":["id","object","deleted"],"additionalProperties":false,"description":"Confirmación de un borrado."},"Doctor":{"type":"object","properties":{"id":{"type":"string","pattern":"^doc_.*","description":"Id del profesional.","example":"doc_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"doctor"},"fullName":{"type":"string"},"specialty":{"anyOf":[{"type":"string"},{"type":"null"}]},"licenseNumber":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Matrícula."},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"active":{"type":"boolean","description":"Si atiende hoy. Solo los activos reciben turnos del agente."},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","fullName","specialty","licenseNumber","externalId","active","createdAt"],"additionalProperties":false,"description":"Un profesional del padrón de la organización."},"DoctorIdentity":{"type":"object","properties":{"externalId":{"description":"Id del profesional en su sistema.","type":"string","minLength":1,"maxLength":200},"fullName":{"description":"Nombre del profesional.","example":"Dra. Demo","type":"string","minLength":1,"maxLength":200},"specialty":{"description":"Especialidad.","example":"Cardiología","type":"string","minLength":1,"maxLength":200}},"description":"Cómo conoce su sistema al profesional."},"DoctorList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Doctor"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/doctors"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"DoctorReference":{"anyOf":[{"type":"string","pattern":"^doc_.*","description":"Id de un profesional de Kuida.","example":"doc_cm1a2b3c4d5e6f7g8h9i0j"},{"$ref":"#/components/schemas/DoctorIdentity"}],"description":"Un profesional: su id de Kuida (`doc_…`) o sus datos."},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string","enum":["invalid_request_error","authentication_error","permission_error","idempotency_error","rate_limit_error","api_error"],"description":"Categoría del error. Los SDKs la mapean a una clase de excepción."},"code":{"type":"string","enum":["parameter_missing","parameter_invalid","body_invalid_json","body_too_large","batch_too_large","resource_missing","resource_conflict","api_key_missing","api_key_invalid","api_key_revoked","api_key_expired","scope_missing","service_not_contracted","api_version_invalid","idempotency_key_in_use","idempotency_key_reused","rate_limited","processing_failed","internal_error"],"description":"Qué pasó, en forma estable para programar contra ella."},"message":{"type":"string","description":"Explicación para una persona. Puede cambiar de redacción."},"param":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"El parámetro que causó el error, si aplica (`patient.phone`)."},"requestId":{"type":"string","description":"Id del pedido. Envíelo si escribe a soporte."},"docUrl":{"type":"string","description":"Link a la explicación del código de error."}},"required":["type","code","message","param","requestId","docUrl"],"additionalProperties":false}},"required":["error"],"additionalProperties":false,"description":"Cuerpo de toda respuesta de error."},"Event":{"type":"object","properties":{"id":{"type":"string","pattern":"^evt_.*","description":"Id del evento en Kuida.","example":"evt_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"event"},"type":{"type":"string","enum":["intake.requested","patient.upserted","appointment.created","appointment.rescheduled","appointment.cancelled","visit.completed","treatment.prescribed","order.issued"]},"source":{"type":"string","enum":["api","pms","email","tool","manual","import"],"description":"Por dónde entró."},"sourceRef":{"type":"string","description":"Identidad del evento en su fuente. Para la API, el `id` que envió."},"status":{"type":"string","enum":["received","processed","failed","duplicate","unhandled"],"description":"`processed` Kuida hizo lo suyo · `unhandled` guardado, sin efecto todavía · `failed` falló, reintente con el mismo id · `duplicate` · `received` en curso."},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"result":{"anyOf":[{"type":"object","properties":{"object":{"type":"string"},"id":{"type":"string"}},"required":["object","id"],"additionalProperties":false},{"type":"null"}],"description":"Lo que produjo el evento (`{ object: \"visit\", id: \"vis_…\" }`)."},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"occurredAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"receivedAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"processedAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]}},"required":["id","object","type","source","sourceRef","status","error","result","data","occurredAt","receivedAt","processedAt"],"additionalProperties":false,"description":"Un evento que entró a Kuida, con su resultado."},"EventBatchInput":{"anyOf":[{"$ref":"#/components/schemas/EventInput"},{"minItems":1,"maxItems":100,"type":"array","items":{"$ref":"#/components/schemas/EventInput"}},{"type":"object","properties":{"events":{"minItems":1,"maxItems":100,"type":"array","items":{"$ref":"#/components/schemas/EventInput"}}},"required":["events"]}],"description":"Un evento, un array de hasta 100 o `{ events: [...] }`."},"EventBatchResponse":{"type":"object","properties":{"object":{"type":"string","const":"event_batch"},"results":{"type":"array","items":{"$ref":"#/components/schemas/EventResult"}}},"required":["object","results"],"additionalProperties":false,"description":"Un resultado por evento, en el mismo orden."},"EventInput":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"intake.requested"},"data":{"type":"object","properties":{"patient":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"contacts":{"default":[],"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"relationship":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}}},"coverage":{"type":"object","properties":{"insurer":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"plan":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"memberId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}},"address":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"requestedService":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"sender":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"organization":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}},"attachments":{"default":[],"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"mimeType":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"kind":{"type":"string","enum":["PEDIDO_MEDICO","HISTORIA_CLINICA","COBERTURA","OTRO"]},"ref":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["name"]}},"summary":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"flags":{"type":"object","properties":{"hospitalized":{"type":"boolean"}}},"origin":{"type":"object","properties":{"channel":{"type":"string","enum":["EMAIL","FORM","MANUAL","API"]},"threadId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"messageId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"from":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"subject":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"receivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}}}}},"required":["id","type","data"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"patient.upserted"},"data":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}}},"required":["id","type","data"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"appointment.created"},"data":{"type":"object","properties":{"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"bookingExternalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"startAt":{"type":"string","format":"date-time"},"visitType":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"patient":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"doctor":{"type":"object","properties":{"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"specialty":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}}},"required":["startAt","patient"]}},"required":["id","type","data"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"appointment.rescheduled"},"data":{"type":"object","properties":{"externalId":{"type":"string","minLength":1},"bookingExternalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"startAt":{"type":"string","format":"date-time"},"visitType":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"patient":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"doctor":{"type":"object","properties":{"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"specialty":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}},"reason":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["externalId","startAt","patient"]}},"required":["id","type","data"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"appointment.cancelled"},"data":{"type":"object","properties":{"externalId":{"type":"string","minLength":1},"bookingExternalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"startAt":{"type":"string","format":"date-time"},"visitType":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"patient":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"doctor":{"type":"object","properties":{"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"specialty":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}},"reason":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["externalId","startAt","patient"]}},"required":["id","type","data"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"visit.completed"},"data":{"type":"object","properties":{"patient":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"doctor":{"type":"object","properties":{"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"specialty":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}},"visit":{"type":"object","properties":{"visitedAt":{"type":"string","format":"date-time"},"type":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"diagnosis":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"recommendedFollowUps":{"anyOf":[{"type":"array","items":{}},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"bookingExternalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["visitedAt"]},"raw":{}},"required":["patient","visit"]}},"required":["id","type","data"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"treatment.prescribed"},"data":{"type":"object","properties":{"patient":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"name":{"type":"string","minLength":1},"kind":{"type":"string","enum":["MEDICATION","THERAPY","DIET","STUDY","LABWORK","LIFESTYLE"]},"dosage":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"instructions":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"frequency":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"startAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"endAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"prescribedBy":{"type":"object","properties":{"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"specialty":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}}},"required":["patient","name"]}},"required":["id","type","data"]},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Su id del evento. Es la clave de idempotencia: reenviar el mismo id no repite nada.","example":"turno-123-atendido"},"schemaVersion":{"default":1,"description":"Versión del esquema del evento. Siempre 1 en v1.","type":"number","const":1},"occurredAt":{"description":"Cuándo pasó. Default: ahora.","type":"string","format":"date-time"},"source":{"description":"Qué sistema lo emite, para el registro.","type":"object","properties":{"system":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40}}},"type":{"type":"string","const":"order.issued"},"data":{"type":"object","properties":{"patient":{"type":"object","properties":{"phone":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dni":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"email":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"dateOfBirth":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"kind":{"type":"string","enum":["LAB","IMAGING","CONSULT","OTHER"]},"description":{"type":"string","minLength":1},"issuedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"issuedBy":{"type":"object","properties":{"fullName":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"specialty":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}}}},"required":["patient","kind","description"]}},"required":["id","type","data"]}],"description":"Un evento del catálogo v1. El `type` define la forma de `data`."},"EventList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/events"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"EventResult":{"type":"object","properties":{"id":{"type":"string","description":"El id que envió."},"accepted":{"type":"boolean"},"status":{"type":"string","enum":["processed","duplicate","unhandled","invalid","failed"]},"event":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Id del evento en Kuida (`evt_…`)."},"result":{"anyOf":[{"type":"object","properties":{"object":{"type":"string"},"id":{"type":"string"}},"required":["object","id"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","accepted","status","event","result","error"],"additionalProperties":false},"IntakeContact":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"relationship":{"example":"hija","type":"string","minLength":1,"maxLength":80},"phone":{"type":"string","minLength":1,"maxLength":40},"email":{"type":"string","format":"email"}},"description":"Un referente del paciente (familiar, cuidador)."},"IntakeCoverage":{"type":"object","properties":{"insurer":{"description":"Obra social o prepaga.","example":"OSDEMO","type":"string","minLength":1,"maxLength":200},"plan":{"type":"string","minLength":1,"maxLength":200},"memberId":{"description":"Número de afiliado.","type":"string","minLength":1,"maxLength":100}}},"IntakeRequest":{"type":"object","properties":{"id":{"type":"string","pattern":"^int_.*","description":"Id de la solicitud.","example":"int_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"intake_request"},"status":{"type":"string","enum":["new","validating","ready","loaded","discarded"],"description":"`new` recién llegada · `validating` Kuida está completando datos por WhatsApp · `ready` completa · `loaded` cargada en el sistema de la organización · `discarded` descartada."},"patient":{"anyOf":[{"type":"string","pattern":"^pat_.*","description":"Paciente, cuando ya se pudo identificar.","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"missing":{"type":"array","items":{"type":"string"},"description":"Datos que todavía faltan para que la solicitud quede lista."},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Los datos de la solicitud tal como los tiene Kuida."},"discardReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"readyAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"loadedAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"closedAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"updatedAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","status","patient","summary","missing","data","discardReason","readyAt","loadedAt","closedAt","createdAt","updatedAt"],"additionalProperties":false,"description":"Una solicitud de ingreso: alguien pide el servicio para un paciente y Kuida completa lo que falta."},"IntakeRequestCreateParams":{"type":"object","properties":{"patient":{"$ref":"#/components/schemas/PatientIdentity"},"contacts":{"maxItems":10,"type":"array","items":{"$ref":"#/components/schemas/IntakeContact"}},"coverage":{"$ref":"#/components/schemas/IntakeCoverage"},"address":{"type":"string","minLength":1,"maxLength":500},"requestedService":{"example":"Internación domiciliaria","type":"string","minLength":1,"maxLength":500},"summary":{"description":"Resumen administrativo del pedido, sin contenido clínico.","type":"string","minLength":1,"maxLength":4000},"hospitalized":{"description":"Si el paciente está internado hoy.","type":"boolean"},"sender":{"description":"Quién pide el servicio.","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email"},"organization":{"type":"string","minLength":1,"maxLength":200}}}},"description":"Hace falta al menos un dato del paciente o de un referente (nombre, documento o teléfono)."},"IntakeRequestList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/IntakeRequest"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/intake_requests"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"Patient":{"type":"object","properties":{"id":{"type":"string","pattern":"^pat_.*","description":"Id del paciente.","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"patient"},"fullName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Teléfono normalizado."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"dni":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Id del paciente en su sistema."},"dateOfBirth":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Fecha de nacimiento (AAAA-MM-DD)."},"stage":{"type":"string","enum":["pending_follow_up","in_conversation","scheduled","periodic_follow_up","discharged","lost"],"description":"Estado básico del paciente en Kuida."},"optedOut":{"type":"boolean","description":"Si el paciente pidió no recibir mensajes. Kuida no le escribe."},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"updatedAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","fullName","phone","email","dni","externalId","dateOfBirth","stage","optedOut","createdAt","updatedAt"],"additionalProperties":false,"description":"Un paciente de la organización."},"PatientCreateParams":{"type":"object","properties":{"phone":{"type":"string","minLength":1,"maxLength":40,"description":"Celular con WhatsApp, en cualquier formato; Kuida lo normaliza.","example":"+54 9 342 555 0000"},"fullName":{"description":"Nombre y apellido.","example":"Paciente Demo","type":"string","minLength":1,"maxLength":200},"dni":{"description":"Documento, sin puntos.","example":"11111111","type":"string","minLength":1,"maxLength":20},"email":{"description":"Correo electrónico.","type":"string","format":"email"},"externalId":{"description":"Id del paciente en su sistema.","example":"HC-1234","type":"string","minLength":1,"maxLength":200},"dateOfBirth":{"type":"string","format":"date","description":"Fecha ISO 8601 (AAAA-MM-DD).","example":"1980-05-17"}},"required":["phone"]},"PatientIdentity":{"type":"object","properties":{"phone":{"description":"Celular con WhatsApp, en cualquier formato; Kuida lo normaliza. Es la identidad principal del paciente.","example":"+54 9 342 555 0000","type":"string","minLength":1,"maxLength":40},"fullName":{"description":"Nombre y apellido.","example":"Paciente Demo","type":"string","minLength":1,"maxLength":200},"dni":{"description":"Documento, sin puntos.","example":"11111111","type":"string","minLength":1,"maxLength":20},"email":{"description":"Correo electrónico.","type":"string","format":"email"},"externalId":{"description":"Id del paciente en su sistema.","example":"HC-1234","type":"string","minLength":1,"maxLength":200},"dateOfBirth":{"type":"string","format":"date","description":"Fecha ISO 8601 (AAAA-MM-DD).","example":"1980-05-17"}},"description":"Cómo conoce su sistema al paciente. Kuida lo busca por teléfono y después por DNI; si no existe, lo crea."},"PatientList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Patient"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/patients"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"PatientReference":{"anyOf":[{"type":"string","pattern":"^pat_.*","description":"Id de un paciente de Kuida.","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"},{"$ref":"#/components/schemas/PatientIdentity"}],"description":"Un paciente: su id de Kuida (`pat_…`) o los datos con que lo conoce su sistema."},"PatientUpdateParams":{"type":"object","properties":{"fullName":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email"},"dni":{"type":"string","minLength":1,"maxLength":20},"externalId":{"type":"string","minLength":1,"maxLength":200},"dateOfBirth":{"type":"string","format":"date","description":"Fecha ISO 8601 (AAAA-MM-DD).","example":"1980-05-17"}},"description":"Solo cambia lo que envía. El teléfono no se cambia: es la identidad."},"Treatment":{"type":"object","properties":{"id":{"type":"string","pattern":"^trt_.*","description":"Id del tratamiento.","example":"trt_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"treatment"},"patient":{"type":"string","pattern":"^pat_.*","description":"Paciente.","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"},"kind":{"type":"string","enum":["medication","therapy","diet","study","labwork","lifestyle"]},"name":{"type":"string"},"dosage":{"anyOf":[{"type":"string"},{"type":"null"}]},"frequency":{"anyOf":[{"type":"string"},{"type":"null"}]},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}]},"startDate":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"endDate":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"updatedAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","patient","kind","name","dosage","frequency","instructions","startDate","endDate","active","createdAt","updatedAt"],"additionalProperties":false,"description":"Un tratamiento indicado al paciente."},"TreatmentCreateParams":{"type":"object","properties":{"patient":{"$ref":"#/components/schemas/PatientReference"},"name":{"type":"string","minLength":1,"maxLength":300,"example":"Enalapril 10 mg"},"kind":{"description":"Default `medication`.","type":"string","enum":["medication","therapy","diet","study","labwork","lifestyle"]},"dosage":{"type":"string","minLength":1,"maxLength":200},"frequency":{"example":"cada 12 horas","type":"string","minLength":1,"maxLength":200},"instructions":{"type":"string","minLength":1,"maxLength":4000},"startDate":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"endDate":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["patient","name"]},"TreatmentList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Treatment"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/treatments"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"Visit":{"type":"object","properties":{"id":{"type":"string","pattern":"^vis_.*","description":"Id de la consulta.","example":"vis_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"visit"},"patient":{"type":"string","pattern":"^pat_.*","description":"Paciente atendido.","example":"pat_cm1a2b3c4d5e6f7g8h9i0j"},"doctor":{"anyOf":[{"type":"string","pattern":"^doc_.*","description":"Profesional.","example":"doc_cm1a2b3c4d5e6f7g8h9i0j"},{"type":"null"}]},"appointment":{"anyOf":[{"type":"string","pattern":"^apt_.*","description":"Turno del que salió la consulta.","example":"apt_cm1a2b3c4d5e6f7g8h9i0j"},{"type":"null"}]},"visitedAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"type":{"anyOf":[{"type":"string"},{"type":"null"}]},"diagnosis":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string","enum":["pms","manual"]},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","patient","doctor","appointment","visitedAt","type","diagnosis","notes","externalId","source","createdAt"],"additionalProperties":false,"description":"Una consulta atendida. Crearla arranca el seguimiento post-consulta del paciente."},"VisitCreateParams":{"type":"object","properties":{"patient":{"$ref":"#/components/schemas/PatientReference"},"doctor":{"$ref":"#/components/schemas/DoctorReference"},"visitedAt":{"type":"string","format":"date-time","description":"Cuándo se atendió.","example":"2026-10-01T14:30:00-03:00"},"type":{"type":"string","minLength":1,"maxLength":200},"externalId":{"description":"Id de la consulta en su sistema. Si ya existe, se devuelve esa y no se crea otra.","type":"string","minLength":1,"maxLength":200},"appointment":{"description":"Turno del que sale la consulta: id de Kuida (`apt_…`) o el `externalId` del turno. Lo marca como atendido.","type":"string"},"diagnosis":{"type":"string","minLength":1,"maxLength":4000},"notes":{"type":"string","minLength":1,"maxLength":4000}},"required":["patient","visitedAt"]},"VisitList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Visit"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/visits"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","pattern":"^whd_.*","description":"Id de la entrega.","example":"whd_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"webhook_delivery"},"webhookEndpoint":{"type":"string","pattern":"^we_.*","description":"Endpoint destino.","example":"we_cm1a2b3c4d5e6f7g8h9i0j"},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","succeeded","failed"],"description":"`pending` en curso o esperando reintento · `succeeded` su endpoint respondió 2xx · `failed` se agotaron los reintentos."},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastStatusCode":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastError":{"anyOf":[{"type":"string"},{"type":"null"}]},"nextAttemptAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"deliveredAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"El cuerpo exacto que se envió."},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","webhookEndpoint","eventType","status","attempts","lastStatusCode","lastError","nextAttemptAt","deliveredAt","payload","createdAt"],"additionalProperties":false,"description":"Un envío de webhook con sus reintentos."},"WebhookDeliveryList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/webhook_deliveries"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string","pattern":"^we_.*","description":"Id del endpoint.","example":"we_cm1a2b3c4d5e6f7g8h9i0j"},"object":{"type":"string","const":"webhook_endpoint"},"url":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"enabledEvents":{"type":"array","items":{"type":"string"},"description":"Tipos de evento que recibe. `*` = todos."},"status":{"type":"string","enum":["enabled","disabled"]},"secret":{"description":"Secreto para verificar la firma (`whsec_…`). Solo viene en la respuesta de creación.","type":"string"},"lastDeliveredAt":{"anyOf":[{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},{"type":"null"}]},"lastError":{"anyOf":[{"type":"object","properties":{"at":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"},"message":{"type":"string"}},"required":["at","message"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","description":"Fecha y hora ISO 8601.","example":"2026-10-01T14:30:00-03:00"}},"required":["id","object","url","description","enabledEvents","status","lastDeliveredAt","lastError","createdAt"],"additionalProperties":false,"description":"Una URL de su sistema a la que Kuida le avisa lo que pasa."},"WebhookEndpointCreateParams":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri","description":"URL https de su sistema.","example":"https://sistema.example/kuida/webhooks"},"enabledEvents":{"minItems":1,"type":"array","items":{"type":"string","enum":["intake.requested","patient.upserted","appointment.created","appointment.rescheduled","appointment.cancelled","visit.completed","treatment.prescribed","order.issued","intake.created","intake.ready","conversation.handoff","patient.silent","webhook.ping","*"]},"description":"Qué eventos quiere recibir. `*` = todos.","example":["intake.ready"]},"description":{"type":"string","minLength":1,"maxLength":500}},"required":["url","enabledEvents"]},"WebhookEndpointList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"hasMore":{"type":"boolean","description":"Si hay más objetos después de esta página."},"url":{"type":"string","example":"/v1/webhook_endpoints"}},"required":["object","data","hasMore","url"],"additionalProperties":false,"description":"Página de resultados. Siga con `startingAfter` = id del último."},"WebhookEndpointUpdateParams":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"enabledEvents":{"minItems":1,"type":"array","items":{"type":"string","enum":["intake.requested","patient.upserted","appointment.created","appointment.rescheduled","appointment.cancelled","visit.completed","treatment.prescribed","order.issued","intake.created","intake.ready","conversation.handoff","patient.silent","webhook.ping","*"]}},"description":{"type":"string","minLength":1,"maxLength":500},"disabled":{"description":"`true` pausa los envíos sin borrar el endpoint.","type":"boolean"}}},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string","description":"Id de la entrega (`whd_…`). Estable entre reintentos: deduplique por este campo."},"object":{"type":"string","const":"event"},"type":{"type":"string","enum":["intake.requested","patient.upserted","appointment.created","appointment.rescheduled","appointment.cancelled","visit.completed","treatment.prescribed","order.issued","intake.created","intake.ready","conversation.handoff","patient.silent","webhook.ping"]},"apiVersion":{"type":"string","example":"2026-09-28"},"livemode":{"type":"boolean"},"occurredAt":{"type":"string","format":"date-time","description":"Cuándo pasó, ISO 8601."},"ref":{"type":"string","description":"Id interno de lo que disparó el evento."},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Los datos del hecho."}},"required":["id","object","type","apiVersion","livemode","occurredAt","ref","data"],"additionalProperties":false,"description":"Lo que Kuida le manda a su endpoint."}}}}