Understanding How Folders Work With the Marketo API
One of the concepts I struggled with most when learning to use the Marketo API was how folders worked. I thought it should be pretty straightforward but there are a few things to keep in mind when using folders as parameters.
Folder ID
Finding an ID of an asset in Marketo is usually pretty simple just by looking at the URL in the address bar when clicking on asset but folders don’t act in the same way. The ID you see in the address bar is different from the ID for API purposes. This means we need to find out what the actual ID is using an API call.
Get Folder By Name
We can use the GET Folder by Name endpoint to find out that folder ID (substitute your munchkin code at the beginning and replace the folder name with the folder you want the ID for).
https://123-ABC-987.mktorest.com/rest/asset/v1/folder/byName.json?name=Whatever the folder name is&type=folder

As you can see in this screenshot, the actual folder ID of this folder is 5181. I can now use this ID in filters for other API calls.
Two Different Types of Folders
When using the Marketo API you will find out that aside from folders being folders, programs are also folders. This means we need to identify whether we are looking inside of a folder or a program in our parameter filters. Below are two different ways in which it works.
Filter type and filter values
If you use an endpoint like GET Programs you will see that there is a parameter called ‘Filter Type’ where you can choose several options, one of which is ‘folderId’. You could also choose ‘programId’ if we were trying to get a nested program. In this situation we will use both the ‘filterType’ and ‘filterValues’ parameters. Since our folder ID from above is 5181, that is what we will put for the filterValues parameter.


JSON Key Value Pair
Some endpoints will use a JSON array with key value pairs instead. If you want to use the GET Smart Campaigns endpoint to get all Smart Campaigns from a certain program or folder the parameter will look something like {‘type’: ‘folder’, ‘id’:1234} for a folder or {‘type’: ‘program’, ‘id’:1234} for a program.


Below is a video that shows how to do this but always feel free to reach out if you have questions.