Upload a new file

Last updated October 5, 2020

POST /filemanager/api/v3/files/upload

Method Details

HTTP Methods:

POST

Content Type:

multipart/form-data

Response Format:

json

Requires Authentication?

Yes

Rate Limited?

Yes

Headers

User-Agent

Products:

Marketing & CRM

Required Scope:

files

Upload a new file to the file manager. This endpoint uses multi-part form encoding, rather than JSON.

On success, the response will include the metadata for the file.  See this page for an example.

Required Parameters How to use Description
OAuth Access Token or API Key Authorization: Bearer {token} header
or hapikey={key} query parameter.
Used to authenticate the request. Please see this page for more details about authentication.

Allowed Fields in the body

Parameter name Type Description
fileName string Optional field. Desired name of the file. If not provided the name will be inferred from the file data.
file File data The multi-part form encoded file to upload.
folderPath string Partially optional field. One of folderPath or folderId must be specified. Path of the folder the file should be uploaded into. Uploading files into the root path “/” is highly discouraged.
folderId string Partially optional field. One of folderId or folderPath must be specified. Id of the folder the file should be uploaded into.
charsetHunch string Optional field. The character set of the provided file.
options JSON string Required field. JSON string representation of the options object. See below.

options object

Field name Description
access
(enum)
Required field. Options are:

PUBLIC_INDEXABLE
The file will be publicly accessible by anyone who has the file url. Search engines will be able to index the file.

PUBLIC_NOT_INDEXABLE
The file will be publicly accessible by anyone who has the file url. The X-Robots-Tag: noindex header will be sent whenever the file is retreived, instructing search engines not to index the file.

PRIVATE
The file will be private and requires a signed url to access. Search engines will NOT be able to index the file.
ttl
(string)
Time to live. Optional field. If specified the file will be deleted after the specified amount of time. The formats are Periods. For example “P3M” means a period of 3 monts. The file will be deleted after 3 months. The ttl cannot be more than 1 year.
overwrite
(boolean)
If true this file with replace any existing files with the name name, folder, and type.

Note: If this is set to false, and the uploaded file matches the filename of an existing file in the same folder, the file will be uploaded with a number incremented filename (e.g. example_file.txt will become example_file-1.txt)
duplicateValidationStartegy
(enum)
Optional field. Options are:

REJECT
If a duplicate file is found, the upload request is rejected.

RETURN_EXISTING
If a duplicate file is found, the upload is cancelled and the existing file is returned instead.

NONE
No duplicate file validation is performed.

Defaults to NONE if not specified
duplicateValidationScope
(enum)
Optional field. Options are:

ENTIRE_PORTAL
Checks all files for a duplicate.

EXACT_FOLDER
Checks only the provided folder for a duplicate.

Defaults to EXACT_FOLDER if not specified

These code samples use a demo API key. Using this key for anything but GET requests will result in an error. For all other requests (such as POST or PUT), you'll need to use your own API key or OAuth. For more details, please see here