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

# Schedule outbound call with external questionnaire

> Creates an outbound call in `pending` status linked to a `questionnaireId`. Use `schedulingWindow` when you need to constrain date or time.



## OpenAPI

````yaml /openapi/openapi-maria-en.yaml post /api/v1/calls/external-questionnaire
openapi: 3.1.0
info:
  title: marIA API
  version: 1.0.0
  description: >
    marIA is Omniloy's voice agent that handles incoming patient calls at
    hospitals and clinics.

    - Voice / Telephony: the patient calls and marIA answers, manages
    appointments with the EHR/HIS, answers FAQs and escalates to a human when
    necessary.

    - WhatsApp Notifications: appointment confirmations and reminders via
    approved template.

    - Centers and services: consultation and management of centers, specialties
    and coverages configured in marIA.

    - FAQ Knowledge Base: documents that feed the agent's knowledge about
    centers and services.

    - Outbound calls and questionnaires: outbound scheduling and follow up
    questionnaires.

    - EHR/HIS integration via webhooks: marIA ⇄ Hospital for benefits, slots and
    appointments.

    - Webhook management: registration and configuration of endpoints to receive
    events from marIA.

    Top-level webhooks notify events (e.g. call status, appointments) signed
    with `webhookHmac`.
servers:
  - url: https://{your-prod-endpoint}
    description: Production
    variables:
      your-prod-endpoint:
        default: your-prod-endpoint
        description: Replace this value with the real host before trying the request.
  - url: https://{your-dev-endpoint}
    description: Staging
    variables:
      your-dev-endpoint:
        default: your-dev-endpoint
        description: Replace this value with the staging or development host.
security: []
tags:
  - name: Health
    description: Service status and availability.
  - name: Centers
    description: Medical centers with their services and coverages configured in marIA.
  - name: WhatsApp Notifications
    description: Sending appointment confirmations and reminders via WhatsApp template.
  - name: FAQ
    description: >-
      FAQ documents so the agent can answer questions about centers and
      services.
  - name: Webhooks - Appointments
    description: Appointment events integrated with the EHR/HIS.
  - name: Webhooks - Voice
    description: Telephony events (call status, escalation, answers and transcripts).
  - name: Voice Calls
    description: Inbound and outbound calls registered in MarIA Core.
  - name: Voice Answers
    description: Access and filtering of answers captured during calls.
  - name: Voice Transcripts
    description: Access to transcripts and recording links.
  - name: Content - Questionnaires
    description: Questionnaire definitions for outbound calls.
  - name: Questionnaire Instances
    description: Questionnaire instance status, review state, and results.
  - name: Scheduling - Time Ranges
    description: Reusable time ranges for scheduling calls.
  - name: Gestión de webhooks
    description: Webhook configuration and management; endpoints for integrators.
paths:
  /api/v1/calls/external-questionnaire:
    post:
      tags:
        - Voice Calls
      summary: Schedule outbound call with external questionnaire
      description: >-
        Creates an outbound call in `pending` status linked to a
        `questionnaireId`. Use `schedulingWindow` when you need to constrain
        date or time.
      operationId: schedule-external-questionnaire-call
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExternalQuestionnaireCallInputDto'
            example:
              name: Ana
              surname1: Garcia
              phone: '+34612345678'
              questionnaireId: 550e8400-e29b-41d4-a716-446655440000
              externalId: case-123
              schedulingWindow:
                date: '2026-05-12'
                startTime: '10:00'
                endTime: '12:00'
              metadata:
                source: ehr
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCallEnvelopeDto'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '404':
          description: Questionnaire not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
      security:
        - apiKeyAuth: []
components:
  schemas:
    ExternalQuestionnaireCallInputDto:
      type: object
      properties:
        name:
          type: string
        surname1:
          type: string
        surname2:
          type: string
        phone:
          type: string
          example: '+34612345678'
        questionnaireId:
          type: string
          format: uuid
        externalId:
          type: string
        schedulingWindow:
          $ref: '#/components/schemas/SchedulingWindowDto'
        metadata:
          type: object
          additionalProperties: true
      required:
        - name
        - phone
        - questionnaireId
    CreateCallEnvelopeDto:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
          properties:
            callId:
              type: string
              format: uuid
            call:
              $ref: '#/components/schemas/CallCoreDto'
    ErrorDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        code:
          type: integer
        error_code:
          type: string
        message:
          type: string
      required:
        - status
        - code
        - error_code
        - message
    SchedulingWindowDto:
      type: object
      properties:
        date:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
        startTime:
          type: string
          pattern: ^\d{2}:\d{2}$
        endTime:
          type: string
          pattern: ^\d{2}:\d{2}$
        allowedDaysOfWeek:
          type: array
          items:
            type: integer
            minimum: 0
            maximum: 6
    CallCoreDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        apiKeyId:
          type: string
        endUserId:
          type: string
          description: >-
            ID of the patient or end user associated with this call. Equivalent
            to `userId` in QuestionnaireInstanceDto.
        questionnaireInstanceId:
          type: string
        callDirection:
          type: string
          enum:
            - inbound
            - outbound
        status:
          type: string
          enum:
            - pending
            - dialing
            - failure
            - no_answer
            - in_progress
            - rejected
            - success
            - transferred
            - canceled
            - service_off
        scheduledAt:
          type: string
          format: date-time
        startedAt:
          type: string
          format: date-time
        endedAt:
          type: string
          format: date-time
        schedulingWindow:
          $ref: '#/components/schemas/SchedulingWindowDto'
        transcription:
          type: array
          items:
            type: object
            properties:
              speaker:
                type: string
                enum:
                  - patient
                  - operator
              content:
                type: string
              time:
                type: string
                format: date-time
        summary:
          type: string
        transferReason:
          type: string
        userIntent:
          type: string
        callResult:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        API Key provided by Omniloy. The same key is used for inbound and
        outbound calls.

````