# Returns a list of messages.

URL: https://docs.dixa.io/openapi/exports-api/get-v1-message-export

## GET /v1/message_export

- Server: https://exports.dixa.io
- Auth: `Authorization: Bearer <API token>` header

### Request example

```bash
curl -X GET 'https://exports.dixa.io/v1/message_export?created_after=2022-01-01&created_before=1646151737080' \
  -H 'Authorization: Bearer <API token>'
```

### Response examples

#### 200 Array of messages

_Generated from the schema; the spec has no example._

```json
[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "csid": 0,
    "created_at": 0,
    "initial_channel": "widgetchat",
    "author_name": "string",
    "author_email": "string",
    "direction": "inbound",
    "text": "string",
    "from_phone_number": "string",
    "to_phone_number": "string",
    "duration": 0,
    "recording_url": "string",
    "voicemail_url": "string",
    "to": [
      "string"
    ],
    "from": "string",
    "cc": [
      "string"
    ],
    "bcc": [
      "string"
    ],
    "attached_files": [
      "string"
    ],
    "is_automated_message": true,
    "chat_input_question": "How can we help?",
    "chat_input_answer": "None of the above",
    "chat_menu_text": "Please input your order number.",
    "form_submission": {
      "name": "John Doe",
      "email": "johndoe@gmail.com",
      "phone": "+4512345678"
    }
  }
]
```

#### 400 Invalid query parameters

No body.

#### 401 Invalid or missing credentials

No body.

#### 429 API limit has been reached

No body.

#### 5XX Internal error

No body.

## OpenAPI definition

The operation and the schemas used, from the full spec at https://docs.dixa.io/openapi-specs/exports.yaml. Request and response examples are above.

```yaml
openapi: 3.0.0
info:
  title: Exports API
  version: 1.0.0
servers:
  - url: https://exports.dixa.io
security:
  - BearerAuth: []
paths:
  /v1/message_export:
    get:
      summary: Returns a list of messages.
      parameters:
        - name: created_after
          in: query
          description: Filter for conversations created after this date. Format should be
            yyyy-mm-dd or Unix timestamp in ms
          required: false
          schema:
            type: string
            format: date
          example: 2022-01-01
        - name: created_before
          in: query
          description: Filter for conversations created before this date. Format should be
            yyyy-mm-dd or Unix timestamp in ms
          required: false
          schema:
            type: string
            format: date
          example: "1646151737080"
      responses:
        "200":
          description: Array of messages
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/MessageInfo"
        "400":
          description: Invalid query parameters
        "401":
          description: Invalid or missing credentials
        "429":
          description: API limit has been reached
        5XX:
          description: Internal error
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
  schemas:
    MessageInfo:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Id of the message
        csid:
          type: integer
          format: int32
          description: Id of the conversation the message belongs to
        created_at:
          type: integer
          format: int64
          description: Timestamp of when the message was created
        initial_channel:
          type: string
          description: The channel through which the communication was established
          example: widgetchat
        author_name:
          type: string
          description: Name of the author of the message
        author_email:
          type: string
          description: Email of the author of the message
        direction:
          type: string
          enum:
            - inbound
            - outbound
          description: Direction of the conversation
        text:
          type: string
          description: The full message text. Not relevant for PSTN phone and voicemail
            channels
        from_phone_number:
          type: string
          description: Phone number the conversation was initiated from. Relevant only for
            PTSN phone and voicemail channels
        to_phone_number:
          type: string
          description: Phone number the conversation was aimed for. Relevant only for PTSN
            phone and voicemail channels
        duration:
          type: number
          format: int64
          description: Length of the call/voicemail. Relevant only for PTSN phone and
            voicemail channels
        recording_url:
          type: string
          description: Link to the recording of the call. Relevant only for PTSN phone
            channel
        voicemail_url:
          type: string
          description: Link to the voicemail. Relevant only for voicemail channel
        to:
          type: array
          items:
            type: string
          description: Email address(es) a conversation was aimed for. Relevant only for
            email and contact form channels
        from:
          type: string
          description: Email address a conversation was initiated from. Relevant only for
            email and contact form channels
        cc:
          type: array
          items:
            type: string
          description: Email address(es) included in the email as CC. Relevant only for
            email channel
        bcc:
          type: array
          items:
            type: string
          description: Email address(es) included in the email as BCC. Relevant only for
            email channel
        attached_files:
          type: array
          items:
            type: string
          description: Link(s) to files that have been attached to the message. Relevant
            only for email and Facebook Messenger channel
        is_automated_message:
          type: boolean
          description: Whether a message has been generated automatically or by an agent.
            Relevant only for widget chat
        chat_input_question:
          type: string
          description: Input question initiating the conversation. Relevant only for
            widget chat
          example: How can we help?
        chat_input_answer:
          type: string
          description: Input answer initiating the conversation. Relevant only for widget
            chat
          example: None of the above
        chat_menu_text:
          type: string
          description: Menu text initiating the conversation. Relevant only for widget chat
          example: Please input your order number.
        form_submission:
          type: object
          description: Form submission associated with the message. Relevant only for
            Messenger and ContactForm channels
          example:
            name: John Doe
            email: johndoe@gmail.com
            phone: "+4512345678"
```
