Get Zoho Mail API working (including DRE Connector, Oauth Token, ZUID, ZOID & ACCOUNT_ID)

Get Zoho Mail API working (including DRE Connector, Oauth Token, ZUID, ZOID & ACCOUNT_ID)

Disclaimer: I’m not a professional coder!



Do you need to use Zoho Mail API?


Me too. It lets you do all sorts of things — like reading the complete header of an email, or forwarding an email with its attachments — which is what I wanted to do.


But setting up the API (application programming interface) took me hours.


It didn’t need to, but advice on this forum sent me in circles and, while the Knowledgebase probably has all the information, it’s not easy to determine which are the relevant bits. So…


Maybe this little guide will help you.

       To use Zoho Mail API you need:

a) A working OAuth Token (Open Authorization token)

b) Up to three Zoho IDs — User, Organization, Account

c) Depending on what you want to do, additional IDs for emails, folders, etc


OAUTH TOKEN


The token validates you when you make an API call. There are various ways to create it.

The hard way: it’s possible to create an OAuth token via Developer Space but this requires lots of options to be chosen and the OAuth token needs to be frequently refreshed. This route is intended for developers who are using external apps to link with Zoho.


The easy way, at least for me, was via a custom function in filters — because it’s simple to do, refreshing the OAuth token is handled by Zoho, and creating a custom function is what I was trying to do anyway


If you already have an OAuth token, great. If not, but have already created a custom function, jump to 4 below. Alternatively:


      1)    In Zoho Mail, go to settings/filters

      2)    Create a new filter and, under Actions, select ‘Custom Function’. Zoho help file here.

      3)    Click ‘Select Function’ and create a new function or use an existing one

      4)    Once the custom function is on screen, select ‘DRE Connectors’ (Deluge Runtime Environment) at the top right

      5)    Click ‘Create Connection’ and under ‘Default Services’ choose ‘Zoho OAuth’

      6)    ‘Connection Name’ can be anything you like. It’s the ‘Connection Link Name’ that you will use in your Deluge scripts.

      7)    Chose the ‘Scopes’ of your token. There are zillions of them and they determine what your script can and can’t do. The most basic might be ‘ZohoMail.messages.READ’. The API Guide Index lists every API command and, for each, details what scope you need (e.g. the send an email page shows you’ll need the scope  ZohoMail.messages.ALL or ZohoMail.messages.CREATE). It's good security practice to only use the minimum scope you need.

      8)    After you click ‘Create and Connect’ you should have a working OAuth token with a lowercase ‘link name’ that you can paste into your Deluge scripts.


NB: The OAuth token only applies to the Zoho area where you have your account (Zoho.eu in my case). So, for example, if I cut and paste a snippet into my script from the send an email page: https://mail.zoho.com/api/accounts/{accountId}/messages it will NOT work with my Europe OAuth token. I would need to change the snippet to: https://mail.zoho.eu/api/accounts/{accountId}/messages


GETTING YOUR IDS


Without API

You’ll see from the snippet above that this particular API needs your ‘accountId’ to work. Zoho advises getting your IDs via an API call, but you don't need to:


1)   Zoho User ID (ZUID).  Just log into Zoho and click the ‘My Profile’ icon (top right). Your user ID is right there under your name and email address.

2)  Zoho Organisation ID (ZOID). Open your Zoho Mail Dashboard (remember, this link is for zoho.eu, you’ll need to use your area). Then select ‘Organization’ on the left menu bar to display ‘Organization Info’, including your Zoho Organization ID.

3) Zoho Account ID (ZAID). Select any of your emails in Zoho Mail. Right click and pick 'Open in New Window'. Your Zoho Accound ID is the number following "accId=". (See Zoho's help page to get the message ID of emails — it also shows the accountId.)

With API
Alternatively, you can get all three IDs with one API call: https://mail.zoho.eu/api/accounts (remember to adjust for your area). Help page here for what scope you need for this API call. The call returns a mass of information but buried in it are your Zoho User ID (ZUID), Zoho Organisation ID (ZOID) and Zoho Account ID (ZAID).


So how do I make the API call?

There are various ways but I use a bit of deluge script:

apiUrl = "https://mail.zoho.eu/api/accounts";
response = invokeurl
[
    url :apiUrl
    type :GET
    connection:"your_oauth_token" // the OAuth token you created, in quotes
];
info response;

1) Create a new Zoho Mail custom function and paste in the above script.
2 ) In the function window, click 'Test Run' (top right). You'll be asked for a Message ID.
3) For this script, any message will do. Select any message in your Zoho Mail inbox. Right click and choose 'Open in New Window'. You'll see the Message ID after 'msgId=' in the URL displayed by your browser. See here for visual.
4) Paste the Message ID into the function window and press 'Proceed'. You'll be presented with the heading 'Console' and the result of your API call beneath it, where you'll find the IDs you need after 'zuid=', 'zoid=' and 'accountId='.

FOLDER & EMAIL IDs


      1)    You may be able to use the name of a folder (e.g. “Trash”) in your Deluge script but if you need the folder ID number, either use this API or, even easier, select an email in the folder your interested in, right click and pick 'Open in New Window'. The folder ID comes after 'folId=' in the browser URL.

      2)    All my scripts are triggered by an email by arriving in my inbox. The ID for that current email is held in the variable ‘mail_messageId’.

      3)    For everything else refer to the API Guide Index


Finally, there might be a better way to do any of the above — I did warn you I’m not a pro! — please feel free to add improvements.

    • Sticky Posts

    • Pocket from Mozilla is closing shop. Don’t lose your favorites . Move them to Zoho Mail Bookmarks now! 📥🔖

      The end of Pocket shouldn't mean the end of your important links and content. Easily import them into Zoho Mail's Bookmarks and continue right where you left off. You can bring over your entire Saves, Collections, and tags just the way they are. Bookmarks
    • Zoho Mail POP & IMAP Server Details

      Hello all! We have been receiving a number of requests regarding the errors while configuring or using Zoho Mail account in POP/ IMAP clients. The server details vary based on your account type and the Datacenter in which your account is setup. Ensure
    • Workplace - Zoholics Europe Customer Awards

      Dear Zoho Mail Community! 📣 We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! Workplace - Zoholics Europe Customer Awards This is your chance to shout about the amazing
    • Important update on Group Management | Zoho Mail

      Dear Zoho Mail Community, This post is to inform you all of the following updates on the Group Management in Zoho Mail. Group Member Addition: If a group member is added to an organization group in a Zoho Application, the member will be automatically
    • Mastering email etiquette and best practices to follow in Zoho Mail

      Hello Zoho Mail Community, We’re thrilled to invite you all to our upcoming webinar: Mastering email etiquette and best practices to follow in Zoho Mail. Join our live webinar for expert etiquette tips to enhance your professionalism and elevate your
    • Recent Topics

    • Incoming Threads Report

      From data to decisions: A deep dive into ticketing system reports Customers raise questions and issues through multiple channels, such as email, chat, or tickets. To monitor the number of queries received on a specific day from each channel, leads can
    • Block opening tickets vía email DESK

      Hello, I want to block the functionality of opening tickets when someone send an email to our support email address. Actually everybody in the world can open a ticket in our systen just sending an email to our support email address I don´t want this feature!!!!
    • Autocomplete by email address

      Hi, Is it possible to add contacts via autocomplete using the email address? I have tried a number of contact option variations and cannot seem to get it to work, having this as an option would speed up composing an email greatly. thanks Ben
    • GEO and Zoho Desk

      Has anyone done anything with GEO (generative engine optimization) and zoho desk KB? Are there any plans from Zoho on adding the ability in inject GEO scripts in KB Articles?
    • Switch between multiple LLMs instantly for tailored Zia experiences

      Availability Editions: Professional , Enterprise, Ultimate , CRMPlus , ZohoOne Release Plan: Available for all DCs Hello everyone. Earlier, the Multi-LLM feature supported only one LLM at a time for Zia Record Assistant bot restricting flexibility from
    • Subscriptions for service call

      So we install products and we want to offer a service contract for the customers yearly service calls to be billed monthly. So ideally at some point we want to email them a quote for their needs. WE will choice it our end based on the equipment. It would
    • PHPMailer "Connection refused (111)" Error Despite Outbound Ports Being Open

      Hello everyone, I'm trying to send emails via Zoho SMTP using PHPMailer on my shared hosting environment. I've tried both port 465 (ssl) and 587 (tls), and I even added SMTPOptions to bypass SSL verification just in case it was an SSL certificate issue.
    • Power up your Kiosk Studio with Real-Time Data Capture, Client Scripts & More!

      Hello Everyone, We’re thrilled to announce a powerful set of enhancements to Kiosk Studio in Zoho CRM. These new updates give you more flexibility, faster record handling, and real-time data capture, making your Kiosk flows smarter and more efficient
    • Cliq iOS can't see shared screen

      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
    • Rename system-defined labels in Zoho CRM

      Renaming system-defined labels is now available across all DCs. Hello everyone, Zoho CRM includes predefined system fields across modules to support essential CRM operations. Until now, the labels of these fields were fixed and could not be edited from
    • What happens to my current site SEO if i opt for zoho creator?

      I have an existing website and I need to use Zoho creators for the rapid creation of my webpage creation. Currently, my IT team is creating the web pages, but I am concerned about the SEO of my current website if I shift to zoho will i loose it all?
    • Filter Pivot Chart by Criteria

      Hey There Amazing Zoho Team, I wanted to see if there is a way to filter criteria a "Pivot Chart" report in the same way I can filter "List", "Calendar", & "Summary" reports. Example: I can filter a normal report like this: http://monosnap.com/image/y5q0XGzDSGZpsnOjuBYpdeUOFtSmFd I would like to do the same with a "Pivot Chart".  What I've Tried: Filters and User filters are not what I am looking for. That just filters the data. I want to be able to filter criteria the data by connected forms. Like
    • Big Time HELP

      I am old, disabled and need to speak to a person. I needed to use a service to copy my zoom contacts to. I think I signed up for a security service, which I do not need. I don't know enough to choose from your many lists or how to see what I have and
    • #4 Setting Up Your Client the Right Way

      Creating invoices without properly setting up the customer can quickly lead to several inconsistencies, such as duplicate records, missing billing details, and poor customer management. This becomes even more important for businesses that use a connected
    • Functionality based URL to find records due today or in the next week

      I need to construct a URL to filter a view to records where the evaluation is due soon (i.e. in the next 7 days). To me, that includes today, but Zoho has a different opinion. Zoho defines 39 as NEXT_7_DAYS but this gives unexpected results. https://creatorapp.zoho.eu/...#Report:My_Evaluations?Evaluation_due_by_op=39
    • Email Parameter in Create Lead API

      In the Create Lead API , the email parameter as mandatory. This is creating issues because many leads only have mobile numbers and no email address. This is especially a problem for businesses focusing on WhatsApp marketing in Zoho Marketing Automation,
    • Automatic Email Alerts for Errors in Zoho Creator Logs

      Hello, We would like to request a feature enhancement in Zoho Creator regarding error notifications. Currently, Zoho Creator allows users to view logs and errors for each application by navigating to Zoho Creator > Operations > Logs. However, there is
    • Filter our rejected quote items from the inventory quote template

      Hello, I am trying to have rejections at the line level on my quotes so I can track what items are often removed, I do not want to claim the whole quote as lost just the individual items for better data tracking. However I cannot figure out how to filter
    • Configuring ZMA Webhook for Zoho Flow : Missing Key Information Error

      I'm looking to send a webhook to Zoho Flow at the end of a Marketing Automation journey in order to perform more actions that I can't do with just a journey. I have the Webhook created in Flow and set up in ZMA, however when I test it I get the error
    • Improve Zoho Vault search

      Hello, we started using Zoho Vault and we really appreciate the app. At the moment, when searching passwords, the search query only targets the password name. I think having the query search among Name, User name, URL, Notes and Tag would be a better
    • NEED HELP

      I have below data po no invoice no Party inv date value status 1 aa1 ABC 01-May-26 100 Under Cr 2 aa2 XYZ 02-May-26 200 Over Due 3 aa3 ABC 02-May-26 300 Under Cr 4 aa4 XYZ 03-May-26 400 Under Cr I need result as below using formulas (not Pivot table)
    • Ask the Experts 29: Knowledge Base, Community, and AI for smarter user education

      Hi Everyone, Welcome to Ask the Experts (ATE) 29, a live panel discussion. After the engaging text-based discussions in ATE 27 on onboarding and managing agents and ATE 28 on handling customer support with AI, we’re bringing you the next round of ATE
    • Bigin, more powerful than ever on iOS 26, iPadOS 26, macOS Tahoe, and watchOS 26.

      Hot on the heels of Apple’s latest OS updates, we’ve rolled out several enhancements and features designed to help you get the most from your Apple devices. Enjoy a refined user experience with smoother navigation and a more content-focused Liquid Glass
    • Tables for Europe Datacenter customers?

      It's been over a year now for the launch of Zoho Tables - and still not available für EU DC customers. When will it be available?
    • Smart Feature Compatibility Indicators for CRM Field

      Zoho CRM offers a wide range of field types and advanced customization options. However, several field types have feature-specific limitations that are currently documented only in help articles. For example, while configuring a Rich Text field, admins
    • 📢 Coming Soon: Daily Rate Projects

      Hello everyone, We're excited to announce a long-awaited, new billing type for projects: Daily Rate! Until now, projects supported Fixed Cost and Hourly Rate billing. With this update, you can now create projects billed on a daily rate, making it easier
    • 📢 Coming Soon: Daily Rate Projects

      Hello everyone, We're excited to announce a long-awaited, new billing type for projects: Daily Rate! Until now, projects supported Fixed Cost and Hourly Rate billing. With this update, you can now create projects billed on a daily rate, making it easier
    • Cannot find IMAP/SMTP enable toggle in new Mail Admin UI - Mail Lite plan

      Hi Zoho team, I'm the org Super Admin for owlmind.dev (Mail Lite plan, 3 paid users): - champ@owlmind.dev (Super Admin) - isfand@owlmind.dev - team@owlmind.dev I need to enable IMAP and SMTP access for all 3 users (we're integrating with Smartlead for
    • Kaizen #242 - Enabling In-Context Order Creation from Deals Using SlyteUI

      Hello everyone! Welcome to another interesting Kaizen post. Today’s spotlight is on SlyteUI, the new UI builder designed to create powerful, intuitive user interfaces in minutes. Built for speed and simplicity, SlyteUI empowers teams to deliver high-impact
    • Zoho Books | Product updates | May 2026

      Hello users, We're back with the latest updates and enhancements we've rolled out in Zoho Books. From sales tax automation to scanning receipts for free, explore the updates designed to upgrade your bookkeeping experience. Sales Tax Automation [US & Canada
    • No ingresan correos

      desde el 28 de abril no ingresan correos, por favor me puedes ayudar
    • How to update image in a Zoho Creator report through widgets (JS API)

      I need help with how to transfer an image file from one report to another in Zoho Creator using widgets (JS API). Say I'm fetching a record from the All_Products report. And this report contains a Product_Image field. I then want to transfer this Product_Image
    • Issue with Sending and Receiving Emails in Zoho Mail

      Dear Zoho Support Team, I am facing an issue with my Zoho Mail account. I am unable to receive emails from others, and also when I try to send emails, they are not getting delivered. This is affecting my daily work, so I request you to please check and
    • Adding an element to the Creator Canvas will automatically adjust its dimensions.

      I designed a report with fixed dimensions using Creator Canvas. However, whenever I add a new element, the system automatically adjusts the dimensions, even if the new element fits perfectly within the set boundaries. This is quite frustrating. Has anyone
    • Installing/Using Python Package in Zoho Creator

      Hi, I have a Python function in my ZC application that depends on a specific Python package.  If I was running this on my own server, I would just install the package using pip (e.g. pip3 install stripe). Is there a way to install the package in my ZC
    • I dont have acess to my own domain emails

      an agency made these 3 emails for us , including the one im using here. but the super admin access is through the agency email. i want to reclaim my admin console access to these emails. how can i contact zoho support?
    • Domain Activation Pending

      Hello Zoho Support, I have resent the domain activation email for abovecapital.online several times, but I still have not received the activation link. Please check the email delivery status and help me resend the activation email or update the registrant
    • Zoho Webinar - Sharing System Audio (NOT AVAILABLE)

      Hi, We are having a serious problem with Zoho Webinar. In the webinars we run, we very often share the audio from a video we are streaming directly from YouTube or other applications. Until recently we were using Zoom, but as we use other Zoho applications
    • IP blocked on SMTP

      Please unblock my server IP: 135.181.19.115 We are using WP Mail SMTP for legitimate transactional emails.
    • Zoho rejecting external email – “Email policy violation detected”

      Hello, I was informed by external senders that their emails to my addresses were rejected by Zoho Mail. The emails were sent from external domains (including pfms.ba.gov.br domains), not from my own domain. However, Zoho rejected the messages with the
    • Next Page