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

# Create a scheduled event

> Create a scheduled event for an assistant



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/ai/assistants.yml post /ai/assistants/{assistant_id}/scheduled_events
openapi: 3.1.0
info:
  title: Telnyx AI Assistants API
  version: 2.0.0
  description: >-
    API for managing AI Assistants, including CRUD fields, versions, tags,
    integrations, MCP servers, and shared tools.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /ai/assistants/{assistant_id}/scheduled_events:
    post:
      tags:
        - Assistants
      summary: Create a scheduled event
      description: Create a scheduled event for an assistant
      operationId: create_scheduled_event
      parameters:
        - name: assistant_id
          in: path
          required: true
          schema:
            type: string
            title: Assistant Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduledEventRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledEventResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const scheduledEventResponse = await
            client.ai.assistants.scheduledEvents.create('assistant_id', {
              scheduled_at_fixed_datetime: '2025-04-15T13:07:28.764Z',
              telnyx_agent_target: 'telnyx_agent_target',
              telnyx_conversation_channel: 'phone_call',
              telnyx_end_user_target: 'telnyx_end_user_target',
            });


            console.log(scheduledEventResponse);
        - lang: Python
          source: >-
            import os

            from datetime import datetime

            from telnyx import Telnyx


            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )

            scheduled_event_response =
            client.ai.assistants.scheduled_events.create(
                assistant_id="assistant_id",
                scheduled_at_fixed_datetime=datetime.fromisoformat("2025-04-15T13:07:28.764"),
                telnyx_agent_target="telnyx_agent_target",
                telnyx_conversation_channel="phone_call",
                telnyx_end_user_target="telnyx_end_user_target",
            )

            print(scheduled_event_response)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tscheduledEventResponse, err := client.AI.Assistants.ScheduledEvents.New(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\ttelnyx.AIAssistantScheduledEventNewParams{\n\t\t\tScheduledAtFixedDatetime:  time.Now(),\n\t\t\tTelnyxAgentTarget:         \"telnyx_agent_target\",\n\t\t\tTelnyxConversationChannel: telnyx.ConversationChannelTypePhoneCall,\n\t\t\tTelnyxEndUserTarget:       \"telnyx_end_user_target\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", scheduledEventResponse)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.ai.assistants.scheduledevents.ConversationChannelType;

            import
            com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventCreateParams;

            import
            com.telnyx.sdk.models.ai.assistants.scheduledevents.ScheduledEventResponse;

            import java.time.OffsetDateTime;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    ScheduledEventCreateParams params = ScheduledEventCreateParams.builder()
                        .assistantId("assistant_id")
                        .scheduledAtFixedDatetime(OffsetDateTime.parse("2025-04-15T13:07:28.764Z"))
                        .telnyxAgentTarget("telnyx_agent_target")
                        .telnyxConversationChannel(ConversationChannelType.PHONE_CALL)
                        .telnyxEndUserTarget("telnyx_end_user_target")
                        .build();
                    ScheduledEventResponse scheduledEventResponse = client.ai().assistants().scheduledEvents().create(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            scheduled_event_response =
            telnyx.ai.assistants.scheduled_events.create(
              "assistant_id",
              scheduled_at_fixed_datetime: "2025-04-15T13:07:28.764Z",
              telnyx_agent_target: "telnyx_agent_target",
              telnyx_conversation_channel: :phone_call,
              telnyx_end_user_target: "telnyx_end_user_target"
            )


            puts(scheduled_event_response)
        - lang: CLI
          source: |-
            telnyx ai:assistants:scheduled-events create \
              --api-key 'My API Key' \
              --assistant-id assistant_id \
              --scheduled-at-fixed-datetime "'2025-04-15T13:07:28.764Z'" \
              --telnyx-agent-target telnyx_agent_target \
              --telnyx-conversation-channel phone_call \
              --telnyx-end-user-target telnyx_end_user_target
components:
  schemas:
    CreateScheduledEventRequest:
      properties:
        telnyx_conversation_channel:
          $ref: '#/components/schemas/ConversationChannelType'
        telnyx_end_user_target:
          type: string
          description: The phone number, SIP URI, to schedule the call or text to.
          title: Telnyx End User Target
        telnyx_agent_target:
          type: string
          description: The phone number, SIP URI, to schedule the call or text from.
          title: Telnyx Agent Target
        scheduled_at_fixed_datetime:
          type: string
          format: date-time
          description: >-
            The datetime at which the event should be scheduled. Formatted as
            ISO 8601.
          example: '2025-04-15T13:07:28.764Z'
          title: Scheduled At Fixed Datetime
        text:
          type: string
          description: >-
            Required for sms scheduled events. The text to be sent to the end
            user.
        conversation_metadata:
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: boolean
          type: object
          description: >-
            Metadata associated with the conversation. Telnyx provides several
            pieces of metadata, but customers can also add their own.
          title: Conversation Metadata
        dynamic_variables:
          additionalProperties:
            type: string
          type: object
          description: >-
            A map of dynamic variable names to values. These variables can be
            referenced in the assistant's instructions and messages using
            {{variable_name}} syntax.
          title: Dynamic Variables
        max_retries_client_errors:
          type: integer
          maximum: 10
          minimum: 0
          title: Max Retries Client Errors
          description: >-
            Configure number of retries on client errors: busy, no-answer,
            failed, canceled (caller hung up before the callee answered)
          default: 0
        retry_interval_secs:
          title: Retry Interval Secs
          type: integer
          maximum: 86400
          minimum: 60
      type: object
      required:
        - telnyx_conversation_channel
        - telnyx_end_user_target
        - telnyx_agent_target
        - scheduled_at_fixed_datetime
      title: CreateScheduledEventRequest
    ScheduledEventResponse:
      anyOf:
        - $ref: '#/components/schemas/ScheduledPhoneCallEventResponse'
        - $ref: '#/components/schemas/ScheduledSmsEventResponse'
      title: ScheduledEventResponse
      description: Union type for different scheduled event response types
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ConversationChannelType:
      type: string
      enum:
        - phone_call
        - sms_chat
      title: ConversationChannelType
    ScheduledPhoneCallEventResponse:
      properties:
        telnyx_conversation_channel:
          $ref: '#/components/schemas/ConversationChannelType'
        telnyx_end_user_target:
          type: string
          title: Telnyx End User Target
        telnyx_agent_target:
          type: string
          title: Telnyx Agent Target
        scheduled_at_fixed_datetime:
          type: string
          format: date-time
          title: Scheduled At Fixed Datetime
        assistant_id:
          type: string
          title: Assistant Id
        retry_count:
          type: integer
          title: Retry Count
          default: 0
        retry_attempts:
          type: integer
          title: Retry Attempts
        scheduled_event_id:
          type: string
          title: Scheduled Event Id
        conversation_id:
          title: Conversation Id
          type: string
        created_at:
          type: string
          format: date-time
          title: Created At
        status:
          allOf:
            - $ref: '#/components/schemas/EventStatus'
          default: pending
        conversation_metadata:
          title: Conversation Metadata
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: boolean
          type: object
        dynamic_variables:
          additionalProperties:
            type: string
          type: object
          description: >-
            A map of dynamic variable names to values. These variables can be
            referenced in the assistant's instructions and messages using
            {{variable_name}} syntax.
          title: Dynamic Variables
        errors:
          items:
            type: string
          type: array
          title: Errors
        call_status:
          type: string
          title: Call Status
          description: >-
            Values: busy, canceled, no-answer, ringing, completed, failed,
            in-progress
        call_duration:
          title: Call Duration
          type: integer
          description: Duration of the call in seconds
        max_retries_client_errors:
          type: integer
          title: Max Retries Client Errors
          description: >-
            Configure number of retries on client errors: busy, no-answer,
            failed, canceled (caller hung up before the callee answered)
          default: 0
        retry_interval_secs:
          title: Retry Interval Secs
          type: integer
        call_attempts:
          title: Call Attempts
          items:
            $ref: '#/components/schemas/AssistantScheduledCallAttempt'
          type: array
        dispatched_at:
          title: Dispatched At
          type: string
          format: date-time
          description: Date time at which call was sent
      type: object
      required:
        - telnyx_conversation_channel
        - telnyx_end_user_target
        - telnyx_agent_target
        - scheduled_at_fixed_datetime
        - assistant_id
      title: ScheduledPhoneCallEventResponse
    ScheduledSmsEventResponse:
      properties:
        telnyx_conversation_channel:
          $ref: '#/components/schemas/ConversationChannelType'
        telnyx_end_user_target:
          type: string
          title: Telnyx End User Target
        telnyx_agent_target:
          type: string
          title: Telnyx Agent Target
        scheduled_at_fixed_datetime:
          type: string
          format: date-time
          title: Scheduled At Fixed Datetime
        assistant_id:
          type: string
          title: Assistant Id
        retry_count:
          type: integer
          title: Retry Count
          default: 0
        text:
          type: string
          title: Text
        scheduled_event_id:
          type: string
          title: Scheduled Event Id
        conversation_id:
          title: Conversation Id
          type: string
        created_at:
          type: string
          format: date-time
          title: Created At
        status:
          allOf:
            - $ref: '#/components/schemas/EventStatus'
          default: pending
        conversation_metadata:
          title: Conversation Metadata
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: boolean
          type: object
        dynamic_variables:
          additionalProperties:
            type: string
          type: object
          description: >-
            A map of dynamic variable names to values. These variables can be
            referenced in the assistant's instructions and messages using
            {{variable_name}} syntax.
          title: Dynamic Variables
        errors:
          items:
            type: string
          type: array
          title: Errors
      type: object
      required:
        - telnyx_conversation_channel
        - telnyx_end_user_target
        - telnyx_agent_target
        - scheduled_at_fixed_datetime
        - assistant_id
        - text
      title: ScheduledSmsEventResponse
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
    EventStatus:
      type: string
      enum:
        - pending
        - in_progress
        - completed
        - failed
      title: EventStatus
    AssistantScheduledCallAttempt:
      properties:
        attempt_number:
          type: integer
          title: Attempt Number
        attempted_at:
          type: string
          format: date-time
          title: Attempted At
        call_status:
          type: string
          title: Call Status
          description: >-
            Values: busy, canceled, no-answer, ringing, completed, failed,
            in-progress
        call_duration:
          title: Call Duration
          type: integer
          description: Duration of the call in seconds
        telnyx_call_control_id:
          title: Telnyx Call Control Id
          type: string
      type: object
      required:
        - attempt_number
        - attempted_at
        - call_status
      title: AssistantScheduledCallAttempt
      description: >-
        One row in `call_attempts` — captures the terminal outcome of a single
        dispatch.
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````