---
title: "Create a new message"
url: https://docs.gleap.ai/en/reference/rest-api/create-message
method: POST
path: "/messages"
api: "API Reference"
tag: "Messages"
operationId: "CreateMessage"
updatedAt: "2026-11-01T18:40:15.677Z"
language: en
---

# Create a new message

`POST https://api.gleap.io/v3/messages`

Create a new message in a ticket. Required field: `ticket` (ticket ID). Optional fields: `comment` (rich text as TipTap doc JSON, or a plain string) or `markdownComment` (Markdown, converted server-side; takes precedence over `comment`), `type` (defaults to `TEXT`, or `NOTE` when `isNote` is true), `isNote` (creates an internal note), `attachments` (array of `{ name, url, type }`), `channel`, `replyTo` (message ID to quote), `data`, and `actions`. Other schema properties are accepted for backwards compatibility but are ignored on create; messages are always attributed to the authenticated user.

## Authorization

- `Authorization` (header, required): `Bearer <token>`

## Headers

- `project` (string, required)

## Request body (`application/json`, required)

- `user` (string)
- `session` (string)
- `bot` (boolean)
- `fallbackUser` (object)
  - `username` (string)
  - `email` (string)
  - `imageUrl` (string)
- `messageRef` (string)
- `ticket` (string)
- `data` (any)
- `translatedData` (any)
- `type` (string)
- `audience` (enum<string>): One of: `requester`, `public`.
- `emailId` (string)
- `sessionNotificationsUnread` (boolean)
- `outbound` (string)
- `outboundTemplate` (string)
- `outboundSubject` (string)
- `status` (any)
- `statusHistory` (any[])
- `comment` (any)
- `markdownComment` (string): Markdown message body, honored when creating a message: the server converts it to TipTap JSON and it takes precedence over `comment`. Ignored when updating a message.
- `replyTo` (string)
- `kaiChat` (boolean)
- `aiData` (any)
- `attachments` (object[])
  - `name` (string, required)
  - `url` (string, required)
  - `type` (string)
- `actions` (object[])
  - `data` (any)
  - `type` (string, required)
- `channel` (object)
  - `id` (string, required)
  - `type` (string)
  - `messageId` (string)
- `sendToChannel` (boolean)
- `isNote` (boolean)
- `rating` (string)

## Example request

```bash
curl --request POST \
  --url https://api.gleap.io/v3/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'project: <project>' \
  --header 'Content-Type: application/json' \
  --data '{
  "audience": "requester"
}'
```

## Responses

### 200 (`application/json`)

Ok

```json
{
  "id": "507f1f77bcf86cd799439015",
  "ticket": "507f1f77bcf86cd799439011",
  "type": "TEXT",
  "data": {
    "content": {
      "type": "doc",
      "content": [
        {
          "type": "paragraph",
          "content": [
            {
              "type": "text",
              "text": "Thank you for reporting this issue. We are looking into it."
            }
          ]
        }
      ]
    }
  },
  "comment": "Thank you for reporting this issue. We are looking into it.",
  "attachments": [
    {
      "name": "screenshot.png",
      "url": "https://example.com/screenshots/screenshot.png",
      "type": "image/png"
    }
  ],
  "user": {
    "id": "507f1f77bcf86cd799439012",
    "email": "support@example.com",
    "firstName": "John",
    "lastName": "Doe"
  },
  "createdAt": "2024-01-20T11:00:00.000Z",
  "updatedAt": "2024-01-20T11:00:00.000Z"
}
```
