> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linahealthcareplatform.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Crear webhook

> Registra un nuevo endpoint de webhook para recibir notificaciones de eventos.

## Body

<ParamField body="url" type="string" required>
  URL HTTPS de tu endpoint que recibirá los eventos.
</ParamField>

<ParamField body="events" type="string[]" required>
  Lista de eventos a los que suscribirte. Valores: `patient.created`, `form.completed`, `call.ended`, `conversation.ended`, `credits.low`, `schedule.sent`.
</ParamField>

<ParamField body="secret" type="string">
  Clave secreta para firmar los webhooks con HMAC-SHA256. Si se omite, se genera automáticamente.
</ParamField>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "wh_abc123",
    "url": "https://tu-servidor.com/webhooks/lina",
    "events": ["form.completed", "call.ended", "credits.low"],
    "secret": "whsec_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "status": "active",
    "createdAt": "2026-05-14T10:00:00Z"
  }
  ```
</ResponseExample>

<ResponseField name="id" type="string">
  Identificador único del webhook con prefijo `wh_`.
</ResponseField>

<ResponseField name="secret" type="string">
  Clave secreta para verificar firmas. **Solo se muestra en esta respuesta.** Consulta la [guía de webhooks](/guides/webhooks) para implementar la verificación.
</ResponseField>

<ResponseField name="status" type="string">
  Estado del webhook: `active` o `disabled`.
</ResponseField>


## OpenAPI

````yaml openapi.yml POST /webhooks
openapi: 3.1.0
info:
  title: LINA Healthcare Platform API
  version: 1.0.0
  description: |
    API de integración para la plataforma LINA Healthcare.
    Todas las rutas requieren un token JWT obtenido intercambiando una API Key.
servers:
  - url: https://api.linahealthcareplatform.com/api/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /webhooks:
    post:
      tags:
        - Webhooks
      summary: Crear webhook
      operationId: createWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
                - events
              properties:
                url:
                  type: string
                  format: uri
                events:
                  type: array
                  items:
                    type: string
                secret:
                  type: string
      responses:
        '201':
          description: Webhook creado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
components:
  schemas:
    Webhook:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        events:
          type: array
          items:
            type: string
        secret:
          type: string
        status:
          type: string
        createdAt:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Token JWT obtenido via POST /auth/token

````