Get folder by folder name

We have a requirement to upload document to a specific folder. I see to achieve that, we need to know the folder id, but we only have folder name. So I am trying to get folder Id by name, but looks like we don’t have an API for that, the closest one I found is /folders/{folder_id}/items, we pull all children items under a folder, then find the one whose name matches.

The problem is that endpoint has a limitation of 1000 records for each call, and the offset also has a limitation of 10,000. So if there are too many folders, we will not able find the one we need, and even if it doesn’t have that many, the performance is too bad.

So the question is, do we have such an API that getting folder Id by parent Id and folder name?

Hi there,
Welcome to our forum and thanks for posting your question. I’d suggest checking out the search endpoint. You can specify ancestor_folder_ids, and provide folder name as the query parameter.

Let me know if that helps!

1 Like

Yes, as Olga noted, you really only have two options:

  1. Iterate through child items to find it in the list of children by name
  2. Search for it using the search endpoint.

Note though if you go the search route you’ll need to keep in mind that the search index does not update immediately and in fact takes around 10 minutes, so if you use this method make sure you wait until after 10 minutes after folder creation:

1 Like

Thank you both for the suggestions. Very helpful!
Most of time, Search can meet our requirement. If we need to know the id winthin 10min, we can use Items endpoint as a complement.

1 Like