Hubspot | Get signed URL to access private file.

Can some has the same issue im having,
I triedto run the code below from my serverless function. And it has url generated url but the problem is my expire value didn’t work. I set the expire time to 60 secs but I keep visiting the url more than 2 or 5 mins it still viewable. Is hubspot default 24hrs ?
Let me know please!

const axios = require('axios');

exports.main = async (context, sendResponse) => {

 const fileId = "1234567890"; 
 // const fileId = context.module.file_id;
// const expiresAt = Date.now() + 15 * 60 * 1000; 
 const expiresAt = Date.now() + 60 * 1000;
 const expirationSeconds = 60; 

 var config = {
 method: 'get',
 maxBodyLength: Infinity,
 url: `https://api.hubapi.com/filemanager/api/v3/files/${fileId}/signed-url?expiresAt=${expirationSeconds}`,
 headers: { 
 Authorization: "Bearer sample-tokenhere"
 }
 };

 axios(config)
 .then((response) => {
 const data = JSON.stringify(response.data);
 sendResponse({ body: data, statusCode: 200 });
 document.getElementById('file-link').textContent = response.data.url;
 })
 .catch(function (error) {
 console.log(error);
 sendResponse({ body: error, statusCode: 400 });
 });

 return;
};

Hi @Jun22 :waving_hand:

I think you’ll need to update the File (see Endpoints tab within “Update file properties” API operation documentation) with the property values of interest (e.g. expiresAt) before getting the signed URL. I don’t think the Get Signed URL endpoint allows you to specify File properties like expiresAt.

I hope this proves useful. Please let me know if you have any follow-up questions.