If you want to get only the folder associated with stories, you can do that using the Storyblok management API like this;
Firstly, you need to initialize the Storyblok client with a personal access token. You can do that by going to the MyAccount section {1} and Personal access tokens {2}. Click Generate new Token {3} button.
Copy the token immediately because once that page is refreshed, you won’t be able to do that again, and keep it in a safe place. Ideally, in a .env file.
Initialize the Storyblok client and fetch the folders from your space.
The response data contains an array of the folder each having the data structure below.