> This page is for Unified.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# /messages/{id}

GET https://api.merge.dev/api/chat/v1/messages/{id}

Returns a `Message` object with the given `id`.

Reference: https://docs.merge.dev/merge-unified/chat/common-models/messages/retrieve

## Authentication

- `Authorization` header (bearer token, required) — Token-based authentication with required prefix "Bearer"

## Servers

- `https://api.merge.dev/api/chat/v1` (Production, default)
- `https://api-eu.merge.dev/api/chat/v1` (ProductionEU)
- `https://api-ap.merge.dev/api/chat/v1` (ProductionAPSE1)

## Request

### Path parameters

- `id` (string, required)

### Query parameters

- `include_remote_data` (boolean, optional) — Whether to include the original data Merge fetched from the third-party to produce these models.
- `include_shell_data` (boolean, optional) — Whether to include shell records. Shell records are empty records (they may contain some metadata but all other fields are null).

### Headers

- `X-Account-Token` (string, required) — Token identifying the end user.

## Response

### 200

- `id` (string, optional)
- `remote_id` (string, optional, nullable) — The third-party API ID of the matching object.
- `created_at` (datetime, optional) — The datetime that this object was created by Merge.
- `modified_at` (datetime, optional) — The datetime that this object was modified by Merge.
- `user_id` (string, optional, nullable) — The user that sent the message.
- `conversation_id` (string, optional, nullable) — The conversation this message belongs to.
- `body` (string, optional, nullable) — The body of the message.
- `subject_line` (string, optional, nullable) — The subject line of the message.
- `root_message_id` (string, optional, nullable) — The root message this message belongs to.
- `url` (string, optional, nullable) — The url of the message.
- `remote_created_at` (datetime, optional, nullable) — When the third party's conversation was created.
- `remote_updated_at` (datetime, optional, nullable) — When the third party's conversation was updated.
- `remote_was_deleted` (boolean, optional) — Indicates whether or not this object has been deleted in the third party platform. Full coverage deletion detection is a premium add-on. Native deletion detection is offered for free with limited coverage. [Learn more](https://docs.merge.dev/integrations/hris/supported-features/).

## Examples

**Response**

```json
{
  "id": "m1f2d8a4-9f7a-4e2b-8e2f-123456789abc",
  "remote_id": "mem-001",
  "created_at": "2021-09-15T00:00:00Z",
  "modified_at": "2021-10-16T00:00:00Z",
  "user_id": "a1234567-89ab-cdef-0123-456789abcdef",
  "conversation_id": "a1234567-89ab-cdef-0123-456789abcdef",
  "body": "Hello World",
  "subject_line": "Hello World",
  "root_message_id": "a1234567-89ab-cdef-0123-456789abcdef",
  "url": "https://example.com/messages/mem-001",
  "remote_created_at": "2021-09-15T00:00:00Z",
  "remote_updated_at": "2021-09-16T00:00:00Z",
  "remote_was_deleted": true
}
```

**SDK Code**

```python
import requests

url = "https://api.merge.dev/api/chat/v1/messages/id"

querystring = {"include_remote_data":"true"}

headers = {
    "X-Account-Token": "X-Account-Token",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.merge.dev/api/chat/v1/messages/id?include_remote_data=true';
const options = {
  method: 'GET',
  headers: {'X-Account-Token': 'X-Account-Token', Authorization: 'Bearer <token>'}
};

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

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.merge.dev/api/chat/v1/messages/id?include_remote_data=true"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Account-Token", "X-Account-Token")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.merge.dev/api/chat/v1/messages/id?include_remote_data=true")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Account-Token"] = 'X-Account-Token'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.merge.dev/api/chat/v1/messages/id?include_remote_data=true")
  .header("X-Account-Token", "X-Account-Token")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.merge.dev/api/chat/v1/messages/id?include_remote_data=true', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Account-Token' => 'X-Account-Token',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.merge.dev/api/chat/v1/messages/id?include_remote_data=true");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Account-Token", "X-Account-Token");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Token": "X-Account-Token",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.merge.dev/api/chat/v1/messages/id?include_remote_data=true")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```