Download email attachment
Retrieve the content of a specific file attached to an email. By default, this endpoint triggers a file download, but it can also return the file content as a Base64 encoded string.
| Request | |
|---|---|
| Method | GET |
| Resource | https://[customer].asp.virtual-call-center.eu/v2/projects/[projectid]/emails/[emailid]/attachment/[contentId]/download |
| Options | output |
| Body | N/A |
Request
Resource parameters
| Name | Type | Mandatory | Comment |
|---|---|---|---|
| projectid | integer | yes | Project unique identifier. |
| emailid | integer | yes | The unique identifier of the email the file is attached to. |
| contentId | string | yes | The unique identifier/hash for the specific file (found in the link attribute of the Email Log response). |
Query parameters
| Name | Type | Mandatory | Comment |
|---|---|---|---|
| output | string | no | Defines the response format. If set to base64, the file content is returned as a Base64 string. If omitted, the raw file is returned. |
Response
Default behavior (Binary)
Returns the raw binary data of the file with the appropriate Content-Type header (e.g., application/pdf or image/png) and Content-Disposition: attachment.
Base64 behavior (?output=base64)
Returns a JSON object containing the file name and the content formatted as a Data URL.
| Name | Type | Comment |
|---|---|---|
| fileName | string | The name of the file. |
| data | string | The file content formatted as a Data URL (e.g., data:[mime/type];base64,[data]). |
Examples
Example 1: Standard File Download
Request URL
GET https://customer.asp.virtual-call-center.eu/v2/projects/130/emails/1111/attachment/130_0_5f36b2ea290645ee34d943220a14b54ee5ea5be5/download
Response
The browser or client receives the raw file.
Example 2: Retrieve as Base64 Data URL
Request URL
GET https://customer.asp.virtual-call-center.eu/v2/projects/130/emails/1111/attachment/130_0_5f36b2ea290645ee34d943220a14b54ee5ea5be5/download?output=base64
Response Body
{
"response": {
"fileName": "test.json",
"data": "data:application/json;base64,ewogICAgInRlc3QiOiAiZGF0YSIKfQ=="
},
"errors": []
}
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.