> ## 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 programación

> Programa el envío de un formulario a un paciente por el canal especificado.

## Body

<ParamField body="formId" type="string" required>
  ID del formulario a enviar.
</ParamField>

<ParamField body="patientId" type="string" required>
  ID del paciente destinatario.
</ParamField>

<ParamField body="channel" type="string" required>
  Canal de envío. Valores: `email`, `sms`, `whatsapp`, `app`.
</ParamField>

<ParamField body="scheduledAt" type="string">
  Fecha y hora de envío en formato ISO 8601. Si se omite, se envía inmediatamente.
</ParamField>

<ParamField body="message" type="string">
  Mensaje personalizado que acompaña al formulario. Si se omite, se usa el mensaje por defecto.
</ParamField>

### Coste por canal

| Canal      | Créditos |
| ---------- | -------- |
| `email`    | 1        |
| `sms`      | 2        |
| `whatsapp` | 3        |
| `app`      | 0        |

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "sch_def456",
    "formId": "form_abc123",
    "patientId": "pat_xyz789",
    "channel": "whatsapp",
    "status": "pending",
    "scheduledAt": "2026-05-15T09:00:00Z",
    "message": "Hola María, te enviamos tu cuestionario de seguimiento semanal.",
    "creditsConsumed": 3,
    "createdAt": "2026-05-14T10:00:00Z"
  }
  ```
</ResponseExample>

<ResponseField name="id" type="string">
  Identificador único de la programación con prefijo `sch_`.
</ResponseField>

<ResponseField name="status" type="string">
  Estado de la programación: `pending`, `sent`, `failed`.
</ResponseField>

<ResponseField name="creditsConsumed" type="integer">
  Créditos consumidos según el canal seleccionado.
</ResponseField>


## OpenAPI

````yaml openapi.yml POST /form-schedules
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:
  /form-schedules:
    post:
      tags:
        - Programaciones
      summary: Crear programación
      description: Programa el envío de un formulario a un paciente
      operationId: createFormSchedule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - formId
                - patientId
                - channel
                - scheduledAt
              properties:
                formId:
                  type: string
                patientId:
                  type: string
                channel:
                  type: string
                  enum:
                    - email
                    - sms
                    - whatsapp
                    - app
                    - voice_call
                scheduledAt:
                  type: string
                  format: date-time
                message:
                  type: string
      responses:
        '201':
          description: Programación creada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormSchedule'
components:
  schemas:
    FormSchedule:
      type: object
      properties:
        id:
          type: string
        formId:
          type: string
        patientId:
          type: string
        channel:
          type: string
        scheduledAt:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - pending
            - sent
            - failed
            - cancelled
            - completed
        createdAt:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Token JWT obtenido via POST /auth/token

````