You are not permitted to access this resource. Function ... is not whitelisted
Applies to: Frappe v16.34.0, ERPNext v16.35.0. Self-hosted bench in developer mode. Checked 2026-11. Not checked on v15.
Symptom#
You call a Python method with frappe.call, a button or a REST request. Desk shows a "Method Not Allowed" dialog. The REST response has this exception:
frappe.exceptions.PermissionError: <details><summary>You are not permitted to access this resource. Login to access</summary>Function <strong>guide_demo.api.get_open_todos</strong> is not whitelisted.</details>

We got this error on a test app with this function:
import frappe
def get_open_todos():
return frappe.get_all("ToDo", filters={"status": "Open"}, fields=["name", "description"])
Cause#
Frappe runs a Python function from a request only if it has the @frappe.whitelist() decorator. A Guest (a visitor who is not logged in) can call it only with allow_guest=True. Frappe does this check in is_whitelisted() in frappe/__init__.py.
The message says "Login to access" for both causes. It does not tell you which cause you have.
Fix#
- Open the Python file from the error. For
guide_demo.api.get_open_todos, this isapps/guide_demo/guide_demo/api.py. Add
@frappe.whitelist()above the function.pythonimport frappe @frappe.whitelist() def get_open_todos(): return frappe.get_all("ToDo", filters={"status": "Open"}, fields=["name", "description"])If visitors who are not logged in call the function, add
allow_guest=True.python@frappe.whitelist(allow_guest=True) def get_store_status(): return "open"Anyone on the internet can call a guest function.
frappe.get_alldoes not check permissions. Do not return private data from a guest function.Reload the code. With
bench startin developer mode, our server reloaded when we saved the file. On a production bench, run this command:bashbench restartWe did not test
bench restarton a production bench for this guide.For a method in a DocType controller (called with
frm.call), add the same decorator to that method. We got the same error for a controller method:Function frappe.desk.doctype.todo.todo.on_update is not whitelisted.
Check that it worked#
Log in to Desk. Open the browser console and run this:
frappe.call({ method: "guide_demo.api.get_open_todos" }).then((r) => console.log(r.message));
You get the records back. Our call returned this:
[{"name": "sk72jn1rn8", "description": "Check the whitelist fix"}]

For a guest function, open https://<site-name>/api/method/<dotted.path.to.function> in a private window. Our guest call returned {"message":"open"}.
If it still fails#
Check the dotted path for typos. A wrong name gives a different error:
textFailed to get method for command guide_demo.api.get_open_todo with module 'guide_demo.api' has no attribute 'get_open_todo'After you install a new app, you can get
ModuleNotFoundError: No module named 'guide_demo'. The running server started before the app existed. Stopbench startand start it again.- Look in
~/frappe-bench/logs/for the newest error. Post it on discuss.frappe.io with your versions (bench version).