<?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: Create associations between companies and files in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/447970#M44321</link>
    <description>&lt;P&gt;Hey there andgom, cheers for engaging with the Community. I'm not a developer myself, but I can provide some insight on this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attachments (on the Company or Contact Record) reflect files that were attached to some Engagement on the Contact record- Notes, emails, etc. As such, they don't interact &lt;EM&gt;directly&lt;/EM&gt; with the &lt;A href="https://developers.hubspot.com/docs/api/files/files" target="_blank" rel="noopener"&gt;Files API that you seem to be using here&lt;/A&gt;. They're also not Objects- From HubSpot's point of view, Objects are Deals, Companies, Contacts, Tickets, Line Items/Products.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adding an Attachment to an Object record (like a Contact or Company) would in this case involve using the &lt;A href="https://legacydocs.hubspot.com/docs/methods/engagements/create_engagement" target="_blank" rel="noopener"&gt;Engagements API&lt;/A&gt; (I'm aware that this is the Legacy version- at time of writing, the updated Engagements API has yet to be released, so the Legacy version is the most recent stable release). You'll note at the documentation page I've linked that there's an optional&amp;nbsp;&amp;nbsp;&lt;EM&gt;attachments&amp;nbsp;&lt;/EM&gt;parameter you can use when creating Engagements, that allow you to associate previously-uploaded files with a Company/Contact/Deal etc, which will show up under the Attachments tab (the individual file IDs can be found using the Files API).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps a bit!&lt;BR /&gt;Al&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jun 2021 13:19:56 GMT</pubDate>
    <dc:creator>Aleeson</dc:creator>
    <dc:date>2021-06-16T13:19:56Z</dc:date>
    <item>
      <title>Create associations between companies and files</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/447926#M44316</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a noobie developer and I am currently trying to associate a file with a company.&amp;nbsp; So, as far as I know, it seems that associations can be done with tickets, deals, other companies, etc... You can actually get the associations between to specific object making a POST request to &lt;A href="https://api.hubapi.com/crm/v3/associations/company/file/batch/read?hapikey=HAPIKEY" target="_blank"&gt;https://api.hubapi.com/crm/v3/associations/{&lt;SPAN&gt;fromObjectType&lt;/SPAN&gt;}/{to&lt;SPAN&gt;ObjectType&lt;/SPAN&gt;}/batch/read?hapikey=HAPIKEY&lt;/A&gt;&amp;nbsp; and specifying the id of the "&lt;SPAN&gt;fromObjectType" object at the body. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This works with tickets, other companies, etc... but when I try to do it with Attachments&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;it returns a 400 with this body:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"status"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"error"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"message"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"Unable&amp;nbsp;to&amp;nbsp;infer&amp;nbsp;object&amp;nbsp;type&amp;nbsp;from:&amp;nbsp;attachment"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"correlationId"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"d772d739-45bd-49cc-a45c-c95ba4ff2d84"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've seen that, from the CRM web, you can actually do it, you can associate a company with files or "Attachments"&amp;nbsp; at the right sidebar as you can see in the screenshot.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="associations.PNG" style="width: 418px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/44548i7A8345747B092640/image-size/large?v=v2&amp;amp;px=999" role="button" title="associations.PNG" alt="associations.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this said, why is it possible to associate a company with a file from the CRM web and not via the API? If&amp;nbsp; I am wrong and it is possible to do this via the API, how is the object type for Attachments called in HubSpot? Also if you have a better idea or you know a better way to handle my situation how would you do it?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:26:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/447926#M44316</guid>
      <dc:creator>andgom</dc:creator>
      <dc:date>2021-06-16T11:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create associations between companies and files</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/447970#M44321</link>
      <description>&lt;P&gt;Hey there andgom, cheers for engaging with the Community. I'm not a developer myself, but I can provide some insight on this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attachments (on the Company or Contact Record) reflect files that were attached to some Engagement on the Contact record- Notes, emails, etc. As such, they don't interact &lt;EM&gt;directly&lt;/EM&gt; with the &lt;A href="https://developers.hubspot.com/docs/api/files/files" target="_blank" rel="noopener"&gt;Files API that you seem to be using here&lt;/A&gt;. They're also not Objects- From HubSpot's point of view, Objects are Deals, Companies, Contacts, Tickets, Line Items/Products.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adding an Attachment to an Object record (like a Contact or Company) would in this case involve using the &lt;A href="https://legacydocs.hubspot.com/docs/methods/engagements/create_engagement" target="_blank" rel="noopener"&gt;Engagements API&lt;/A&gt; (I'm aware that this is the Legacy version- at time of writing, the updated Engagements API has yet to be released, so the Legacy version is the most recent stable release). You'll note at the documentation page I've linked that there's an optional&amp;nbsp;&amp;nbsp;&lt;EM&gt;attachments&amp;nbsp;&lt;/EM&gt;parameter you can use when creating Engagements, that allow you to associate previously-uploaded files with a Company/Contact/Deal etc, which will show up under the Attachments tab (the individual file IDs can be found using the Files API).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps a bit!&lt;BR /&gt;Al&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 13:19:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/447970#M44321</guid>
      <dc:creator>Aleeson</dc:creator>
      <dc:date>2021-06-16T13:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create associations between companies and files</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/448376#M44362</link>
      <description>&lt;P&gt;Thank you very much &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127832"&gt;@Aleeson&lt;/a&gt;! This is exactly what I was looking for!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 09:15:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/448376#M44362</guid>
      <dc:creator>andgom</dc:creator>
      <dc:date>2021-06-17T09:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create associations between companies and files</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/806049#M64789</link>
      <description>&lt;P&gt;For anyone that finds this post in the future, this app solves for this kind of thing natively in the UI using workflow actions:&amp;nbsp;&lt;A href="https://ecosystem.hubspot.com/marketplace/apps/marketing/data-management/file-attachment-associations-1549105" target="_blank"&gt;https://ecosystem.hubspot.com/marketplace/apps/marketing/data-management/file-attachment-associations-1549105&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;While not the actual code necessary to do this, the app solves teh use case of attaching files to objects.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 14:11:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-associations-between-companies-and-files/m-p/806049#M64789</guid>
      <dc:creator>JMadrone</dc:creator>
      <dc:date>2023-06-12T14:11:37Z</dc:date>
    </item>
  </channel>
</rss>

