# Getting contact's attachments via API

**URL:** <https://community.hubspot.com/t/getting-contacts-attachments-via-api/94921>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [November 28, 2023, 11:43am UTC](https://community.hubspot.com/t/getting-contacts-attachments-via-api/94921 "2023-11-28T11:43:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dawidk](https://avatars.discourse-cdn.com/v4/letter/d/a8b319/32.png) [@Dawidk](https://community.hubspot.com/u/Dawidk)\
**Post date:** [November 28, 2023, 11:43am UTC](https://community.hubspot.com/t/getting-contacts-attachments-via-api/94921/1 "2023-11-28T11:43:11Z")

</div>

how can I fetch files/attachments associated with a contact on a private page? The flow:  
1. User (from the list) login in a private page  
2. After login we grab the contact ID  
3. Based on ID we get attachments associated with contact.  
but, can I:  
1. query the API using jQuery/JS directly from the website? (CORS policy issue)  
2. use the API (combination of different endpoints) to get the URL of these files and then display them on the target site?  
3. if so, can someone send some usage examples of what should be used to get them?

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [December 5, 2023, 9:07am UTC](https://community.hubspot.com/t/getting-contacts-attachments-via-api/94921/2 "2023-12-05T09:07:24Z")

</div>

Hi @Dawidk

You can follow the following steps:  
**1. To get contact’s association through contact id**

curl --request GET \

--url ‘[https://api.hubapi.com/crm/v3/objects/contacts{contactId}](https://api.hubapi.com/crm/v3/objects/contacts%7BcontactId%7D)? associations=notes&archived=false’ \

--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’

hit this api first to get asssociation (notes) as a query param you’ll get its id then you have to hit this api

===

**2. After get association id of notes then hit a call for get notes attachments ids**

curl --request GET \

--url ‘[https://api.hubapi.com/crm/v3/objects/notes{noteId}](https://api.hubapi.com/crm/v3/objects/notes%7BnoteId%7D)? properties=hs\_attachment\_ids&archived=false’ \

--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’

===

**3. Hit at last**

call files api by id

curl --location ‘[https://api.hubapi.com/filemanager/api/v2/files{attachmentId}](https://api.hubapi.com/filemanager/api/v2/files%7BattachmentId%7D)’ \

--header ‘authorization: Bearer YOUR\_ACCESS\_TOKEN’

Hope this will helps you out. Please mark it as **Solution Accepted & Upvote** to help other Community member.  
Thanks!
