Short answer
HubSpot's developer docs: adding a file to a record creates a note with the file attached. To do it by API, upload to the file manager, copy the file id, then create a note with the file attached and an associations entry for the record.
1. The calls
1. POST /files/v3/files (upload; keep the returned id)
2. POST /crm/v3/objects/notes
properties: hs_timestamp, hs_attachment_ids = FILE_ID
associations: the record's id and the note-to-record association typeThe Files API guide has a full request body example.
2. File properties
To store a file in a property instead, see file properties.