Attach document to campaign

The AttachDocumentToCampaign method attaches a single document or other file to an email campaign.

The file must be already uploaded to the document manager using UploadDocument and it must not exceed the limit of 200kB per attachment.

NB: Attaching documents to campaign is not enabled for all accounts. In most circumstances it is advisable to link to a document rather than attach it to a campaign. Please speak to your account manager for further advice if you would like this functionality enabled.

Attaching documents to campaigns is not supported in the web interface, only via the API.


Guidance Notes

The document ID is obtained either through ListDocuments or using the response from UploadDocument.

The parent folder ID is obtained either through GetDocumentFolders or using the response from CreateDocumentFolder.

Only one instance of any document may be attached to a given campaign.


Parameters

username string This is the username from your API key. It is in the format of an email address and will look similar to apiuser-908709770324@apiconnector.com required
password string This is the password from your API key. required
campaignId int This is the ID of the campaign that you wish to attach the document to. required
documentId int This is the ID of the document that you wish to attach to the campaign. required

Return values

None.

Error responses

  • ERROR_APIUSAGE_EXCEEDED
  • ERROR_CAMPAIGN_NOT_FOUND
  • ERROR_CAMPAIGN_READONLY
  • ERROR_DOCUMENT_NOTFOUND
  • ERROR_DOCUMENT_TOOMANYATTACHMENTS
  • ERROR_DOCUMENT_ATTACHMENTSTOOLARGE
  • ERROR_FEATURENOTACTIVE
  • ERROR_INVALID_LOGIN
  • ERROR_SYSTEM_SERVICETEMPORARILYUNAVAILABLE
  • ERROR_UNKNOWN

Request

Sample request

Sample response

Get started with dotMailer:

Small & Medium businesses Large businesses
Call the team on 0845 337 9170
What our clients say:

“dotMailer has changed our complete marketing process for the better. It's one of the easiest apps I have used and allows us to do things we have only dreamed of before."

Amberley Shermon, Cazenove+Loyd