<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to upload a file using Hubspot File Uploading API with Nodejs, Axios AWS Lambda, in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-upload-a-file-using-Hubspot-File-Uploading-API-with/m-p/459002#M45040</link>
    <description>&lt;P&gt;i,m using a lambda function to send clients side uploaded files to the hubspot api. On the client side I encode the file to base64 and then invoke the lambda function with the data. I,m trying to upload the base64 Encoded file, but I can't find the proper way to pass the file or what the api expects. I was only able to find this line:&lt;/P&gt;&lt;P&gt;"“file”: {binary data}"&lt;/P&gt;&lt;P&gt;The error I receive is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error: Request failed with status code 400&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the only thing that goes wrong is passing the file, but i dont know what format the api expects because the documentation are not that clear. Also the error response isn't very helpfull either.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Are all the values of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;var options&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;correctly filled in?&lt;/LI&gt;&lt;LI&gt;How to correctly pass the file&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; file: Buffer.from(event.data.drawing, 'base64'),?&lt;/LI&gt;&lt;LI&gt;Is there any way to get more helpfull axios error responses or debugging advice?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;DOCS&lt;/STRONG&gt;:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.hubspot.com/docs/api/files/files" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developers.hubspot.com/docs/api/files/files&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-meta"&gt;'use strict'&lt;/SPAN&gt;;
&lt;SPAN class="hljs-keyword"&gt;const&lt;/SPAN&gt; axios = &lt;SPAN class="hljs-built_in"&gt;require&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"axios"&lt;/SPAN&gt;);

&lt;SPAN class="hljs-built_in"&gt;exports&lt;/SPAN&gt;.&lt;SPAN class="hljs-property"&gt;handler&lt;/SPAN&gt; = &lt;SPAN class="hljs-keyword"&gt;async&lt;/SPAN&gt; (event, context) =&amp;gt; {
    &lt;SPAN class="hljs-keyword"&gt;const&lt;/SPAN&gt; apiKey = &lt;SPAN class="hljs-string"&gt;"myApiKey"&lt;/SPAN&gt;;

   &lt;SPAN class="hljs-comment"&gt;//event.data.drawing the BASE64 encoded string&lt;/SPAN&gt;

    &lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; options = {
        &lt;SPAN class="hljs-attr"&gt;method&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'POST'&lt;/SPAN&gt;,
        &lt;SPAN class="hljs-attr"&gt;baseURL&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'https://api.hubapi.com'&lt;/SPAN&gt;,
        &lt;SPAN class="hljs-attr"&gt;url&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'/files/v3/files'&lt;/SPAN&gt;,
        &lt;SPAN class="hljs-attr"&gt;params&lt;/SPAN&gt;: { &lt;SPAN class="hljs-attr"&gt;hapikey&lt;/SPAN&gt;: apiKey },
        &lt;SPAN class="hljs-attr"&gt;headers&lt;/SPAN&gt;: { &lt;SPAN class="hljs-attr"&gt;accept&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'application/json'&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;'content-type'&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'multipart/form-data'&lt;/SPAN&gt; }, 
        &lt;SPAN class="hljs-attr"&gt;data&lt;/SPAN&gt;: {
            &lt;SPAN class="hljs-attr"&gt;options&lt;/SPAN&gt;: {
                &lt;SPAN class="hljs-attr"&gt;access&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;"PRIVATE"&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;ttl&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'P2W'&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;overwrite&lt;/SPAN&gt;: &lt;SPAN class="hljs-literal"&gt;false&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;duplicateValidationStrategy&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'NONE'&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;duplicateValidationScope&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'NONE'&lt;/SPAN&gt;,
            },
            &lt;SPAN class="hljs-attr"&gt;folderPath&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'offerte_aanvragen'&lt;/SPAN&gt;,
            &lt;SPAN class="hljs-attr"&gt;file&lt;/SPAN&gt;: &lt;SPAN class="hljs-title class_"&gt;Buffer&lt;/SPAN&gt;.&lt;SPAN class="hljs-title function_"&gt;from&lt;/SPAN&gt;(event.&lt;SPAN class="hljs-property"&gt;data&lt;/SPAN&gt;.&lt;SPAN class="hljs-property"&gt;drawing&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;'base64'&lt;/SPAN&gt;),
        },
        &lt;SPAN class="hljs-attr"&gt;responseType&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'json'&lt;/SPAN&gt;,
    };


    &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;Promise&lt;/SPAN&gt;(&lt;SPAN class="hljs-function"&gt;(&lt;SPAN class="hljs-params"&gt;resolve, reject&lt;/SPAN&gt;) =&amp;gt;&lt;/SPAN&gt; {
        &lt;SPAN class="hljs-title function_"&gt;axios&lt;/SPAN&gt;(options).&lt;SPAN class="hljs-title function_"&gt;then&lt;/SPAN&gt;(&lt;SPAN class="hljs-function"&gt;(&lt;SPAN class="hljs-params"&gt;response&lt;/SPAN&gt;) =&amp;gt;&lt;/SPAN&gt; {
            &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (response.&lt;SPAN class="hljs-property"&gt;statusText&lt;/SPAN&gt; !== &lt;SPAN class="hljs-string"&gt;'OK'&lt;/SPAN&gt;) {
                &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; &lt;SPAN class="hljs-title function_"&gt;reject&lt;/SPAN&gt;(response);
            } &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; {
                &lt;SPAN class="hljs-title function_"&gt;resolve&lt;/SPAN&gt;(response)
            }

        }).&lt;SPAN class="hljs-title function_"&gt;catch&lt;/SPAN&gt;(&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-params"&gt;error&lt;/SPAN&gt; =&amp;gt;&lt;/SPAN&gt; {
            &lt;SPAN class="hljs-title function_"&gt;reject&lt;/SPAN&gt;(error);
            &lt;SPAN class="hljs-variable language_"&gt;console&lt;/SPAN&gt;.&lt;SPAN class="hljs-title function_"&gt;log&lt;/SPAN&gt;(error)
        });
    })
}&lt;/PRE&gt;&lt;P&gt;Source:&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/68378935/how-to-upload-a-file-using-hubspot-file-uploading-api-with-nodejs-axios-aws-lam" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/68378935/how-to-upload-a-file-using-hubspot-file-uploading-api-with-nodejs-axios-aws-lam&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I,m having a hard time figuring out what goes wrong or in what format I need to pass the file.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jul 2021 13:43:35 GMT</pubDate>
    <dc:creator>Rowan450</dc:creator>
    <dc:date>2021-07-14T13:43:35Z</dc:date>
    <item>
      <title>How to upload a file using Hubspot File Uploading API with Nodejs, Axios AWS Lambda,</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-upload-a-file-using-Hubspot-File-Uploading-API-with/m-p/459002#M45040</link>
      <description>&lt;P&gt;i,m using a lambda function to send clients side uploaded files to the hubspot api. On the client side I encode the file to base64 and then invoke the lambda function with the data. I,m trying to upload the base64 Encoded file, but I can't find the proper way to pass the file or what the api expects. I was only able to find this line:&lt;/P&gt;&lt;P&gt;"“file”: {binary data}"&lt;/P&gt;&lt;P&gt;The error I receive is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error: Request failed with status code 400&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the only thing that goes wrong is passing the file, but i dont know what format the api expects because the documentation are not that clear. Also the error response isn't very helpfull either.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Are all the values of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;var options&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;correctly filled in?&lt;/LI&gt;&lt;LI&gt;How to correctly pass the file&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; file: Buffer.from(event.data.drawing, 'base64'),?&lt;/LI&gt;&lt;LI&gt;Is there any way to get more helpfull axios error responses or debugging advice?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;DOCS&lt;/STRONG&gt;:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.hubspot.com/docs/api/files/files" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developers.hubspot.com/docs/api/files/files&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-meta"&gt;'use strict'&lt;/SPAN&gt;;
&lt;SPAN class="hljs-keyword"&gt;const&lt;/SPAN&gt; axios = &lt;SPAN class="hljs-built_in"&gt;require&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"axios"&lt;/SPAN&gt;);

&lt;SPAN class="hljs-built_in"&gt;exports&lt;/SPAN&gt;.&lt;SPAN class="hljs-property"&gt;handler&lt;/SPAN&gt; = &lt;SPAN class="hljs-keyword"&gt;async&lt;/SPAN&gt; (event, context) =&amp;gt; {
    &lt;SPAN class="hljs-keyword"&gt;const&lt;/SPAN&gt; apiKey = &lt;SPAN class="hljs-string"&gt;"myApiKey"&lt;/SPAN&gt;;

   &lt;SPAN class="hljs-comment"&gt;//event.data.drawing the BASE64 encoded string&lt;/SPAN&gt;

    &lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; options = {
        &lt;SPAN class="hljs-attr"&gt;method&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'POST'&lt;/SPAN&gt;,
        &lt;SPAN class="hljs-attr"&gt;baseURL&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'https://api.hubapi.com'&lt;/SPAN&gt;,
        &lt;SPAN class="hljs-attr"&gt;url&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'/files/v3/files'&lt;/SPAN&gt;,
        &lt;SPAN class="hljs-attr"&gt;params&lt;/SPAN&gt;: { &lt;SPAN class="hljs-attr"&gt;hapikey&lt;/SPAN&gt;: apiKey },
        &lt;SPAN class="hljs-attr"&gt;headers&lt;/SPAN&gt;: { &lt;SPAN class="hljs-attr"&gt;accept&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'application/json'&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;'content-type'&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'multipart/form-data'&lt;/SPAN&gt; }, 
        &lt;SPAN class="hljs-attr"&gt;data&lt;/SPAN&gt;: {
            &lt;SPAN class="hljs-attr"&gt;options&lt;/SPAN&gt;: {
                &lt;SPAN class="hljs-attr"&gt;access&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;"PRIVATE"&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;ttl&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'P2W'&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;overwrite&lt;/SPAN&gt;: &lt;SPAN class="hljs-literal"&gt;false&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;duplicateValidationStrategy&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'NONE'&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-attr"&gt;duplicateValidationScope&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'NONE'&lt;/SPAN&gt;,
            },
            &lt;SPAN class="hljs-attr"&gt;folderPath&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'offerte_aanvragen'&lt;/SPAN&gt;,
            &lt;SPAN class="hljs-attr"&gt;file&lt;/SPAN&gt;: &lt;SPAN class="hljs-title class_"&gt;Buffer&lt;/SPAN&gt;.&lt;SPAN class="hljs-title function_"&gt;from&lt;/SPAN&gt;(event.&lt;SPAN class="hljs-property"&gt;data&lt;/SPAN&gt;.&lt;SPAN class="hljs-property"&gt;drawing&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;'base64'&lt;/SPAN&gt;),
        },
        &lt;SPAN class="hljs-attr"&gt;responseType&lt;/SPAN&gt;: &lt;SPAN class="hljs-string"&gt;'json'&lt;/SPAN&gt;,
    };


    &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;Promise&lt;/SPAN&gt;(&lt;SPAN class="hljs-function"&gt;(&lt;SPAN class="hljs-params"&gt;resolve, reject&lt;/SPAN&gt;) =&amp;gt;&lt;/SPAN&gt; {
        &lt;SPAN class="hljs-title function_"&gt;axios&lt;/SPAN&gt;(options).&lt;SPAN class="hljs-title function_"&gt;then&lt;/SPAN&gt;(&lt;SPAN class="hljs-function"&gt;(&lt;SPAN class="hljs-params"&gt;response&lt;/SPAN&gt;) =&amp;gt;&lt;/SPAN&gt; {
            &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (response.&lt;SPAN class="hljs-property"&gt;statusText&lt;/SPAN&gt; !== &lt;SPAN class="hljs-string"&gt;'OK'&lt;/SPAN&gt;) {
                &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; &lt;SPAN class="hljs-title function_"&gt;reject&lt;/SPAN&gt;(response);
            } &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; {
                &lt;SPAN class="hljs-title function_"&gt;resolve&lt;/SPAN&gt;(response)
            }

        }).&lt;SPAN class="hljs-title function_"&gt;catch&lt;/SPAN&gt;(&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-params"&gt;error&lt;/SPAN&gt; =&amp;gt;&lt;/SPAN&gt; {
            &lt;SPAN class="hljs-title function_"&gt;reject&lt;/SPAN&gt;(error);
            &lt;SPAN class="hljs-variable language_"&gt;console&lt;/SPAN&gt;.&lt;SPAN class="hljs-title function_"&gt;log&lt;/SPAN&gt;(error)
        });
    })
}&lt;/PRE&gt;&lt;P&gt;Source:&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/68378935/how-to-upload-a-file-using-hubspot-file-uploading-api-with-nodejs-axios-aws-lam" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/68378935/how-to-upload-a-file-using-hubspot-file-uploading-api-with-nodejs-axios-aws-lam&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I,m having a hard time figuring out what goes wrong or in what format I need to pass the file.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 13:43:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-upload-a-file-using-Hubspot-File-Uploading-API-with/m-p/459002#M45040</guid>
      <dc:creator>Rowan450</dc:creator>
      <dc:date>2021-07-14T13:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a file using Hubspot File Uploading API with Nodejs, Axios AWS Lambda,</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-upload-a-file-using-Hubspot-File-Uploading-API-with/m-p/459676#M45070</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/210255"&gt;@Rowan450&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;Please use below code in node function : \r\n\r\n    var postUrl = 'https://api.hubapi.com/filemanager/api/v3/files/upload?hapikey='+HAPI_KEY;\r\n\r\n    var filename = 'example_file.txt';\r\n\r\n    var fileOptions = {\r\n         access: 'PUBLIC_INDEXABLE',\r\n         ttl: 'P3M',\r\n         overwrite: false,\r\n         duplicateValidationStrategy: 'NONE',\r\n         duplicateValidationScope: 'ENTIRE_PORTAL'\r\n     };\r\n\r\n     var formData = {\r\n         file: fs.createReadStream(filename),\r\n         options: JSON.stringify(fileOptions),\r\n         folderPath: 'docs'\r\n     };\r\n\r\n     request.post({\r\n         url: postUrl,\r\n         formData: formData\r\n     }, function optionalCallback(err, httpResponse, body){\r\n         return console.log(err, httpResponse.statusCode, body);\r\n     });\r\nThanks !!&amp;quot;}" data-sheets-userformat="{&amp;quot;2&amp;quot;:829,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;6&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;7&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;8&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;11&amp;quot;:4,&amp;quot;12&amp;quot;:0}"&gt;Please use below code in node function : &lt;BR /&gt;&lt;BR /&gt;var postUrl = '&lt;A href="https://api.hubapi.com/filemanager/api/v3/files/upload?hapikey='+HAPI_KEY" target="_blank"&gt;https://api.hubapi.com/filemanager/api/v3/files/upload?hapikey='+HAPI_KEY&lt;/A&gt;; &lt;BR /&gt;&lt;BR /&gt;var filename = 'example_file.txt'; &lt;BR /&gt;&lt;BR /&gt;var fileOptions = { &lt;BR /&gt;access: 'PUBLIC_INDEXABLE', &lt;BR /&gt;ttl: 'P3M', &lt;BR /&gt;overwrite: false, &lt;BR /&gt;duplicateValidationStrategy: 'NONE', &lt;BR /&gt;duplicateValidationScope: 'ENTIRE_PORTAL' &lt;BR /&gt;}; &lt;BR /&gt;&lt;BR /&gt;var formData = { &lt;BR /&gt;file: fs.createReadStream(filename), &lt;BR /&gt;options: JSON.stringify(fileOptions), &lt;BR /&gt;folderPath: 'docs' &lt;BR /&gt;}; &lt;BR /&gt;&lt;BR /&gt;request.post({ &lt;BR /&gt;url: postUrl, &lt;BR /&gt;formData: formData &lt;BR /&gt;}, function optionalCallback(err, httpResponse, body){ &lt;BR /&gt;return console.log(err, httpResponse.statusCode, body); &lt;BR /&gt;}); &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P data-unlink="true"&gt;&lt;SPAN&gt;Hope this helps!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;If we were able to answer your query, kindly help the community by marking it as a solution.&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 09:01:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-upload-a-file-using-Hubspot-File-Uploading-API-with/m-p/459676#M45070</guid>
      <dc:creator>webdew</dc:creator>
      <dc:date>2021-07-15T09:01:28Z</dc:date>
    </item>
  </channel>
</rss>

