Appearance
Retrieve an inbound attachment
One attachment of a received message, with a fresh signed link to download it.
http
GET /v1/inbound-emails/{inbound_email_id}/attachments/{attachment_id}Requires a Full access API key.
Path parameters
| Parameter | Type | Description |
|---|---|---|
inbound_email_id | string | The inbound email's id. |
attachment_id | string | The attachment's id, from the inbound email or List inbound attachments. |
Example
js
const res = await fetch(
`https://api.sendgrail.com/v1/inbound-emails/${inboundEmailId}/attachments/${attachmentId}`,
{ headers: { Authorization: `Bearer ${process.env.SENDGRAIL_API_KEY}` } },
);
const attachment = await res.json();
// download_url needs no API key — but the file came from a stranger, so
// scan it before you open it.
const file = await fetch(attachment.download_url);Response
The same attachment object as in List inbound attachments. The link expires after 15 minutes; a withheld attachment has download_url: null.