---
title: Send Message | API Docs
---

POST

/api/partner/v2/chats/{chat\_id}/chat\_messages

Select code sample cURL (shell:curl)

```
const url = 'https://api.linqapp.com/api/partner/v2/chats/1/chat_messages';
const form = new FormData();
form.append('message[text]', 'Hello, how are you?');
form.append('message[idempotency_key]', 'msg-2024_01-23_abc123');


const options = {
  method: 'POST',
  headers: {'X-LINQ-INTEGRATION-TOKEN': '<X-LINQ-INTEGRATION-TOKEN>'}
};


options.body = form;


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```
curl --request POST \
  --url https://api.linqapp.com/api/partner/v2/chats/1/chat_messages \
  --header 'Content-Type: multipart/form-data' \
  --header 'X-LINQ-INTEGRATION-TOKEN: <X-LINQ-INTEGRATION-TOKEN>' \
  --form 'message[text]=Hello, how are you?' \
  --form 'message[idempotency_key]=msg-2024_01-23_abc123'
```

- Production server api.linqapp.com/api/partner/v2/chats/{chat\_id}/chat\_messages

Sends a new message in the specified chat.

**Idempotency:** To prevent duplicate messages (e.g., due to network retries), include a unique `message[idempotency_key]` in your request. If a message with the same key was already sent, the API will return the existing message with a 200 status instead of creating a duplicate. The idempotency key must be alphanumeric and may include hyphens and underscores.

**Attachments:** You can attach files in two ways:

1. **Direct upload** - Use `message[attachments][]` fields in your multipart/form-data request to upload files directly:

```
-F "message[attachments][]=@file1.jpg" \
-F "message[attachments][]=@file2.png"
```

2. **URLs** - Use `message[attachment_urls][]` to provide URLs of files. The API will download them from the provided URLs (must be publicly accessible, 30-second timeout per download):

```
-F "message[attachment_urls][]=https://example.com/document.pdf" \
-F "message[attachment_urls][]=https://example.com/image.jpg"
```

Both methods can be used together in the same message.

## Authorizations

- **[ApiKeyAuth](/v2/api/#apikeyauth/index.md)**

## Parameters

### Path Parameters

**chat\_id**

required

integer

The chat ID

## Request Body required

Media type multipart/form-data

object

**message\[text]**

required

The message text content

string

**message\[idempotency\_key]**

Optional unique key to prevent duplicate messages. Must be alphanumeric and may include hyphens and underscores.

string

/^\[a-zA-Z0-9\_-]+$/

**message\[attachments]\[]**

Optional file attachments to upload. Include one field per file (e.g., message\[attachments]\[]=@file1.jpg message\[attachments]\[]=@file2.png). Omit this field if not uploading files.

Array\<string>

**message\[attachment\_urls]\[]**

Optional URLs of files to attach. The API will download files from these URLs (must be publicly accessible). Uses a 30-second timeout per download. Omit this field if not attaching files via URLs.

Array\<string>

##### Examples

Select example basic\_message

Basic text message

```
{
  "message[text]": "Hello, how are you?",
  "message[idempotency_key]": "msg-2024_01-23_abc123"
}
```

Message with attachment URLs

```
{
  "message[text]": "Here are the files you requested.",
  "message[attachment_urls][]": [
    "https://example.com/document.pdf",
    "https://example.com/image.jpg"
  ]
}
```

Message with direct file uploads

For direct file uploads via multipart/form-data. Use cURL with -F flags: curl -X POST “[https://api.linqapp.com/api/partner/v2/chats/{chat\_id}/chat\_messages](https://api.linqapp.com/api/partner/v2/chats/%7Bchat_id%7D/chat_messages)”\
-H “X-LINQ-INTEGRATION-TOKEN: your\_token”\
-F “message\[text]=Check out these files”\
-F “message\[attachments]\[]=@/path/to/file1.jpg”\
-F “message\[attachments]\[]=@/path/to/file2.pdf”

```
{
  "message[text]": "Check out these files",
  "message[attachments][]": [
    "<binary file data>"
  ]
}
```

## Responses

### 201

Message sent successfully

Media type application/json

object

**data**

object

**id**

integer

**text**

string

**sent\_at**

string format: date-time

**delivered\_at**

string format: date-time

nullable

**delivery\_status**

Current delivery status of the message

string

Allowed values: pending delivered service\_unavailable paused

**edited\_at**

string format: date-time

nullable

**is\_read**

boolean

**sent\_from**

The phone number or identifier that sent this message

string

**chat\_handle\_id**

integer

**attachments**

Array\<object>

object

**id**

Unique identifier for the attachment

string format: uuid

**url**

string

**filename**

string

**mime\_type**

string

**file\_size**

integer

**reactions**

Array\<object>

object

**id**

integer

**chat\_message\_id**

integer

**reaction**

The type of reaction

string

Allowed values: love like dislike laugh emphasize question

**is\_from\_me**

boolean

**from\_phone**

string

**sent\_at**

string format: date-time

**created\_at**

string format: date-time

**updated\_at**

string format: date-time

##### Example

```
{
  "data": {
    "id": 224,
    "text": "Hello, how are you?",
    "sent_at": "2025-05-21T15:30:00.123-05:00",
    "delivered_at": "2025-05-21T15:30:05.456-05:00",
    "delivery_status": "pending",
    "edited_at": "2025-05-21T15:31:00.789-05:00",
    "is_read": false,
    "sent_from": "+15551234567",
    "chat_handle_id": 123,
    "attachments": [
      {
        "id": "abc12345-1234-5678-9abc-def012345678",
        "url": "https://storage.googleapis.com/linq-files/attachments/abc123.pdf",
        "filename": "document.pdf",
        "mime_type": "application/pdf",
        "file_size": 12345
      }
    ],
    "reactions": [
      {
        "id": 456,
        "chat_message_id": 224,
        "reaction": "love",
        "is_from_me": false,
        "from_phone": "+15551234567",
        "sent_at": "2025-05-21T15:30:00.000-05:00",
        "created_at": "2025-05-21T15:30:00.000-05:00",
        "updated_at": "2025-05-21T15:30:00.000-05:00"
      }
    ]
  }
}
```
