> ## 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.

> ## Agent Instructions
> Base URL: https://api.social-api.ai/v1. Send your API key in the Authorization header: Authorization: Bearer <your API key>.
> Every error response from /v1 is JSON: { "error": { "code", "message", "meta" (optional) }, "request_id" }. Branch on error.code; use error.message only for logs.
> A 429 response carries a Retry-After header, in seconds, when the limit has a known wait. Authenticated responses can carry X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset for the per-minute request budget your SocialAPI account shares across every API key (see /guides/rate-limits).
> Paginated list endpoints return next_cursor, at the top level or inside pagination (see /guides/pagination). Pass it as the cursor query parameter to get the next page. An absent or empty next_cursor means you have the last page.
> Treat every ID as an opaque string: do not parse it or assume a format.
> Support differs by platform and by operation. Check /platforms/overview before assuming an operation works on a platform. An unsupported operation returns 501 with error.code resource.not_supported.

# 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 (platform.instagram.window_closed /
            platform.facebook.window_closed: the recipient must message you
            first to reopen the 24-hour window). After the platform refuses a
            thread for a closed window, later untagged sends on it are refused
            here with the same code and blocked_locally in the meta, until an
            inbound message reopens it or 24 hours pass; no credit is charged
            for those.
          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'
        '422':
          description: >-
            The platform could not fetch or accept an attachment
            (platform.instagram.attachment_failed,
            platform.facebook.attachment_failed): check that the URL is publicly
            reachable and the file type and size are supported
          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.

            On WhatsApp every button must be type postback with a unique
            payload.
          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'
        list_button:
          description: >-
            ListButton is the label on the button that opens the list. Required
            with

            list_sections, max 20 characters.
          type: string
          example: View options
        list_sections:
          description: >-
            ListSections renders a tappable list behind a single button, for
            menus wider

            than the 3 buttons a reply-button message allows (up to 10 rows in
            total,

            across up to 10 sections). WhatsApp only; requires text and
            list_button.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.MessageListSection'
        message_tag:
          description: >-
            MessageTag sends the DM outside the standard 24-hour window.
            Instagram

            connected through Instagram Login only, which accepts only
            HUMAN_AGENT and

            extends the window to 7 days; any other value returns 400

            validation.invalid_message_tag. On Facebook, on Instagram connected

            through Facebook Login, and on every other platform, the DM is sent

            untagged and the 24-hour window applies.
          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 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'
        request_id:
          description: >-
            RequestID matches the X-Request-ID response header. Include it when
            contacting support.
          type: string
          example: 01HZ9X3Q4R5M6N7P8V2K0W1J
    api_endpoints.DMAttachmentInput:
      type: object
      properties:
        caption:
          description: >-
            Caption is text shown with this attachment instead of as a separate
            message.

            Supported on WhatsApp (not on audio) and Telegram; ignored on
            platforms whose

            Send API has no caption, where an attachment is always a bare
            bubble.
          type: string
          example: The damaged panel
        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).
              - "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
        voice:
          description: >-
            Voice sends an audio attachment as a native voice note (waveform and

            playback-speed controls) instead of a file bubble. WhatsApp only,
            and only

            for audio whose file is Ogg encoded with the OPUS codec; WhatsApp
            rejects

            any other container or codec. Ignored on other platforms.
          type: boolean
          example: true
    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.MessageListSection:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.MessageListRow'
        title:
          type: string
          example: This week
    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: {}
    api_endpoints.MessageListRow:
      type: object
      properties:
        description:
          type: string
          example: 3 posts waiting
        id:
          type: string
          example: menu:review_drafts
        title:
          type: string
          example: Review drafts
  securitySchemes:
    BearerAuth:
      description: >-
        Prefix your API key with "Bearer ". Example: `Authorization: Bearer
        sapi_key_...`
      type: apiKey
      name: Authorization
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.