r/GoogleAppsScript • • Jun 07 '25

Question Deploy Apps Script as API executable for only certain functions

I have a project that I want to make API executable, but I dont want any function to run. I would prefer certain functions be entrypoints that I define. Is this possible?

5 Upvotes

10 comments sorted by

View all comments

Show parent comment

4

u/nemcrunchers Jun 08 '25

Hmmm. I did find that putting an underscore after the function name makes them "private" and not callable via API. This does make it better but I was still looking for an allowlisting, so I didn't have to keep naming them this way but maintain a list of allowed functions instead

1

u/Big_Bad8496 Jun 08 '25

You could use the suggestion above, and have the public entry point method pass in a UUID to the other methods. If the UUID is incorrect, throw an error. That way, even if someone knows about and calls those other methods, they are unlikely to guess the UUID necessary for them to run.

Even better, store the UUID in Script Properties so you don’t expose it in the code.

Even better than that, dynamically generate the UUID each time it runs so even if someone does guess it correctly, they can only do that once.