Create associations between companies and files

Hey there andgom, cheers for engaging with the Community. I’m not a developer myself, but I can provide some insight on this one:

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 directly with the Files API that you seem to be using here. They’re also not Objects- From HubSpot’s point of view, Objects are Deals, Companies, Contacts, Tickets, Line Items/Products.

Adding an Attachment to an Object record (like a Contact or Company) would in this case involve using the Engagements API (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 attachments 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).

Hope this helps a bit!
Al