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

# Send a message

> Sends a message to a user.



## OpenAPI

````yaml /api-reference/openapi.json post /messages
openapi: 3.1.0
info:
  title: Sotto API
  version: 1.0.0
  description: >-
    The Sotto API provides programmatic access to manage users, send messages,
    upload files, configure webhooks, and read your segments and custom data
    fields. All requests are authenticated with an HMAC-SHA256 signature. See
    the **Authentication** guide for signing details.
  contact:
    name: Sotto Support
    email: support@bigco.ai
servers:
  - url: https://api.bigco.ai/api/v1
    description: Production
security:
  - hmacSignature: []
tags:
  - name: Users
    description: Create, retrieve, update, and delete users.
  - name: Messages
    description: Send messages to a user.
  - name: Files
    description: Upload media files for use in messages.
  - name: Brand
    description: Retrieve information about your brand.
  - name: Webhooks
    description: Subscribe to and manage event callbacks.
  - name: Segments
    description: Read the audience segments configured for your brand.
  - name: Custom Data
    description: Read the custom data fields configured for your brand.
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Send a message
      description: Sends a message to a user.
      operationId: sendMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageCreateExternalAPI'
      responses:
        '200':
          description: The message that was queued for delivery.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageExternalAPI'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    MessageCreateExternalAPI:
      type: object
      properties:
        user_id:
          type: integer
          minimum: 1
          description: The ID of the recipient user.
          example: 123
        body:
          type:
            - string
            - 'null'
          description: The text of the message.
          example: Thank you for contacting us! How can we help you today?
        media_item_uuids:
          type:
            - array
            - 'null'
          items:
            type: string
            format: uuid
          description: >-
            UUIDs of media items (uploaded via the Files API) to attach to the
            message.
          example:
            - 550e8400-e29b-41d4-a716-446655440000
        type:
          type:
            - string
            - 'null'
          description: The message type, e.g. `CONVERSATIONAL`.
          example: CONVERSATIONAL
      required:
        - user_id
    MessageExternalAPI:
      type: object
      properties:
        id:
          type: integer
          example: 12345
        user_id:
          type: integer
          minimum: 1
          example: 123
        body:
          type:
            - string
            - 'null'
          example: Thank you for contacting us! How can we help you today?
        media_item_uuids:
          type:
            - array
            - 'null'
          items:
            type: string
            format: uuid
          example:
            - 550e8400-e29b-41d4-a716-446655440000
        type:
          type:
            - string
            - 'null'
          example: CONVERSATIONAL
        direction:
          type: string
          description: '`inbound` if received from a user, `outbound` if sent to a user.'
          enum:
            - inbound
            - outbound
          example: outbound
        status:
          type: string
          description: Delivery status of the message.
          enum:
            - queued
            - sent
            - delivered
            - failed
            - undelivered
          example: delivered
        date_sent:
          type:
            - string
            - 'null'
          format: date-time
          example: '2024-05-15T10:30:00Z'
        date_delivered:
          type:
            - string
            - 'null'
          format: date-time
          example: '2024-05-15T10:30:05Z'
        date_created:
          type: string
          format: date-time
          example: '2024-05-15T10:29:50Z'
      required:
        - id
        - user_id
        - direction
        - status
        - date_created
    Error:
      type: object
      properties:
        detail:
          type: object
          properties:
            type:
              type: string
              description: Machine-readable error type.
              example: not_authenticated
            msg:
              type: string
              description: Human-readable error message.
              example: HMAC signature verification failed
          required:
            - type
            - msg
      required:
        - detail
  responses:
    BadRequest:
      description: Bad request — the request was invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized — HMAC signature verification failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail:
              type: not_authenticated
              msg: HMAC signature verification failed
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail:
              type: UNCAUGHT_ERROR
              msg: Internal server error
  securitySchemes:
    hmacSignature:
      type: apiKey
      in: header
      name: x-bigco-hmac-sha256
      description: >-
        Base64-encoded HMAC-SHA256 signature of the request. Every request must
        also include the `x-bigco-hmac-username` and `x-date` headers, and
        POST/PUT requests must include `x-digest`. See the Authentication guide
        for the full signing procedure.

````