Returns all the details of an email campaign, i.e. content & attributes, including personalized text and HTML source.
Note: When using the optional raw
parameter, the original URLs (not tracked link URLs) are displayed in html_source and text_source.
Endpoint
GET https://api.emarsys.net/api/v2/email/<email_id>
Parameters
Required parameters
Name | Type | Description | Comments |
---|---|---|---|
email_id | int | ID of the email, part of the URI |
Optional parameters
Name | Type | Description | Comments |
---|---|---|---|
raw | int | Returns the actual links of the email content with the original URL instead of the tracking URL | Also lists any additional attributes used in the html_source. |
Result Example
{ "replyCode": 0, "replyText": "OK", "data": { "id": "12345", "root_campaign_id": "12345", "language": "en", "name": "funny_email", "created": "2011-08-12 18:12:23", "deleted": "", "fromemail_host": "emarsys", "fromemail": "loki@example.com", "fromname": "Loki", "subject": "I'm alive", "email_category": "111111111", "filter": "333333333", "exclude_filter": 0, "contactlist": "0", "exclude_contactlist": 0, "additional_linktracking_parameters": "", "cc_list": 564365356, "html_source": "<html>Hello $First Name$...</html>", "text_source": "Hello $First Name$...", "template": "0", "unsubscribe": "y", "browse": "y", "status": "3", "api_status": "2", "api_error": "0", "external_event_id": null, "text_only": "n", "source": "api", "version_name": "Version A" } }
Resulting Data Structure
Name | Type | Description | Comments |
---|---|---|---|
id | int | Internal ID of the email campaign. | |
language | string | Language used in the email campaign. | |
name | string | Name of the email campaign. | |
created | datetime | Creation date of the email campaign. | |
deleted | datetime | Deletion date of the email campaign. | |
fromemail_host | string | Using Emarsys reply mail management (emarsys) or not (external). | |
fromemail | string | Address the email shows as being sent from. | |
fromname | string | Senders display name. | |
subject | string | Subject line of the email. | |
email_category | int | Category ID that the email is assigned to | Categories may be retrieved via the Querying Email Campaign Categories endpoint. |
filter | int | Segment ID of the applied segment criteria. | Available filters can be retrieved via the Listing Segments endpoint |
exclude_filter | int | Segment ID which is excluded from the recipient source. | |
contactlist | int | Contact list ID. | Contact lists may be retrieved via the Listing Available Contact Lists endpoint. |
exclude_contactlist | int | Contact list ID which is excluded from the recipient source. | |
additional_linktracking_parameters | string | Additional URL parameters that are added to the tracked links URL when redirected. | Only works if this feature is enabled for the customer. |
cc_list | int | The ID of the contact list which will receive a copy of the email when sent. Only works if BCC List is enabled. | |
html_source | string | HTML source of the email. | Additional attributes for links when optional raw parameter is used:notrack: link will not be tracked;name: link name;category: link category. |
text_source | string | Text source of the email. | |
template | int | Template ID if the email is template-based. | |
unsubscribe | enumerator | The email contains an unsubscribe link. | 0: false; 1: true. |
browse | int | The email contains a link to an online version. | 0: false; 1: true. |
status | int | Status of the email. | See: Email Status Codes. |
api_status | int | Launch status of the email. | See: Launch Status. |
api_error | int | Launch error codes. | See: Launch Error Statuses. |
external_event_id | int | External event ID for the email. | Email campaign has anExternal Eventrecipient source. |
text_only | enumerator | The email includes a text only version. | Can only be used if both an HTML and TEXT source is available; 0: false; 1: true. |
source | string | Recipient source used. | Possible values are: userlist, profile, api. |
root_campaign_id | int | ID of the root email campaign. | Only visible if the email has versions. |
version_name | string | Name of the version in the campaign. | Only visible if the email has versions. |
Errors
HTTP Code | Reply Code | Message | Description |
---|---|---|---|
500 | 1 | Database connection error | An error occurred while saving. |
400 | 10001 | Invalid email name | The name parameter contains forbidden characters. |
400 | 10001 | An email with this name already exists | A unique name for the email must be provided. |
400 | 10001 | Invalid language | The provided language code is not supported. For a list of supported languages, see the list of language codes. |
400 | 10001 | Invalid value: contactlist | The contact list ID must be numeric. |
400 | 10001 | Invalid value: filter | The filter ID must be numeric. |
400 | 10001 | Invalid email address | The fromemail must be a valid email address. |
400 | 10001 | Invalid value: fromname | The fromname parameter contains forbidden characters. |
400 | 10001 | Subject must not be empty | |
400 | 10001 | Invalid value: email_category | The email category must be numeric. |
400 | 10001 | You must select either a contact list or a filter. | A contact list ID or a filter ID must be specified. This error message is returned if either both or none are specified. |
400 | 10001 | No content | Both the html_source and the text_source are empty. |