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

# Send Message

> Send an SMS. Provide either a raw `body` or set `generate` to true to compose the message with AI from the agent's SMS prompt and optional inline history. Sends through your connected provider.



## OpenAPI

````yaml POST /messages
openapi: 3.1.0
info:
  title: RevRing Voice AI API
  description: >-
    RevRing Voice AI platform API for managing AI voice agents, phone calls, SIP
    trunks, and analytics. Build intelligent voice applications that can handle
    inbound and outbound phone calls with AI-powered conversational agents.
  version: 1.0.0
  contact:
    name: RevRing Support
    url: https://revring.ai
servers:
  - url: https://api.revring.ai/v1
    description: Production API
security:
  - apiKeyAuth: []
tags:
  - name: Messaging Connections
    description: Connect messaging providers so agents can send text messages
  - name: Messages
    description: Send text messages and read your message log
  - name: Conversations
    description: List and clear managed conversation threads
  - name: SIP Trunks
    description: Manage SIP trunks for connecting agents to the phone network
  - name: Agents
    description: Manage AI voice agents and their configuration
  - name: Agent Folders
    description: Organize agents into folders for dashboard navigation
  - name: Calls
    description: Manage and query phone calls
  - name: Analytics
    description: Get analytics and metrics about your calls
  - name: Knowledge Bases
    description: >-
      Manage knowledge bases and sources for agent retrieval-augmented
      generation
  - name: Test Suites
    description: Manage test suites, test cases, and test runs for agent evaluation
  - name: Voices
    description: Browse the voices available to your organization for agent speech
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Send Message
      description: >-
        Send an SMS. Provide either a raw `body` or set `generate` to true to
        compose the message with AI from the agent's SMS prompt and optional
        inline history. Sends through your connected provider.
      operationId: sendMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageSend'
            examples:
              raw:
                summary: Send a specific message
                value:
                  to: '+14155551234'
                  messagingConnectionId: mc_123abc
                  body: Your booking is confirmed for 2:00 PM.
              generated:
                summary: Let AI compose the reply from the agent's SMS prompt
                value:
                  to: '+14155551234'
                  agentId: agent_456def
                  generate: true
      responses:
        '201':
          description: Message accepted and sent
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Message'
        '400':
          description: >-
            Invalid request, missing connection, or missing prompt for
            generation
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - invalid_body
                      - missing_connection
                      - no_prompt
                      - connection_misconfigured
                      - missing_sender
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/BillingInactiveError'
        '404':
          description: Agent or connection not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - agent_not_found
                      - connection_not_found
        '502':
          description: Generation or provider send failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - generation_failed
                      - send_failed
components:
  schemas:
    MessageSend:
      type: object
      required:
        - to
      description: >-
        Send a text. Provide exactly one of `body` (raw) or `generate: true`
        (AI-composed).
      properties:
        to:
          type: string
          description: Recipient phone number in E.164, e.g. +12025550123
        from:
          type: string
          description: >-
            Optional sender number in E.164. Defaults to the agent's send-from
            number, or the connection's Messaging Service.
        agentId:
          type: string
          description: >-
            Agent to attribute the message to. For generation, its SMS prompt
            and connection are used.
        messagingConnectionId:
          type: string
          description: >-
            Connection to send through. Required if no agentId is given or the
            agent has no connection.
        body:
          type: string
          minLength: 1
          maxLength: 1600
          description: Raw message text. Use this OR generate.
        generate:
          type: boolean
          description: >-
            If true, compose the message with AI from the SMS prompt and
            optional messages history.
        messages:
          type: array
          description: >-
            Optional inline conversation history for generation (stateless; you
            own the memory).
          items:
            type: object
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
              content:
                type: string
        smsPrompt:
          type: string
          description: >-
            Optional prompt override for generation. Defaults to the agent's SMS
            prompt.
    Message:
      type: object
      description: A logged text message (sent or received).
      properties:
        id:
          type: string
        agentId:
          type: string
          nullable: true
        agentName:
          type: string
          nullable: true
          description: The agent that sent or received this message
        messagingConnectionId:
          type: string
          nullable: true
        callId:
          type: string
          nullable: true
        conversationId:
          type: string
          nullable: true
        direction:
          type: string
          enum:
            - INBOUND
            - OUTBOUND
        channel:
          type: string
          enum:
            - sms
        fromNumber:
          type: string
        toNumber:
          type: string
        body:
          type: string
        status:
          type: string
          description: queued | sent | delivered | failed | received
        providerMessageId:
          type: string
          nullable: true
        generatedByLlm:
          type: boolean
        errorMessage:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
  responses:
    UnauthorizedError:
      description: Authentication required or API key invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: unauthorized
    BillingInactiveError:
      description: Subscription inactive or billing issue
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: billing_inactive
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Generate API keys from the RevRing
        dashboard.

````