There's a new version of the HubSpot API

As of November 30, 2022, HubSpot API keys are no longer a supported authentication method for accessing HubSpot APIs. Instead, you should use a private app access token or OAuth to authenticate API calls. Learn more about this change and how to migrate an API key integration to use a private app instead.

Upload a replacement file

Last updated May 31, 2023

POST /filemanager/api/v3/files/:file_id/replace

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

Replace a specific file in file manager, specified by the file ID.

Required Parameters How to use Description
OAuth access token or private app access token Authorization: Bearer {token} header Used to authenticate the request. Please see this page for more details about authentication.
file_id Used in the request URL Unique identifier for a particular file

Allowed Fields in the body

Parameter name Type Description
file File data The multi-part form encoded file to upload.
charSetHunch String Optional field. The character set of the provided file.
options JSON object 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.