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

# Create Batch Call

> Create a new batch calling campaign with contacts, scheduling, and configuration.



## OpenAPI

````yaml /api-reference/openapi.json post /batch-calls
openapi: 3.1.0
info:
  title: Truedy API
  description: >-
    Truedy Public API - Build voice AI agents and make automated phone calls.


    ## Authentication

    All requests require **Authorization: Bearer <your_api_key>**.

    Get your API key from the [Truedy Dashboard](https://app.truedy.ai).


    ## Response Format

    All successful responses follow this format:

    ```json

    {
      "data": { /* resource or list of resources */ },
      "meta": {
        "request_id": "req_xxx",
        "ts": "2026-03-03T20:30:21.310278Z"
      },
      "pagination": { /* optional, for list endpoints */ }
    }

    ```


    ## Error Handling

    Errors return appropriate HTTP status codes with structured error messages.
    Always check the `error` field in the response body for details.
  version: 1.0.0
servers:
  - url: https://api.truedy.ai/api/public/v1
    description: Truedy Public API
security:
  - BearerAuth: []
paths:
  /batch-calls:
    post:
      tags:
        - Batch Calls
      summary: Create Batch Call
      description: >-
        Create a new batch calling campaign with contacts, scheduling, and
        configuration.
      operationId: create_batch_call
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchCallCreateRequest'
            examples:
              immediate:
                summary: Immediate campaign with inline contacts
                value:
                  name: Quick Follow-up
                  agent_id: agt_f9447372
                  schedule_type: immediate
                  contacts:
                    - phone_number: '+15551234567'
                      first_name: John
                      last_name: Doe
              scheduled:
                summary: Scheduled campaign with daily limits
                value:
                  name: March follow-up campaign
                  agent_id: agt_f9447372
                  phone_number_ids:
                    - num_11111111-1111-1111-1111-111111111111
                  schedule_type: scheduled
                  scheduled_at: '2026-03-20T09:00:00Z'
                  timezone: America/New_York
                  max_calls_per_day: 500
                  working_days:
                    - 1
                    - 2
                    - 3
                    - 4
                    - 5
                  start_time: '09:00'
                  end_time: '17:30'
                  contact_folder_id: folder_abc123
      responses:
        '201':
          description: Batch call created successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - meta
                properties:
                  data:
                    $ref: '#/components/schemas/BatchCallResponse'
                  meta:
                    $ref: '#/components/schemas/ResponseMeta'
              example:
                data:
                  id: batch_c3d4e5f6
                  name: Q2 Outreach Campaign
                  status: draft
                  agent_id: agt_f9447372
                  from_number: '+18005559876'
                  schedule_type: immediate
                  scheduled_at: null
                  timezone: America/New_York
                  concurrency: 5
                  retry_attempts: 2
                  total_contacts: 500
                  called: 0
                  completed: 0
                  failed: 0
                  pending: 500
                  created_at: '2026-04-01T09:00:00Z'
                  updated_at: '2026-04-05T10:22:00Z'
                meta:
                  request_id: req_32e7531c
                  ts: '2026-04-05T10:22:00Z'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    BatchCallCreateRequest:
      type: object
      required:
        - name
        - agent_id
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
          description: Campaign name
          example: March follow-up campaign
        agent_id:
          type: string
          description: Agent ID to use
          example: agt_f9447372
        phone_number_ids:
          items:
            type: string
          description: Phone number IDs to use (auto-selected from agent if empty)
          example:
            - num_11111111-1111-1111-1111-111111111111
          type:
            - array
            - 'null'
        phone_rotation_strategy:
          type: string
          enum:
            - random
            - sequential
            - round_robin
          description: How to rotate phone numbers
          example: random
        contact_source:
          type: string
          enum:
            - csv
            - folder
            - manual
          description: Where contacts come from
          example: csv
        contact_folder_id:
          description: Folder ID if source is folder
          example: folder_abc123
          type:
            - string
            - 'null'
        contact_ids:
          items:
            type: string
          description: Existing contact IDs to add
          example:
            - ctc_aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
          type:
            - array
            - 'null'
        contacts:
          items:
            type: object
            required:
              - phone_number
            properties:
              phone_number:
                type: string
                pattern: ^\+[1-9]\d{1,14}$
              first_name:
                type: string
              last_name:
                type: string
              email:
                type: string
          description: Inline contacts array
          example:
            - phone_number: '+15551234567'
              first_name: John
              last_name: Doe
          type:
            - array
            - 'null'
        schedule_type:
          type: string
          enum:
            - immediate
            - scheduled
          description: When to start
          example: scheduled
        scheduled_at:
          format: date-time
          description: When to start (required if schedule_type=scheduled)
          example: '2026-03-20T09:00:00Z'
          type:
            - string
            - 'null'
        max_calls_per_day:
          minimum: 1
          description: Maximum calls per day
          example: 500
          type:
            - integer
            - 'null'
        timezone:
          type: string
          description: IANA timezone for scheduling
          example: America/New_York
        start_time:
          pattern: ^\d{2}:\d{2}$
          description: Daily start time (HH:MM)
          example: '09:00'
          type:
            - string
            - 'null'
        end_time:
          pattern: ^\d{2}:\d{2}$
          description: Daily end time (HH:MM)
          example: '17:30'
          type:
            - string
            - 'null'
        working_days:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 7
          description: Working days (1=Mon, 7=Sun)
          example:
            - 1
            - 2
            - 3
            - 4
            - 5
    BatchCallResponse:
      type: object
      required:
        - id
        - name
        - agent_id
        - status
        - created_at
      properties:
        id:
          type: string
          description: Unique batch call identifier
          example: batch_m1n2o3p4
        name:
          type: string
          description: Campaign name
          example: March follow-up campaign
        agent_id:
          type: string
          description: Agent ID used for this batch
          example: agt_f9447372
        status:
          type: string
          enum:
            - draft
            - scheduled
            - active
            - paused
            - completed
            - failed
            - cancelled
          description: Campaign status
          example: active
        phone_number_ids:
          type: array
          items:
            type: string
          description: Phone numbers assigned to this batch
          example:
            - num_11111111-1111-1111-1111-111111111111
        phone_rotation_strategy:
          type: string
          enum:
            - random
            - sequential
            - round_robin
          description: How to rotate between phone numbers
          example: random
        total_contacts:
          type: integer
          description: Total contacts in this batch
          example: 500
        completed_contacts:
          type: integer
          description: Contacts completed (called)
          example: 350
        successful_contacts:
          type: integer
          description: Successfully completed calls
          example: 280
        failed_contacts:
          type: integer
          description: Failed calls
          example: 70
        voicemail_contacts:
          type: integer
          description: Voicemail reached
          example: 45
        no_answer_contacts:
          type: integer
          description: No answer
          example: 25
        total_cost_usd:
          type: number
          description: Total cost in USD
          example: 147.5
        average_duration_seconds:
          type: integer
          description: Average call duration
          example: 187
        schedule_type:
          type: string
          enum:
            - immediate
            - scheduled
          description: Schedule type
          example: scheduled
        scheduled_at:
          format: date-time
          description: When campaign is scheduled to start
          example: '2026-03-20T09:00:00Z'
          type:
            - string
            - 'null'
        max_calls_per_day:
          description: Maximum calls per day
          example: 500
          type:
            - integer
            - 'null'
        created_at:
          type: string
          format: date-time
          description: When created
          example: '2026-03-05T10:00:00.000000Z'
        updated_at:
          format: date-time
          description: When last updated
          example: '2026-03-05T15:30:00.000000Z'
          type:
            - string
            - 'null'
    ResponseMeta:
      type: object
      required:
        - request_id
        - ts
      properties:
        request_id:
          type: string
          description: Unique request identifier for debugging and support
          example: req_32e7531c-8
        ts:
          type: string
          format: date-time
          description: Server timestamp when the response was generated
          example: '2026-03-03T20:30:21.310278Z'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Error code
              example: not_found
            message:
              type: string
              description: Human-readable error message
              example: The requested resource does not exist
            details:
              description: Additional error context
              example:
                resource: agent
                id: agt_invalid
              type:
                - object
                - 'null'
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            type: object
            properties:
              loc:
                type: array
              msg:
                type: string
              type:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Include your API key in the Authorization
        header: Bearer <your_api_key>

````