A Deluge custom function that tries to list mail-merge templates returns a scopes or access error when the Deluge connection or OAuth token does not include the CRM "settings" scope required to read templates stored under Settings, or when the connection user lacks template permissions. This prevents Deluge from calling the CRM settings endpoint that exposes mail-merge templates.
What it means — concrete explanation tied to the Zoho API surface
Mail-merge templates are exposed through the CRM Settings API rather than a regular module API, so Deluge calls that read templates hit the Settings endpoint and require settings-level OAuth scopes (for example ZohoCRM.settings.ALL). If your Deluge connection token lacks that scope, the API returns an OAuth scope or permission error when you try to list mail-merge templates via a custom function [8][1].
Common causes
- The Deluge connection or OAuth token does not include the CRM settings scope (for example ZohoCRM.settings.ALL) so the Settings endpoint rejects the call [8].
- The connection was created by a user who lacks "Manage Templates" or administrative rights, so templates in Settings are not visible to that token [8].
- You used only granular mailmerge or module scopes but not the broader settings scope; granular scopes don't always cover Settings endpoints [8][1].
- Template-level limits or malformed template content cause template-related errors when listing or using templates (separate template errors are documented in CRM help) [7].
How to fix it
- Identify the connection your custom function uses. Open the Deluge function in CRM and note the "connection" name it references.
- Revoke and reauthorize that connection with a settings scope. In your connection settings (the connection used by the custom function or your self-built OAuth client), add ZohoCRM.settings.ALL (or the minimal Settings scope your app requires) and re-grant consent. If you use a custom OAuth client, include the settings scope in the scope list and request a fresh access token. This step fixes OAUTHSCOPEMISMATCH when calling Settings endpoints [8].
- Confirm the connection user has template permissions. Re-create/re-authorize the connection using an admin or a user who can Manage Templates in CRM so the token can view Settings resources [8].
- Test with a minimal API call from Deluge. Run a small function that hits the Settings templates endpoint and log the HTTP response code and body to confirm success. If you still get 403/401, inspect the token scopes returned by the token introspection or reauthorize again.
- If listing succeeds but specific templates fail, check template content and limits (character count, product table format). Fix or recreate templates that exceed known limits or contain bad HTML as documented in CRM Template troubleshooting [7].
When to escalate
If you have reauthorized with ZohoCRM.settings.ALL and verified the connection user has admin/template permissions but still get scope or 403 errors, escalate to Zoho Support with the connection