---
updatedAt: 2026-05-13T11:26:19.000Z
agentTools:
  projectIndex: https://open-api-docs.guesty.com/llms.txt
---

# Retrieve Message Attachments

How to identify and retrieve message attachments.

***

title: Retrieve Message Attachments
description: How to identify and retrieve message attachments.
tags: \[get-message-attachments, get-attachments, message-attachments]
url: <https://open-api-docs.guesty.com/docs/retrieve-message-attachments>
-------------------------------------------------------------------------

## Overview

Message webhook payloads don't currently include attachment URLs. This article explains how to identify and use the attachment URL in the conversation post to view or retrieve the attachment.

<br />

## How to Retrieve Message Attachments

To identify and retrieve message attachments, follow the steps below.

<br />

1. Retrieve the <a href="https://open-api-docs.guesty.com/reference/get_communication-conversations-conversationid-posts" target="_blank">conversation posts</a>.
   1. If relying on a Webhook payload, use the `postId` from the webhook to locate the message and its `attachments.attachmentURL`.

<br />

```curl
curl 'https://open-api.guesty.com/v1/communication/conversations/{conversationId}/posts' \
--header 'Authorization: Bearer {ACCESS_TOKEN}'
```
```javascript
// Replace with your actual values
const conversationId = '{conversationId}';
const accessToken = '{ACCESS_TOKEN}';

// Construct the URL
const url = `https://open-api.guesty.com/v1/communication/conversations/${conversationId}/posts`;

// Fetch options
const options = {
    method: 'GET',
    headers: {
        'Authorization': `Bearer ${accessToken}`
    }
};

// Make the request
fetch(url, options)
    .then(response => {
        // Check if the response is successful
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.json(); // or response.text() depending on the expected response type
    })
    .then(data => {
        // Handle the response data
        console.log(data);
    })
    .catch(error => {
        // Handle any errors
        console.error('There was a problem with the fetch operation:', error);
    });

// Async/Await version
async function fetchConversationPosts() {
    try {
        const response = await fetch(url, options);
        
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        console.log(data);
    } catch (error) {
        console.error('There was a problem with the fetch operation:', error);
    }
}
```
```php
<?php

// Replace with your actual values
$conversationId = '{conversationId}';
$accessToken = '{ACCESS_TOKEN}';

// Construct the URL
$url = "https://open-api.guesty.com/v1/communication/conversations/{$conversationId}/posts";

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $accessToken
    ]
]);

// Send the request and get the response
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    // Decode the JSON response
    $data = json_decode($response, true);
    
    // Process the data
    print_r($data);
}

// Close cURL session
curl_close($ch);
```
```python
import requests

# Replace with your actual values
conversation_id = '{conversationId}'
access_token = '{ACCESS_TOKEN}'

# Construct the URL
url = f'https://open-api.guesty.com/v1/communication/conversations/{conversation_id}/posts'

# Prepare the headers
headers = {
    'Authorization': f'Bearer {access_token}'
}

try:
    # Make the GET request
    response = requests.get(url, headers=headers)
    
    # Raise an exception for HTTP errors
    response.raise_for_status()
    
    # Parse the response
    data = response.json()
    
    # Process the data
    print(data)

except requests.exceptions.RequestException as e:
    # Handle any request-related errors
    print(f'Error occurred: {e}')
```

<br />

2. Generate a temporary download link using the `attachmentURL` in the following API request (template). You can also retrieve multiple attachments by adding etra `keys` to your query.

<br />

```curl
curl --globoff 'https://open-api.guesty.com/v1/communication/conversations/get-attachments?keys[]={URL}&keys[]={URL}' \
--header 'Authorization: Bearer {ACCESS_TOKEN}'
```
```javascript
// Replace these with your actual values
const accessToken = '{YOUR_ACCESS_TOKEN}';
const url1 = '{URL_1}';
const url2 = '{URL_2}';

// Construct the URL with query parameters
const url = new URL('https://open-api.guesty.com/v1/communication/conversations/get-attachments');
url.searchParams.append('keys[]', url1);
url.searchParams.append('keys[]', url2);

// Fetch options
const options = {
    method: 'GET',
    headers: {
        'Authorization': `Bearer ${accessToken}`
    }
};

// Make the request
fetch(url, options)
    .then(response => {
        // Check if the response is successful
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.json(); // or response.text() depending on the expected response type
    })
    .then(data => {
        // Handle the response data
        console.log(data);
    })
    .catch(error => {
        // Handle any errors
        console.error('There was a problem with the fetch operation:', error);
    });
```
```php
<?php

// Replace these with your actual values
$accessToken = '{YOUR_ACCESS_TOKEN}';
$url1 = '{URL_1}';
$url2 = '{URL_2}';

// Prepare the URL with query parameters
$url = "https://open-api.guesty.com/v1/communication/conversations/get-attachments?" . 
       http_build_query([
           'keys[]' => [$url1, $url2]
       ]);

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $accessToken
    ]
]);

// Send the request and get the response
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
}

// Close cURL session
curl_close($ch);

// Process the response
echo $response;
```
```python
import requests

# Replace these with your actual values
access_token = '{YOUR_ACCESS_TOKEN}'
url1 = '{URL_1}'
url2 = '{URL_2}'

# URL for the API endpoint
url = 'https://open-api.guesty.com/v1/communication/conversations/get-attachments'

# Prepare the query parameters
params = {
    'keys[]': [url1, url2]
}

# Prepare the headers
headers = {
    'Authorization': f'Bearer {access_token}'
}

try:
    # Make the GET request
    response = requests.get(url, params=params, headers=headers)
    
    # Raise an exception for HTTP errors
    response.raise_for_status()
    
    # Parse the response
    data = response.json()  # or response.text() depending on the response type
    
    # Process the data
    print(data)

except requests.exceptions.RequestException as e:
    # Handle any request-related errors
    print(f'Error occurred: {e}')
```