# Retrieve fileID from form upload on custom object

**URL:** <https://community.hubspot.com/t/retrieve-fileid-from-form-upload-on-custom-object/58819>\
**Category:** APIs & Integrations\
**Created:** [June 10, 2022, 4:53pm UTC](https://community.hubspot.com/t/retrieve-fileid-from-form-upload-on-custom-object/58819 "2022-06-10T16:53:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HerrmannC](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/herrmannc/32/35926_2.png) [@HerrmannC](https://community.hubspot.com/u/HerrmannC)\
**Post date:** [June 10, 2022, 4:53pm UTC](https://community.hubspot.com/t/retrieve-fileid-from-form-upload-on-custom-object/58819/1 "2022-06-10T16:53:43Z")

</div>

I have a custom object with various different properties on it of the “file” type. Once a user submits the form with the associated files it is saved.

I’m trying to access the form submission via the api. The files api ([Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/files/files)) requires a fileid to modify the files however accessing the custom objects via the api only provides a signed url to the file ([Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/crm-custom-objects)).

Is there any way to also retrieve the fileID associated to a signed url? I’ve tried using the file search specifying the url but have been unsuccessful receiving internal errors on the api endpoint.

Is there an easier way? perhaps some attribute I can pass to the get custom objects endpoint to include the fileIDs on file properties?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [June 13, 2022, 8:41pm UTC](https://community.hubspot.com/t/retrieve-fileid-from-form-upload-on-custom-object/58819/2 "2022-06-13T20:41:03Z")

</div>

Hi, @HerrmannC 👋 Let’s see if we can get this conversation kicked off for you. Hey, @JBeatty @Jsum @daveroma, do you have any insight or thoughts on how @HerrmannC might approach this challenge?

Thank you very much! — Jaycee

---

<div class="post-metadata">

**Author:** ![JBeatty](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jbeatty/32/52252_2.png) [@JBeatty](https://community.hubspot.com/u/JBeatty)\
**Post date:** [June 13, 2022, 11:10pm UTC](https://community.hubspot.com/t/retrieve-fileid-from-form-upload-on-custom-object/58819/3 "2022-06-13T23:10:31Z")

</div>

Hi @HerrmannC,  
When a file is uploaded via a form, it is stored within a folder called “form-submissions” then there is a sub folder of a UUID specific to that form submission, which is then followed by the files that were updated. To find the file id from a signed URL simply take the last three sections of the path and pass it into the path query parameter of the files search API.

For example, given a signed URL:

`https://6653780.cdnp1.hubspotusercontent-na1.net/hubfs/6653780/form-uploads/f2783b77-7cb3-42f1-bc54-2f7795103d34/6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png?Expires=1655164652&Signature=T3ceYH3IvPgncrD-~5ehctuexelKfkgHiB00YwPuhbdOywlEStfwWo2OZ7Hm-UyoD25nBlbQ~OTZJVZeMfCIt9-kOYxfuZ6Y90M2rA6exS8vSIMCGevU5-9rcwU-6c7r7~CxUlGMxOOArCLjYmQRAbkKUjqgRGTxnbd3fh9AJSC-NitsOrL7vEPTJTjzDrdaAKFm6AnYIR1HZioIJtrMfZ7x4JiZbH-CXRVWZUf2cKe3su52IHKyoFt7JTdih5u9yZEFiBpPTYuZ8GyP0y6ies6gIMu8bmLjV7Ugw7VizB2x9yzOl~15vv9wSPYEfSj5CzSohRKMhFNMFluiXh5-dw__&Key-Pair-Id=APKAJDNICOKANPHVCSBQ`

Strip everything after the question mark:

`https://6653780.cdnp1.hubspotusercontent-na1.net/hubfs/6653780/form-uploads/f2783b77-7cb3-42f1-bc54-2f7795103d34/6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png`

Then take the last three sections of the path:

`/form-uploads/f2783b77-7cb3-42f1-bc54-2f7795103d34/6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png`

URL encode it:

`%2Fform-uploads%2Ff2783b77-7cb3-42f1-bc54-2f7795103d34%2F6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png`

Then make a get request as follows to the file search API:

`https://api.hubapi.com/files/v3/files/search?path=%2Fform-uploads%2Ff2783b77-7cb3-42f1-bc54-2f7795103d34%2F6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png&hapikey= ********-**** - ****-**** - ************ `

Which will then return the files id:

```lia-code-sample
{
 "results": [
 {
 "id": "76221798309",
 "createdAt": "2022-06-13T22:57:13.882Z",
 "updatedAt": "2022-06-13T22:57:15.473Z",
 "archived": false,
 "parentFolderId": "76219586475",
 "name": "6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40",
 "path": "/form-uploads/f2783b77-7cb3-42f1-bc54-2f7795103d34/6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png",
 "size": 177157,
 "height": 1751,
 "width": 546,
 "encoding": "png",
 "type": "IMG",
 "extension": "png",
 "defaultHostingUrl": "https://6653780.fs1.hubspotusercontent-na1.net/hubfs/6653780/form-uploads/f2783b77-7cb3-42f1-bc54-2f7795103d34/6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png",
 "url": "https://6653780.fs1.hubspotusercontent-na1.net/hubfs/6653780/form-uploads/f2783b77-7cb3-42f1-bc54-2f7795103d34/6c41319e-c587-4085-9855-d2e3a13fac88-test_file-Screenshot-2022-06-13-at-11.39.40.png",
 "isUsableInContent": true,
 "access": "PRIVATE"
 }
 ]
}

```

Best,
