<?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 Re: Attaching Files to a Custom Object in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/870036#M68536</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you happen to know if you are using any specific scopes?&amp;nbsp; I've done approximately the same thing for a deal, and I can see the note be associated in postman, but when I go to the deal I see that the attachment has been deleted.&amp;nbsp; Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2023 18:10:26 GMT</pubDate>
    <dc:creator>MKaneko</dc:creator>
    <dc:date>2023-10-25T18:10:26Z</dc:date>
    <item>
      <title>Attaching Files to a Custom Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/869393#M68500</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Attaching files to custom objects seamlessly integrates documentation within your data flow, ensuring relevant information is just a click away. In this comprehensive guide, we'll unveil the step-by-step process to efficiently attach files to a custom object in HubSpot.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Step 1: Get the Associated Id&lt;/H2&gt;&lt;P&gt;&lt;STRONG&gt;API Documentation&lt;/STRONG&gt;: &lt;A href="https://developers.hubspot.com/docs/api/crm/associations" target="_new"&gt;CRM Associations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API Method&lt;/STRONG&gt;: GET&lt;/P&gt;&lt;PRE&gt;https://api.hubapi.com/crm/v4/associations/{fromObjectType}/{toObjectType}/labels&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;For our purpose, we want to associate NOTES to a CUSTOM OBJECT ID:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;https://api.hubapi.com/crm/v4/associations/notes/{custom_object_id}/labels&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected Response&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;"results": [&lt;BR /&gt;{&lt;BR /&gt;"category": "USER_DEFINED",&lt;BR /&gt;"typeId": 999, &lt;BR /&gt;"label": null&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;Save the &lt;STRONG&gt;typeId&lt;/STRONG&gt; value from the response. We'll need it for later steps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Step 2: Upload the File&lt;/H2&gt;&lt;P&gt;&lt;STRONG&gt;API Documentation&lt;/STRONG&gt;: &lt;A href="https://developers.hubspot.com/docs/api/files/files" target="_new"&gt;Files API&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API Method&lt;/STRONG&gt;: POST&lt;/P&gt;&lt;PRE&gt;https://api.hubapi.com/files/v3/files&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;While making the POST request, ensure you attach a file using the file key. Additionally, specify the folderId (can be any value) and provide any options as a JSON object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Upon successfully posting the file, you should receive a 201 response containing a JSON object. Extract the &lt;STRONG&gt;id&lt;/STRONG&gt; value from this object as we'll be using it in the next step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Step 3: Create a Note&lt;/H2&gt;&lt;P&gt;Files are integrated into HubSpot via notes. Thus, creating a note is essential for our goal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API Documentation&lt;/STRONG&gt;: &lt;A href="https://developers.hubspot.com/docs/api/crm/notes" target="_new"&gt;CRM Notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API Method&lt;/STRONG&gt;: POST&lt;/P&gt;&lt;PRE&gt;https://api.hubspot.com/crm/v3/objects/notes&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Send the following raw JSON in the body:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;"properties":{&lt;BR /&gt;"hs_timestamp": "{put_timestamp_here}",&lt;BR /&gt;"hubspot_owner_id":"{put_owner_id_here}",&lt;BR /&gt;"hs_attachment_ids":"{use the id from Step 2}",&lt;BR /&gt;"hs_note_body":"This is a test note and can be anything"&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;On successful execution, you'll get a 201 response with a JSON object. Keep the id from this object handy for the next step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Step 4: Associate the Note to the Record&lt;/H2&gt;&lt;P&gt;Finally, we need to associate the note we created with the actual record in HubSpot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API Documentation&lt;/STRONG&gt;: &lt;A href="https://developers.hubspot.com/docs/api/crm/notes" target="_new"&gt;CRM Notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;API Method&lt;/STRONG&gt;: PUT&lt;/P&gt;&lt;PRE&gt;https://api.hubspot.com/crm/v3/objects/notes/{{note_id_from_step3}/associations/{custom_object_id}/{the_id_of_the_specific_record}/{typeId_from_step1}&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;If everything worked correctly, you should receive a &lt;/SPAN&gt;200 OK&lt;SPAN&gt; response, confirming that the file has been successfully attached to the custom object in HubSpot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;By following these steps, you can efficiently integrate and attach files to any custom object in HubSpot using the platform's v3 APIs. Happy integrating!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 19:17:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/869393#M68500</guid>
      <dc:creator>ABollinger</dc:creator>
      <dc:date>2023-10-24T19:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Attaching Files to a Custom Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/869486#M68511</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/652878"&gt;@ABollinger&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thank you very much for taking the time to put this together! — Jaycee&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 21:31:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/869486#M68511</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-10-24T21:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Attaching Files to a Custom Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/869517#M68514</link>
      <description>&lt;P&gt;Very happy to help! We spent a few hours getting it working.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 22:55:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/869517#M68514</guid>
      <dc:creator>ABollinger</dc:creator>
      <dc:date>2023-10-24T22:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Attaching Files to a Custom Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/870036#M68536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you happen to know if you are using any specific scopes?&amp;nbsp; I've done approximately the same thing for a deal, and I can see the note be associated in postman, but when I go to the deal I see that the attachment has been deleted.&amp;nbsp; Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 18:10:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/870036#M68536</guid>
      <dc:creator>MKaneko</dc:creator>
      <dc:date>2023-10-25T18:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Attaching Files to a Custom Object</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/870838#M68594</link>
      <description>&lt;P&gt;What do you mean when you say deleted? There should be a note and the attachment in the sidebar.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 23:26:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Attaching-Files-to-a-Custom-Object/m-p/870838#M68594</guid>
      <dc:creator>ABollinger</dc:creator>
      <dc:date>2023-10-26T23:26:03Z</dc:date>
    </item>
  </channel>
</rss>

