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

# Send a message in a conversation

> Sends an outgoing DM via the connected platform account and records it in the conversation.



## OpenAPI

````yaml /api-reference/openapi.json post /inbox/conversations/{id}/messages
openapi: 3.0.0
info:
  description: >-
    Unified social media inbox API. Read and respond to comments, DMs, reviews,
    and mentions across Instagram, Facebook, Threads, Google Business Profile,
    TikTok, LinkedIn, and YouTube through a single REST API. X/Twitter and
    Trustpilot coming soon.
  title: SocialAPI.AI
  contact:
    name: SocialAPI.AI Support
    email: support@social-api.ai
  license:
    name: MIT
  version: '1.0'
servers:
  - url: https://api.social-api.ai/v1
security: []
paths:
  /inbox/conversations/{id}/messages:
    post:
      tags:
        - Inbox
      summary: Send a message in a conversation
      description: >-
        Sends an outgoing DM via the connected platform account and records it
        in the conversation.
      parameters:
        - description: Conversation ID
          name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_endpoints.SendMessageRequest'
        description: Message payload
        required: true
      responses:
        '200':
          description: Message sent with ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.SendMessageResponse'
        '400':
          description: >-
            Invalid request body, missing required fields, or messaging window
            closed (Instagram code platform.instagram.window_closed: the
            recipient must message you first to reopen the 24-hour window)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '403':
          description: >-
            Platform rejected the request (e.g.
            platform.instagram.permission_denied), or account requires
            reconnection (account.reconnection_required)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '404':
          description: Conversation or account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '429':
          description: Platform rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '501':
          description: Platform does not support sending DMs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    api_endpoints.SendMessageRequest:
      type: object
      required:
        - account_id
      properties:
        account_id:
          type: string
          example: acc_abc123
        attachment_url:
          description: >-
            AttachmentURL is a single-attachment shorthand. Ignored when
            attachments is

            non-empty; its type is inferred from the URL extension.


            Deprecated: use Attachments instead, which supersedes it and
            supports one or

            many items.
          type: string
          example: https://cdn.example.com/photo.jpg
        attachments:
          description: >-
            Attachments sends one or more media items, each as its own message
            bubble.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.DMAttachmentInput'
        buttons:
          description: >-
            Buttons renders a button template (1-3 buttons); uses text as the
            bubble body.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.MessageButton'
        cards:
          description: Cards renders a generic/carousel template (up to 10 cards).
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.MessageCard'
        message_tag:
          description: >-
            MessageTag attaches a Meta message tag so the DM can be sent outside
            the

            standard 24-hour window. Instagram/Facebook only. Instagram accepts
            only

            HUMAN_AGENT; Facebook also accepts ACCOUNT_UPDATE,
            CONFIRMED_EVENT_UPDATE,

            CUSTOMER_FEEDBACK, POST_PURCHASE_UPDATE. Requires Meta "Human Agent"

            advanced access for HUMAN_AGENT. Ignored by non-Meta platforms. For
            beta

            testers replying on Facebook Messenger, HUMAN_AGENT is applied

            automatically when this field is omitted.
          type: string
          example: HUMAN_AGENT
        quick_replies:
          description: >-
            QuickReplies renders up to 13 tappable chips above the keyboard;
            requires text.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.MessageQuickReply'
        reply_to_message_id:
          description: >-
            ReplyToMessageID makes the first sent bubble a reply to a specific
            prior

            message (Meta message.reply_to.mid). Instagram/Facebook only.
          type: string
          example: m_1234567890
        text:
          type: string
          example: Thanks for your message!
    api_endpoints.SendMessageResponse:
      type: object
      properties:
        message_id:
          description: >-
            MessageID is the first sent message's ID; for a multi-attachment
            send it is

            only the first of several IDs.


            Deprecated: use MessageIDs instead.
          type: string
          example: m_1234567890
        message_ids:
          description: MessageIDs holds every sent message's ID, in send order.
          type: array
          items:
            type: string
          example:
            - m_1234567890
        success:
          type: boolean
          example: true
    api_endpoints.ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/api_endpoints.ErrorBody'
    api_endpoints.DMAttachmentInput:
      type: object
      properties:
        source:
          description: >-
            Source is the attachment reference; its meaning is given by
            source_type.
          type: string
          example: 550e8400-e29b-41d4-a716-446655440000
        source_type:
          description: |-
            SourceType selects how Source is interpreted:
              - "url": Source is a publicly reachable media URL the platform fetches directly.
              - "media_id": Source is a file id in your SocialAPI media library
                (GET /v1/media); the server resolves it to a temporary URL before sending.
              - "platform_attachment_id": Source is an id of media already uploaded to the
                target platform (for example a Meta attachment_id) to reuse without re-upload.
          type: string
          enum:
            - url
            - media_id
            - platform_attachment_id
          example: media_id
        type:
          description: >-
            Type is the media kind. Optional for url and media_id sources
            (inferred from

            the file), required for platform_attachment_id (the platform exposes
            no URL

            to infer from).
          type: string
          enum:
            - image
            - video
            - audio
            - file
          example: image
    api_endpoints.MessageButton:
      type: object
      properties:
        payload:
          type: string
          example: VIEW_ORDER
        title:
          type: string
          example: View order
        type:
          type: string
          enum:
            - url
            - postback
          example: url
        url:
          type: string
          example: https://shop.example.com/orders/1
    api_endpoints.MessageCard:
      type: object
      properties:
        buttons:
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.MessageButton'
        image_url:
          type: string
          example: https://cdn.example.com/p.jpg
        subtitle:
          type: string
          example: Short description
        title:
          type: string
          example: Product name
    api_endpoints.MessageQuickReply:
      type: object
      properties:
        payload:
          type: string
          example: TRACK_ORDER
        title:
          type: string
          example: Track my order
    api_endpoints.ErrorBody:
      type: object
      properties:
        code:
          type: string
          example: resource.not_found
        message:
          type: string
          example: Account not found
        meta:
          type: object
          additionalProperties: {}
  securitySchemes:
    BearerAuth:
      description: >-
        Prefix your API key with "Bearer ". Example: `Authorization: Bearer
        sapi_key_...`
      type: apiKey
      name: Authorization
      in: header

````