deliveries.download
Fetch webhook attachment or raw message.
Redeems a signed webhook token URL to download a large attachment or original raw MIME message. No bearer credential: the token in the path IS the credential (a signed, expiring capability minted into webhook payloads as url / rawUrl).
openemail.deliveries.download(
token: string,
options?: DeliveriesDownloadOptions,
): ApiPromise<Blob>It calls GET /deliveries/fetch/{token}: Fetch webhook attachment or raw message in the API reference. The operation is public: the client sends it without its credential.
Example
const blob = await openemail.deliveries.download(token)Arguments
| Argument | Type | Description |
|---|---|---|
token | string | Signed capability token from webhook payload. The path's {token}. |
Options
The last argument, options, a DeliveriesDownloadOptions, takes:
| Option | Type | Sent as | Description |
|---|---|---|---|
ifNoneMatch | string | header if-none-match | Revalidation ETag from a previous response; on match the answer is 304 |
Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).
Answer
Awaited, it is a Blob: the bytes the API answers, with their media type. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.
Errors
| Status | What it means |
|---|---|
403 | invalid_token — token is expired, invalid, or forged |
404 | not_found — staged message expired or part section not found |
413 | message_too_large: the staged message is over the part-walk ceiling, so a section cannot be extracted (the raw-message form of the token still works) |
422 | unparseable_message — message structure cannot be parsed |
503 | part_walk_busy: too many large messages are being read on this server at once; retry after Retry-After. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description) |
A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.