Search code examples
google-apps-scriptgoogle-apihttp-status-code-403google-api-clientgoogle-apps-script-api

403 The caller does not have permission & Request entity was not found


If you're getting errors for Google App Script API:

  1. 403 The caller does not have permission. Permission_Denied Forbidden
  2. Request entity was not found

The answer below should remedy the issue.

If you find this helpful, please remember to contribute to hard-to-find issues especially for Google API services since they're often poorly documented and solutions are not complete (I usually find workarounds that are not secure).

Edit: I feel the possible duplicate link goes more in depth on one issue. This post has 2 key phrases and it solves them quickly. If the visitor feel they need to go more in depth, then the possible duplicate link would be a good choice: How to run Google App Script function from Google OAuth 2.0 Playground | The caller does not have permission

I've also searched thoroughly using the key phrases of the issues but I couldn't find any that solves it satisfactorily. The answer also tells the user that they don't need to share their document publicly and no service account is needed which I feel is important. The conciseness of the answer I feel is helpful. Though I will close this post if there's a helpful explanation on why it should be closed.


Solution

  • First go into your script:

    1. Publish > Deploy as API Executable > New > Update > Close
    2. Resources > Cloud Platform Project > Enter Project Number (https://console.cloud.google.com/home/dashboard) > Set Project > Close
    3. Enable execution API on developer console.
    4. Check if your credentials.json is for the correct project.

    Note: I find many solutions that share the document to public and also a service account requirement, this is not required.