> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linkupapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Attachment

> Download the bytes of a message attachment.

## Overview

Returns the raw file for an attachment received in a message — on **LinkedIn**, **email** (Gmail / Outlook) and **WhatsApp** accounts. LinkedIn's own media URL requires the account session and its signature expires, so this endpoint re-resolves it on demand; for email the bytes are fetched over the mailbox API.

For LinkedIn, every attachment in a webhook payload already carries a ready-to-call `download_url` — see [Webhooks Introduction](/api-reference/v2/webhooks/introduction). For email, use the `attachments[]` from [Get Conversation](/api-reference/v2/messages/get-conversation). You still send your `x-api-key` header.

<Note>This endpoint costs **1 credit** per successful download. Nothing is stored on our side. Ignore this if you're on per-seat pricing: usage is unlimited.</Note>

## Request

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication.
</ParamField>

<ParamField query="account_id" type="string" required>
  The account the message belongs to.
</ParamField>

<ParamField query="conversation_id" type="string">
  **(LinkedIn)** The conversation URN, from `event.metadata.conversation_urn`.
</ParamField>

<ParamField query="asset_urn" type="string">
  **(LinkedIn)** The attachment identifier, from `event.attachments[].asset_urn`.
</ParamField>

<ParamField query="message_id" type="string">
  **(Email + WhatsApp)** The id of the message carrying the attachment (`attachments[].message_id`).
</ParamField>

<ParamField query="attachment_id" type="string">
  **(Email)** The attachment id (`attachments[].attachment_id`).
</ParamField>

<ParamField query="filename" type="string">
  **(Email)** Optional filename for the download.
</ParamField>

## Response

On success, the raw file with its own `Content-Type` (and `Content-Disposition` when a filename is known) — not the usual JSON envelope.

On failure, the standard V2 error envelope:

| Code | Meaning |
| - | - |
| `INSUFFICIENT_CREDITS` | Not enough credits. |
| `ACCOUNT_INACTIVE` | The account is disconnected — re-authenticate it. |
| `INVALID_PARAMS` | Attachment not found: the message was deleted, or `conversation_id` / `asset_urn` is wrong. |

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.linkupapi.com/v2/messages/attachment?account_id=ACCOUNT_ID&conversation_id=CONVERSATION_URN&asset_urn=ASSET_URN" \
    -H "x-api-key: YOUR_API_KEY" \
    --output attachment.pdf
  ```
</RequestExample>
