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

# Send a message

> Send a message to a contact



## OpenAPI

````yaml /swagger.yml post /public/messages
openapi: 3.0.0
info:
  title: Public API Docs
  description: Clerk Public API
  version: '1.0'
  contact: {}
servers:
  - url: https://web-api.clerk.chat
    description: Production server
  - url: http://localhost:3000
    description: Production server
security: []
tags: []
paths:
  /public/messages:
    post:
      tags:
        - Messages
      summary: Send a message
      description: Send a message to a contact
      operationId: PublicMessagesController_sendMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
      responses:
        '201':
          description: The sent message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '400':
          description: Invalid request body
        '401':
          description: Unauthorized request
        '403':
          description: You do not have permission to access this resource
        '404':
          description: Resource not found
        '422':
          description: Invalid request parameters
        '429':
          description: Too many requests for this resource
        '500':
          description: Internal server error
      security:
        - api_key: []
components:
  schemas:
    SendMessageRequest:
      type: object
      required:
        - sender
        - mediaUrls
        - recipients
        - body
      properties:
        sender:
          type: string
          description: The Clerk phone number or identifier the message should be sent from
          example: '+1415456789'
        mediaUrls:
          type: array
          description: The media URLs to send with the message
          items:
            type: string
          example:
            - https://example.com/image.jpg
        recipients:
          type: array
          description: The recipients of the message
          items:
            type: string
          example:
            - '+9134567654'
        body:
          type: string
          description: The message text
          example: Hello, world!
        sentByName:
          type: string
          description: The name of the sender displayed in the UI
          example: Clerk
        templateId:
          type: number
          description: The ID of the template to use for the message
          example: 123
    MessageResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/MessageObject'
    MessageObject:
      type: object
      description: Represents a message resource
      required:
        - id
        - body
        - conversationId
        - inbound
        - members
        - sender
        - senderType
        - status
        - created
        - updated
        - seen
        - segments
        - timestamp
      properties:
        id:
          type: number
          description: The ID of the resource
          example: 1
          readOnly: true
        body:
          type: string
          description: The message text
          example: Hello, world!
        conversationId:
          type: string
          description: The associated Conversation ID
          example: '1'
          readOnly: true
        userId:
          type: string
          description: The ID of the user who created the resource
          example: '1'
          readOnly: true
          nullable: true
        campaignMessageId:
          type: number
          nullable: true
          description: The ID of the campaign message
          example: 1
        campaignId:
          type: number
          nullable: true
          description: The associated Campaign ID
          example: 1
          readOnly: true
        channelId:
          type: string
          description: The associated Channel ID
          example: 00000000-0000-0000-0000-000000000000
          readOnly: true
          nullable: true
        inboxId:
          type: string
          description: The associated Inbox ID
          example: 00000000-0000-0000-0000-000000000000
          readOnly: true
          nullable: true
        inbound:
          type: boolean
          description: Whether the message was received (true) or sent (false)
          example: true
        members:
          type: array
          description: The phone numbers or identifiers of message participants
          items:
            type: string
          example:
            - '+1415456789'
        sender:
          type: string
          description: The phone number or identifier of the message sender
          example: '+1415456789'
        senderType:
          type: string
          description: The type of sender
          enum:
            - ai_pipeline
            - assistant
            - user
            - campaign
            - campaign_message
            - workflow
          example: user
        status:
          type: string
          description: The status of the message
          enum:
            - sending
            - scheduled
            - sent
            - delivered
            - failed
            - read
          example: delivered
        error:
          type: string
          description: The error message if the message failed to send
          nullable: true
        sentByName:
          type: string
          description: The name of the sender displayed in the UI
          example: Clerk
          nullable: true
        errorCode:
          type: number
          description: The error code if the message failed to send
          example: 123
          nullable: true
        created:
          type: string
          format: date-time
          example: '2021-01-01T00:00:00.000Z'
          readOnly: true
          description: The date and time the resource was created
        updated:
          type: string
          format: date-time
          example: '2021-01-01T00:00:00.000Z'
          readOnly: true
          description: The date and time the resource was last updated
        seen:
          type: boolean
          description: Whether the message has been seen
          example: true
        externalId:
          type: string
          description: The external ID of the resource
          example: external-id
          nullable: true
        segments:
          type: number
          description: Number of SMS message segments used by the message
          example: 1
        timestamp:
          type: string
          format: date-time
          example: '2021-01-01T00:00:00.000Z'
          description: The timestamp associated with the message
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apiKey

````