Upload document

The UploadDocument method uploads a new document (or other file) for use in campaigns to a specified folder.

New documents folders can be created using CreateDocumentFolder. Note that multiple documents with the same name can be created, and that on creation document names will be stripped of non-standard characters.


Guidance notes

Supported file types are: .doc, .docx, .dot, .eps, .ical, .ics, .indd, .jpg, .mp3, .pdf, .pps, .ppsx, .ppt, .pptx, .pub, .rtf, .vcf, .vcs, .xls, .xlsx and .xps


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
parentFolderId integer This is the identifier of the parent folder in which this new document should be created. The root folder has the ID of 0 (zero). required
fileName string The filename for your new document. required
bytes data This is the original document file, encoded in Base64 format. required

Return values

This will return the details for the new document including the filename; a reference should be made of this filename if you wish to link to it in a campaign, or the ID if you wish to attach it to a campaign.
id integer The identifier for document.
name string The name of the document.
fileName string The filename for the document.
fileSize int The filesize of the document.
dateCreated dateTime The date and time the document was added to the system.
dateModified dateTime The date and time the document was last modified in the system.

Error responses

  • ERROR_DOCUMENT_PARENTFOLDERDOESNOTEXIST
  • ERROR_DOCUMENT_PARENTFOLDERDELETED
  • ERROR_DOCUMENT_NAMEINVALID
  • ERROR_DOCUMENT_UNSUPORTEDFORMAT
  • ERROR_DOCUMENT_DATAEMPTY
  • ERROR_DOCUMENT_TOOLARGE
  • ERROR_APIUSAGE_EXCEEDED
  • 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