ZOHO CRM Sandbox Environment and API Calls

ZOHO CRM Sandbox Environment and API Calls

Hello everyone!

Welcome back to another post in our Kaizen series. This week, we will discuss in detail about the sandbox environment in Zoho CRM, and how to make API calls to the sandbox orgs.

Environments in Zoho CRM

Zoho CRM empowers your business with robust developer tools. But what if you want to experiment without affecting your live data? Or if you want to try out a widget or a workflow before pushing them live to your customers? We have got you covered with our environment options.

Zoho CRM offers three environments:

Production - The production environment is your live CRM account, which you use for business operations. 
Developer - This environment acts as a playground for developers to build and test custom integrations and apps. Changes made here cannot be directly applied to the production account.
Sandbox - This is a secure testing ground where you can experiment without disrupting your live production environment. Tinker with settings, workflows, and features without disrupting your live data. Test, identify issues, and perfect your changes before deploying them to your production environment.

Creating a Sandbox:

CRM admins can create multiple sandboxes in one account for independent testing of different configurations. The number of sandboxes allowed depends on your CRM edition. You can create a sandbox from Setup > Data Administration > Sandbox. For more details on the available configurations and settings, refer here. Note that the sandbox environment is exclusive to the enterprise and above editions.


Once your sandbox accounts are set up, you can view them at CRM Setup > Data Administration > Sandbox.  Access the sandbox organization you want, and you can go about working in the sandbox in the same way you would work in the production setup.  You can make the necessary changes, utilize sandbox data for validation, and, once satisfied, deploy them to the production environment.

Making API calls in the Sandbox environment

  1. Register your application : Before you get started with authorization and make any calls using the Zoho CRM APIs, you need to register your application with Zoho CRM. Follow the steps explained in this document to register your application.
  2. Generate grant token : To use the Zoho CRM APIs, you must authenticate the application to make API calls on their behalf with an access token. The access token, in return, must be obtained from a grant token (authorization code). Choose the desired organization under the sandbox environment from the list displayed when generating the grant token. For more details on how to generate a grant token, please refer to this document.


  3. Generate Access Token and Refresh Token : OAuth2.0 requests are usually authenticated with an access token, which is passed as bearer token. Use your domain-specific Zoho Accounts URL https://accounts.zoho.{domain} to generate the tokens.


  4. Identifying token environment (optional) : With the access token in hand, you might wonder: Which environment does this token belong to? This can be determined using the Organization API using https://www.zohoapis.{domain} regardless of the token's environment. The type key in the API response contains information regarding the environment linked to the access token - production, developer, or sandbox. Please note that this functionality is supported only from Zoho CRM API version 6 onwards.


  5. Making API calls :  Now that you know the token's environment, use the sandbox-specific URL https://sandbox.zohoapis.{domain} for API calls to the sandbox environment. Please note that attempting calls using tokens generated for other environments will result in a DOMAIN_TOKEN_MISMATCH error.

Points to remember :

  • Generate the grant token for the corresponding sandbox organization to avoid the DOMAIN_TOKEN_MISMATCH error.
  • The accounts URL for generating tokens remains the same  for both sandbox and production environments - https://accounts.zoho.{domain} .
  • The Get Organization API response includes a type key, which contains information regarding the environment your access token is authorized for (production, developer, or sandbox).

Multiple Sandbox Accounts and API Calls

Each sandbox environment within your Zoho CRM account acts as a separate organization. To ensure your API calls land precisely where intended, follow these guidelines:
  • Separate Grant Tokens for Each Organization : You should generate separate grant token for each organization, whether within a sandbox environment or the production environment.
  • API Call URL for All Sandboxes: The API call URL remains consistent for all sandboxes: https://sandbox.zohoapis.{domain}. However, to target a specific sandbox organization, you must generate the grant token specifically for that organization.

Frequently Asked Questions

Q. How many sandboxes can I have in my Zoho CRM account?
A. The number of sandboxes you can have depends on your Zoho CRM edition. Please refer to this document to know the specific limits.

Q. Do sandbox API calls affect my production data?
A. No, API calls made from the sandbox environment are isolated from your production data.

Q. Do I need different account URLs for generating tokens in sandbox and production?
A. No. Use the same URL, https://accounts.zoho.{domain}, for both environments.

Q. Can I use the same access token for API calls in both the sandbox and production environments?
A. No, each organization in each environment requires its own access token.

Q. Is there a specific URL for making API calls from the sandbox environment?
A. Yes, use https://sandbox.zohoapis.{domain} for sandbox calls.

Q. How do I find if the token is generated for the sandbox or any other environment?
A. In order to find whether a token is generated for a sandbox or other environment, kindly use the Organization API which will return the type for which the token is generated.  Please note that this support is available from V6 only.

Q. What does the "DOMAIN_TOKEN_MISMATCH" error indicate during API calls in the sandbox environment?
A. This error occurs when using tokens from a different environment or domain in your API calls. For example, you will get this error if you attempt to use an access token generated for the production environment in the sandbox environment

Q. Do I need to register my application differently for the sandbox environment?
A. No, you use the same application registration process for both sandbox and Production environments. However, you need to generate separate grant tokens for each environment.

Q. Do I need to use different client IDs and client secrets for the sandbox environment compared to production?
A. No, you can use the same client ID and client secret for both environments. However, you'll need to generate separate access tokens for each org.

We hope that you found this post useful. Let us know your thoughts in the comment section or reach out to us at support@zohocrm.com.

Stay tuned for more insights in our upcoming Kaizen posts!

Happy Coding!




      Zoho Developer Community









                                Zoho Desk Resources

                                • Desk Community Learning Series


                                • Digest


                                • Functions


                                • Meetups


                                • Kbase


                                • Resources


                                • Glossary


                                • Desk Marketplace


                                • MVP Corner


                                • Word of the Day



                                    Zoho Marketing Automation


                                            Manage your brands on social media



                                                  Zoho TeamInbox Resources

                                                    Zoho DataPrep Resources



                                                      Zoho CRM Plus Resources

                                                        Zoho Books Resources


                                                          Zoho Subscriptions Resources

                                                            Zoho Projects Resources


                                                              Zoho Sprints Resources


                                                                Qntrl Resources


                                                                  Zoho Creator Resources



                                                                    Zoho WorkDrive Resources



                                                                      Zoho Campaigns Resources


                                                                        Zoho CRM Resources

                                                                        • CRM Community Learning Series

                                                                          CRM Community Learning Series


                                                                        • Tips

                                                                          Tips

                                                                        • Functions

                                                                          Functions

                                                                        • Meetups

                                                                          Meetups

                                                                        • Kbase

                                                                          Kbase

                                                                        • Resources

                                                                          Resources

                                                                        • Digest

                                                                          Digest

                                                                        • CRM Marketplace

                                                                          CRM Marketplace

                                                                        • MVP Corner

                                                                          MVP Corner





                                                                            Design. Discuss. Deliver.

                                                                            Create visually engaging stories with Zoho Show.

                                                                            Get Started Now