0

Get forward attachment

by
Published Oct 17, 2025

Retrieves a forward attachment. ### Pre-signed URL When you request the resource, the response will include a **related** URL in the **links** section. You can use this URL to download the attachment file. This URL is a Pre-Signed URL from S3 and provides access for a limited duration to download a file.

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Get forward attachment
7
 * Retrieves a forward attachment.
8

9
### Pre-signed URL
10

11
When you request the resource, the response will include a **related** URL in the **links** section. You can use this URL to download the attachment file.  This URL is a Pre-Signed URL from S3 and provides access for a limited duration to download a file.
12
 */
13
export async function main(auth: Kustomer, id: string, attachmentId: string) {
14
  const url = new URL(
15
    `https://api.kustomerapp.com/v1/forwards/${id}/attachments/${attachmentId}`,
16
  );
17

18
  const response = await fetch(url, {
19
    method: "GET",
20
    headers: {
21
      Authorization: "Bearer " + auth.apiKey,
22
    },
23
    body: undefined,
24
  });
25
  if (!response.ok) {
26
    const text = await response.text();
27
    throw new Error(`${response.status} ${text}`);
28
  }
29
  return await response.json();
30
}
31