get all subfolders of root folder

I seem to be struggling to retrieve all the subfolders of a root folder by parentid of root, i only get returned a few results. how should the pagination be set? if needed. thx

base_url = “https://api.hubapi.com/filemanager/api/v2/folders
i have 600+ folders to retrieve from the parent folder.

Hey @karien :waving_hand: What happens when you use the V3 endpoint?

I set up a quick test:

  • I have a folder
  • I added 20 sub folders (but not 600 :blush:)

Request

curl --request GET \
 --url 'https://api.hubapi.com/files/v3/folders/search?parentFolderId=92105487368' \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN'

Response

HTTP 200

{
 "results": [
 {
 "id": "181099959724",
 "createdAt": "2024-10-15T20:23:48.234Z",
 "updatedAt": "2024-10-15T20:23:48.234Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "1",
 "path": "/Bobs files/1"
 },
 {
 "id": "181089543270",
 "createdAt": "2024-10-15T20:23:51.909Z",
 "updatedAt": "2024-10-15T20:23:51.909Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "2",
 "path": "/Bobs files/2"
 },
 {
 "id": "181089562286",
 "createdAt": "2024-10-15T20:23:55.491Z",
 "updatedAt": "2024-10-15T20:23:55.491Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "3",
 "path": "/Bobs files/3"
 },
 {
 "id": "181099999911",
 "createdAt": "2024-10-15T20:23:59.518Z",
 "updatedAt": "2024-10-15T20:23:59.518Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "4",
 "path": "/Bobs files/4"
 },
 {
 "id": "181089562375",
 "createdAt": "2024-10-15T20:24:02.890Z",
 "updatedAt": "2024-10-15T20:24:02.890Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "5",
 "path": "/Bobs files/5"
 },
 {
 "id": "181103914676",
 "createdAt": "2024-10-15T20:40:58.140Z",
 "updatedAt": "2024-10-15T20:40:58.140Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "10",
 "path": "/Bobs files/10"
 },
 {
 "id": "181103914781",
 "createdAt": "2024-10-15T20:41:10.802Z",
 "updatedAt": "2024-10-15T20:41:10.802Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "12",
 "path": "/Bobs files/12"
 },
 {
 "id": "181100002602",
 "createdAt": "2024-10-15T20:41:20.383Z",
 "updatedAt": "2024-10-15T20:41:20.383Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "15",
 "path": "/Bobs files/15"
 },
 {
 "id": "181099962201",
 "createdAt": "2024-10-15T20:41:27.262Z",
 "updatedAt": "2024-10-15T20:41:27.262Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "17",
 "path": "/Bobs files/17"
 },
 {
 "id": "181099986557",
 "createdAt": "2024-10-15T20:41:33.353Z",
 "updatedAt": "2024-10-15T20:41:33.353Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "19",
 "path": "/Bobs files/19"
 }
 ],
 "paging": {
 "next": {
 "after": "AAAACg",
 "link": "https://api.hubapi.com/files/v3/folders/search?hs_static_app=endpoint-reference-ui&hs_static_app_version=1.6820&parentFolderId=92105487368&after=AAAACg"
 }
 }
}

2nd response using the `after` value

HTTP 200

{
 "results": [
 {
 "id": "181100095817",
 "createdAt": "2024-10-15T20:40:44.224Z",
 "updatedAt": "2024-10-15T20:40:44.224Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "6",
 "path": "/Bobs files/6"
 },
 {
 "id": "181104222134",
 "createdAt": "2024-10-15T20:40:47.674Z",
 "updatedAt": "2024-10-15T20:40:47.674Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "7",
 "path": "/Bobs files/7"
 },
 {
 "id": "181103914664",
 "createdAt": "2024-10-15T20:40:51.069Z",
 "updatedAt": "2024-10-15T20:40:51.069Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "8",
 "path": "/Bobs files/8"
 },
 {
 "id": "181099986457",
 "createdAt": "2024-10-15T20:40:54.040Z",
 "updatedAt": "2024-10-15T20:40:54.040Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "9",
 "path": "/Bobs files/9"
 },
 {
 "id": "181100095901",
 "createdAt": "2024-10-15T20:41:07.112Z",
 "updatedAt": "2024-10-15T20:41:07.112Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "11",
 "path": "/Bobs files/11"
 },
 {
 "id": "181099993182",
 "createdAt": "2024-10-15T20:41:14.023Z",
 "updatedAt": "2024-10-15T20:41:14.023Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "13",
 "path": "/Bobs files/13"
 },
 {
 "id": "181100002598",
 "createdAt": "2024-10-15T20:41:17.312Z",
 "updatedAt": "2024-10-15T20:41:17.312Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "14",
 "path": "/Bobs files/14"
 },
 {
 "id": "181099993208",
 "createdAt": "2024-10-15T20:41:23.325Z",
 "updatedAt": "2024-10-15T20:41:23.325Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "16",
 "path": "/Bobs files/16"
 },
 {
 "id": "181099986549",
 "createdAt": "2024-10-15T20:41:29.944Z",
 "updatedAt": "2024-10-15T20:41:29.944Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "18",
 "path": "/Bobs files/18"
 },
 {
 "id": "181104678011",
 "createdAt": "2024-10-15T20:41:36.123Z",
 "updatedAt": "2024-10-15T20:41:36.123Z",
 "archived": false,
 "parentFolderId": "92105487368",
 "name": "20",
 "path": "/Bobs files/20"
 }
 ]
}

Thanks for the additional details! — Jaycee

Thank you, this endpoint made all the difference.. appreciate.

That’s fantastic. I’m glad it helped :blush: — Jaycee