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

# Send message to a lead

> Sends a message to a lead



## OpenAPI

````yaml post /leads/{leadId}/sendMessage
openapi: 3.0.1
info:
  title: AttentPublicAPI
  version: '2024-05-17T21:09:13Z'
servers:
  - url: https://api.attent.app/v1
security: []
paths:
  /leads/{leadId}/sendMessage:
    post:
      description: Sends a message to a lead
      parameters:
        - name: leadId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the lead to send a message to.
      requestBody:
        description: The message to send to the lead.
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                  description: The content of the message to send to the lead.
                scheduledTime:
                  type: string
                  description: >-
                    The date and time to schedule the message for. This should
                    be in ISO 8601 format (e.g. 2024-05-17T21:09:13Z). If not
                    provided, or if the scheduled time is in the past, the
                    message will be sent immediately.
                sendWhenOff:
                  type: boolean
                  description: >-
                    Whether to send the message even if Apten is turned off for
                    the lead. Defaults to `false`.
                scheduleFollowUps:
                  type: boolean
                  description: >-
                    Whether to schedule follow-up messages for this lead.
                    Defaults to `false`.
                overrideBusinessHours:
                  type: boolean
                  description: >-
                    Whether to send the message immediately regardless of
                    business hours. If not provided or `false`, and no
                    scheduledTime is specified, the message will be scheduled
                    for the next business hours. Defaults to `false`.
              required:
                - message
      responses:
        '200':
          description: Message sent successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      Returns "Message sent successfully." if the message was
                      sent.
                example:
                  message: Message sent successfully.
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                example:
                  message: 'Missing required field: message'
        '403':
          $ref: '#/components/responses/403'
        '404':
          description: Lead not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                example:
                  message: Lead not found.
        '500':
          $ref: '#/components/responses/500'
      security:
        - api_key: []
components:
  responses:
    '403':
      description: Forbidden API key
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            example:
              message: Forbidden
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            example:
              message: Internal Server Error
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````