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

# Fetch SMS message history

> Returns the SMS message log for the specified business. This endpoint returns the most recent messages first.



## OpenAPI

````yaml get /v1/businesses/{businessId}/sms/messages
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/sms/messages:
    get:
      tags: []
      summary: Fetch SMS message history
      description: >-
        Returns the SMS message log for the specified business. This endpoint
        returns the most recent messages first.
      operationId: business.sms.messages.get
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business to fetch the SMS message log for
          required: true
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json
          schema:
            type: string
      responses:
        '200':
          description: ''
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiMessages'
        '400':
          description: >-
            SMS is not enabled for this business. Enable SMS to enable message
            history.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: >-
            Business is not found. This indicates the business id is invalid or
            the business has been archived.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    ApiMessages:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be 'Messages'.
          example: Messages
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ApiMessageLog'
          description: List of message logs
      example: ''
      description: ''
    ApiError:
      type: object
      properties: {}
      example: ''
      description: ''
    ApiMessageLog:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be 'Message_Log'.
          example: Message_Log
        id:
          type: string
          format: uuid
          description: The ID of the message log
        business_id:
          type: string
          format: uuid
          description: The ID of the business that sent the message
        at:
          type: string
          format: date-time
          description: The time when the message was received
        direction:
          $ref: '#/components/schemas/MessageDirection'
          description: Whether the message was sent or received
        delivery_status:
          $ref: '#/components/schemas/MessageDeliveryStatus'
          description: The message's delivery status.
        sent_by:
          $ref: '#/components/schemas/MessageSender'
          description: How the message was sent
        business_phone:
          type: string
          description: The phone number for the business
          example: '+16504651359'
        body:
          type: string
          description: The message body
          example: Hello from Layer!
        retry_of_id:
          type: string
          format: uuid
          description: The ID of the original message log this is a retry of.
        sent_at:
          type: string
          format: date-time
          description: The time when the message was sent
        presigned_attachment_urls:
          type: array
          items:
            type: string
            description: Pre-signed URL to download an attachment
            example: >
              https://example-bucket.s3.amazonaws.com/example-object?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FAKEAWSACCESSKEY%2F20240710%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240710T000000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=FAKESIGNATURE1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
          description: List of pre-signed URLs to download the message's attachments
        presigned_file_types:
          type: array
          items:
            type: string
            description: The filetype of an attachment
            example: csv
          description: List of file types for the message's attachments
      description: A single message log
    MessageDirection:
      type: string
      enum:
        - SENT
        - RECEIVED
    MessageDeliveryStatus:
      type: string
      enum:
        - ACCEPTED
        - SCHEDULED
        - QUEUED
        - SENDING
        - SENT
        - RECEIVING
        - RECEIVED
        - DELIVERED
        - UNDELIVERED
        - FAILED
        - READ
        - CANCELED
        - LAYER_TIMEOUT
        - UNKNOWN
    MessageSender:
      type: string
      enum:
        - API
        - MANUAL
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````