Last time I talked about how to use the API to delete overridden tokens. And all of that is still true, but I assumed the deleted a token from a folder would work the same way as deleting a token from a program. And it does, but there’s catch.
The endpoint to delete any token is this one:
{{base_url}}/rest/asset/v1/folder/3629/tokens/delete.json
where “3629” is the ID of the program you want to delete the token from. But what’s the ID of a folder?
Surprisingly, you won’t find this ID in the URL of the folder. If you have an URL like this:
https://experience.adobe.com/#/@instancename/so:munchkinID/marketo-engage/classic/MF1778A1
then 1778 is not the ID of the folder. I mean, probably it is, but it’s not the ID we need. The only way to find that ID is the API and the call “Get Folder by Name”.
GET {{base_url}}/rest/asset/v1/folder/byName.json?name=Learning
So here we want to know the name of the folder “Learning”.
Here’s the result of this call:

So the ID of this folder is “108”.
Good, and now finally, let me give you some additions to the actual deletion call. You have to specify that you want to delete from a folder, and you have to specify the type of token you want to delete. I wanted to delete a Script Token, and the name of this type is actually not named in the docs.

Notice the Folder ID in the URL, token name (“Salutation_German”), token type (“script block”) and folder type (“folder”) in the body.