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.

The easy way, at least for me, was via a custom function in filters — because it’s simple to do, the OAuth token you create isn’t time-limited, 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. (Sorry, I don’t know why you wouldn’t always choose the ‘ALL’ flavour.)

      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 THE RELEVANT IDS

You’ll see from the snippet above that this particular API needs your ‘accountId’ to work. Here’s how you get it (Why Zoho makes it so difficult, I don’t know!)


      1)    You can get all your relevant 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. 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).


I created a custom function (see below) to make the API call and email me the result. I was then able to search for ‘zuid’, ‘zoid’ & ‘accountId’ to get the required numbers.

      2)    If you only want your Zoho User ID (ZUID). you don’t need an API call. Just log into Zoho and click the ‘My Profile’ icon (top right). Your user ID is right there under your name and email address.


      3)    Zoho advises an API call to get your Zoho Organisation ID (ZOID). But, again, there’s an easier way: 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 your Zoho Organization ID under the heading ‘Organization Info’.


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, this is the API.

      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


Custom function to get account IDs:

url = "https://mail.zoho.eu/api/accounts";

response = invokeurl

[

            url :url

            type :GET

            connection:"your_oath_token" // the link name (in quotes) for the OAuth Token you created 

];

sendmail

[

            from :zoho.loginuserid

            to :"you@youraddress" // your email address in double quotes

            subject :"accounts" // or whatever subject you want

            message :response

]


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.
    • Topic Participants

    • zoho

    • 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

    • Closing Accounting Periods - Invoice/Posting dates

      Hi, I have seen in another thread but I'm unsure on how the 'transaction locking' works with regards to new and old transactions. When producing monthly accounts if I close December 24 accounts on 8th Jan 25 will transaction locking prevent me from posting
    • How to update/remove file in zoho creator widgets using javascript API

      Hi Team, I have developed a widget which allows inserting and updating records I have file upload field with multiple file upload. Now while doing insert form record, I am using uploadFile API to upload files for that record. I am using updateRecord API
    • Sheet View in CRM portal

      Hi, When will it be possible for my CRM portal users to edit/add records with Sheet View? George
    • issue with image thumbnails not showing in Image Selector

      We have been using Zoho Campaigns for over a year, maybe close to two years, and this issue just started happening in the last month. I wanted to wait to see if it would resolve on it's own, and it doesn't seem to be. The thumbnail images for all new
    • Deluge Script for adding tag

      Trying to create a custom function where a tag is added to a record - but for the life of me, I cannot figure out how. Help please! Moderation Update: Adding the help doc and sample to add Tags to records via deluge here for everyone's benefit. tag1 =
    • Unlock your Zoho Vault with OneAuth, Windows Hello, TouchID, YubiKey, and many more!

      Hello everyone, We are thrilled to introduce one of the most highly requested features – the ability to unlock your Zoho Vault using various authenticators. The primary purpose of a password manager is to remember just one master password and securely
    • Blueprint or Validation Rules for Invoices in Zoho Books

      Can I implement Blueprint or Validation Rules for Invoices in Zoho Books? Example, use case could be, Agent confirms from client that payment is done, but bank only syncs transactions tomorrow. in this case, Agent can update invoice status to done, and
    • Creator roadmap for the rest of 2022

      Hi everyone, Hope you're all good! Thanks for continuing to make this community engaging and informative. Today we'd like to share with you our plans for the near future of Creator. We always strive to strike a good balance of features and enhancements
    • How can I get base64 string from filecontent in widget

      Hi, I have a react js widget which has the signature pad. Now, I am saving the signature in signature field in zoho creator form. If I open the edit report record in widget then I want to display the Signature back in signature field. I am using readFile
    • Add Setting Values to the Rules

      Hi, It would be great to use the rules to set values in fields for submission, such as if a Type is X then set the Field Y to 10. Thanks Dan
    • So we ran with it for the week

      In our company i bit the bullet and ran with FSM for a whole week. Service calls, deliveries and surveys. Covering about 30-120 miles a day to domestic properties. Loved the appointment list and satnav integration. Loved the timer to measure the appointments.
    • Is there a way to set Document Owner/Sender via the API

      When sending requests for zoho sign, it would seem zoho uses the id of the person that created the zoho api cred to determine the owner_id, is there a way to set a default for this?
    • What's New - September 2025 | Zoho Backstage

      September has been a different month for Zoho Backstage. Instead of rolling out a long list of new features, we focused on something just as important: Performance, reliability, and stability The event season is in full swing, and organizers are running
    • Prevent stripping of custom CSS when creating an email template?

      Anyone have a workaround for this? Zoho really needs to hire new designers - templates are terrible. A custom template has been created, but every time we try to use it, it strips out all the CSS from the head.  IE, we'll define the styles right in the <head> (simple example below) and everything gets stripped (initially, it saves fine, but when you browse away and come back to the template, all the custom css is removed). <style type="text/css"> .footerContent a{display:block !important;} </style>
    • Stock Quotes/Spreadsheet

      It would be nice if we could download security and mutual fund prices from Yahoo Finance (or?) in order to maintain an up to date investment portfolio on Zoho. Any chance?
    • link to any Belgian bookkeeping software?

      Hello, Does anyone on this Forum can help me with the question whether the ZOHO CRM (Invoices) or ZOHO Book can be linked to software that is used for Belgian Bookkeeping/accountancy? By linking, I mean either with the help of a middleware program or either by the ability to export the custom made reports as CSV-files... If someone has an experience with online CRM-Accountancy in Belgium, with ZOHO (or other), it would be great to read it... Thank you
    • marketing automation

      wants to know about the zoho marketing automation
    • Create custom rollup summary fields in Zoho CRM

      Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
    • Problems with email templates (HTML - Outlook)

      Hi there, I've been trying to create a newsletter from the template "Business 4". Everything looks great in the preview, but when I send it to my Outlook inbox, the layout doesn't seems to stick. More particularly: - The line-height is way more reduced, even though I used the line-height tool from the template - Columns but they are sometimes misaligned - Font size is not always the one I've selected. Could you help? Thanks!
    • Zoho CRM IP Addresses to Whitelist

      We were told to whitelist IP addresses from Zoho CRM.  (CRM, not Zoho Mail.) What is the current list of IP Addresses to whitelist for outbound mail? Is there a website where these IP addresses are published and updated?  Everything I could find is over
    • How to create a drop down menu in Zoho Sheets

      I am trying to find out, how do I create a drop down option in Zoho sheet. I tried Data--> Data Validation --> Criteria --> Text  --> Contains. But that is not working, is there any other way to do it.  Thanks in Advance.
    • Introducing Keyboard Shortcuts for Zoho CRM

      Dear Customers, We're happy to introduce keyboard shortcuts for Zoho CRM features! Until now, you might have been navigating to modules manually using the mouse, and at times, it could be tedious, especially when you had to search for specific modules
    • Zoho CRM's custom views are now deployable from sandboxes

      This feature is now available for users in the AU, JP, and CN DCs. This feature is now available for users in CA and SA DCs. New update: This feature is now available for users in all DCs. Hello everyone, We're excited to announce that you can now deploy
    • Where are Kanban swimlanes

      So i've been playing with Zoho Projects Kanban view a bit more. It appears that task lists are being used as the Kanban columns, which makes sense from the implementation point of view but not the logical one.  Kanban columns are statuses that a task can flow through, while a task list has been a logical way to organize related tasks and relate them to a mislestone. In other words a task in a particular task can go through several stages while remaining in the same task list. After doing some research
    • Send Automated WhatsApp Messages and Leverage the Improved WhatsApp Templates

      Greetings, I hope all of you are doing well. We're excited to announce a major upgrade to Bigin's WhatsApp integration that brings more flexibility, interactivity, and automation to your customer messaging. WhatsApp message automation You can now use
    • Scheduling Calls in CommandCenter / Blueprints

      I would love it if you could add a function to schedule a call in the lead's record for a future date. I know you can add a Task by going to Instant Actions > Task and completing the form: These tasks go into the lead's record under Open Actions. But
    • Zoho One - Syncing Merchants and Vendors Between Zoho Expense and Zoho Books

      Hi, I'm exploring the features of Zoho One under the trial subscription and have encountered an issue with syncing Merchant information between Zoho Expense and Zoho Books. While utilizing Zoho Expense to capture receipts, I noticed that when I submit
    • Limit in number of records for subforms and multi-select lookup fields

      It is my understanding that a maximum of 100 items can be selected in a multi-select lookup field, and that a total of 200 items can be selected in total between both subforms in a given module.  Are there any ways to work around this limitation if we
    • Kaizen #136 - Zoho CRM Widgets using ReactJS

      Hey there! Welcome back to yet another insightful post in our Kaizen series! In this post, let's explore how to use ReactJS for Zoho CRM widgets. We will utilize the sample widget from one of our previous posts - Geocoding Leads' Addresses in ZOHO CRM
    • Getting Permission denied to access this portal.

      We have one user that can't login to projects even though access has been granted. This user can login to accounts.zoho.com but when login to https://projects.zoho.com/portals.do we get this error: Unauthorized login to this portal Permission denied to access this portal. Check your portal URL again. Sometimes we also get "server too busy". We have tried killing sessions (in accounts.zoho.com) and we have deleted cookies; and tried different computers and still the same problem. All others use can
    • Marketing Tip #1: Optimize item titles for SEO

      Your item title is the first thing both Google and shoppers notice. Instead of a generic “Leather Bag,” go for something detailed like “Handcrafted Leather Laptop Bag – Durable & Stylish.” This helps your items rank better in search results and instantly
    • Does Zoho Docs have a Line Number function ?

      Hi, when collaborating with coding tasks, I need an online real time share document that shows line numbers. Does Zoho's docs offer this feature ? If yes, how can I show them ? Regards, Frank
    • Setting Default Views for Custom, List and Detail Views

      Hey, Is it possible to set a default custom view, list view and detail view for a module for every user? We are onboarding a lot of non technical people that struggle with these things. Setting the views as default would really help. Btw: also setting
    • Custom function return type

      Hi, How do I create a custom deluge function in Zoho CRM that returns a string? e.g. Setup->Workflow->Custom Functions->Configure->Write own During create or edit of the function I don't see a way to change the default 'void' to anything else. Adding
    • Filter Based API request in Zoho Books using POSTMAN

      How do I GET only specified CONTACTS based on created time or modified time in Zoho Books using POSTMAN. In the api documentation, it is written we can apply filters but I need a sample request.
    • URL validation

      We use an internal intranet site which has a short DNS name which Zoho CRM will not accept.   When attempting to update the field it says "Please enter a valid URL". The URL I am trying to set is http://intranet/pm/ Our intranet is not currently setup with a full DNS name and given the amount of links using the shortname probably isn't a feasible change for us.
    • Has anyone been experiencing slow issues?

      Dear all, I just want to ask if anyone has been experiencing slow issues with Zoho Creator in the past two weeks? I worked with the ISP to improve network quality by changing routes and upgrading bandwidth, but nothing changed. I am in Vietnam.
    • Zoho Projects Roadshows 2025 - USA

      Dear Users, After an amazing response to our roadshows in 2024, we are excited to be back for the second year in a row! Join our team of experts as they walk you through the most-used features in Zoho Projects, explore powerful automation capabilities,
    • Billing Management: #6 Usage Billing in SaaS

      Imagine a customer shuffling across multiple subscriptions, a streaming service, a music app, cloud storage, and a design tool. Each one charges a flat monthly fee, regardless of how much or how little they use. Some months, the customer barely opens
    • Is there anyone who has been experiencing issues regarding the Zoho Creator Certification Website in the past 2 weeks?

      Dear all , I just wanted to ask is there anyone who was planning on taking the Zoho Creator Developer Certification Test in the past 2 weeks and have been facing errors stating that the website is under maintennance and also not allowed to access the
    • Next Page