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

# Schedule a message to a lead for a future time — either a manually
typed message or one generated at send time by the conversation's
last-responding AI agent.



## OpenAPI

````yaml https://megastream25-api.closebot.com/swagger/v1/swagger.json post /lead/{leadId}/scheduled-message
openapi: 3.0.4
info:
  title: CloseBot API
  version: v1
servers:
  - url: https://api.closebot.com
    description: CloseBot API Endpoint
security:
  - Key: []
tags:
  - name: Account
  - name: AccountNotification
  - name: Agency
  - name: Analytics
  - name: Billing
  - name: Bot
  - name: BotMetric
  - name: BotSourceVariable
  - name: BotTemplate
  - name: BotTesting
  - name: Dashboard
  - name: Hierarchy
  - name: Lead
  - name: Leaderboard
  - name: Library
  - name: LiveDemo
  - name: Notification
  - name: Persona
  - name: Report
  - name: SmartFAQ
  - name: Source
  - name: SourceChannel
  - name: Webhook
paths:
  /lead/{leadId}/scheduled-message:
    post:
      tags:
        - Lead
      summary: |-
        Schedule a message to a lead for a future time — either a manually
        typed message or one generated at send time by the conversation's
        last-responding AI agent.
      parameters:
        - name: leadId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduledMessageInputDto'
          text/json:
            schema:
              $ref: '#/components/schemas/CreateScheduledMessageInputDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateScheduledMessageInputDto'
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ScheduledMessageDto'
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledMessageDto'
            text/json:
              schema:
                $ref: '#/components/schemas/ScheduledMessageDto'
components:
  schemas:
    CreateScheduledMessageInputDto:
      required:
        - kind
        - sendAt
      type: object
      properties:
        kind:
          type: string
          description: |-
            "manual" sends Body verbatim; "ai" generates the message
                        at send time with the conversation's last-responding agent.
          nullable: true
        body:
          type: string
          description: Required for manual messages; ignored for AI messages.
          nullable: true
        sendAt:
          type: string
          format: date-time
        cancelOnReply:
          type: boolean
          description: |-
            Cancel this message if the contact replies before it
                        sends. Defaults to true for AI messages, false for manual.
          nullable: true
        channel:
          type: string
          nullable: true
      additionalProperties: false
    ScheduledMessageDto:
      required:
        - cancelOnReply
        - createdAt
        - createdByAccountId
        - id
        - kind
        - leadId
        - sendAt
        - status
      type: object
      properties:
        id:
          type: string
          nullable: true
        leadId:
          type: string
          nullable: true
        sourceId:
          type: string
          nullable: true
        kind:
          type: string
          nullable: true
        body:
          type: string
          nullable: true
        channel:
          type: string
          nullable: true
        botId:
          type: string
          nullable: true
        sendAt:
          type: string
          format: date-time
        cancelOnReply:
          type: boolean
        status:
          type: string
          nullable: true
        statusReason:
          type: string
          nullable: true
        createdByAccountId:
          type: string
          nullable: true
        createdByName:
          type: string
          nullable: true
        createdByIconUrl:
          type: string
          nullable: true
        sentMessageId:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
      additionalProperties: false
  securitySchemes:
    Key:
      type: apiKey
      description: CloseBot API Key Authorization
      name: X-CB-KEY
      in: header

````