Frequently Asked Questions on GraphQL APIs | Kaizen Series | Zoho CRM

Frequently Asked Questions on GraphQL APIs | Kaizen Series | Zoho CRM

🎊 Nearing 200th Kaizen Post – We want to hear from you!
Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone. 

Hi all,
Hello and welcome to another week of Kaizen!
In this post, we will be discussing Frequently Asked Questions on Zoho CRM GraphQL APIs.  GraphQL is a query language that provides a more flexible and efficient way to access data and metadata within your Zoho CRM organization. 

Why should I try GraphQL APIs?

 Using GraphQL with Zoho CRM allows you to fetch exactly the data you need in a single request, reducing over-fetching and under-fetching. It also enables you to combine multiple operations in one request, which can improve performance and reduce network overhead.

How do I authorize GraphQL requests?

Similar to Zoho CRM REST APIs, GraphQL APIs use OAuth 2.0 for authorization.
For self-clients, you can use the self-client option in the API console to get an authorization grant code. This code can be exchanged for an access token and a refresh token. Once you receive the access token, send the token in your HTTP authorization header with the value "Zoho-oauthtoken {access_token}" for each request. Check out our Postman collection for GraphQL APIs for examples.

Are GraphQL APIs available for all Zoho CRM editions?

GraphQL APIs are available in Enterprise, Zoho One Enterprise, CRM Plus and Ultimate edition of Zoho CRM. Note that it is not available in any trial editions.

What is the difference between REST APIs and GraphQL APIs?

REST APIs let clients talk to servers using standard HTTP methods such as GET, POST, PUT, PATCH, and DELETE. Instead of fetching a fixed dataset like with REST, GraphQL APIs allows you to ask for precisely the data you want. We have covered this topic in detail in our previous Kaizen post that compares REST APIs and GraphQL APIs

Do I need to do any initial setup to start using GraphQL APIs?

To start using GraphQL APIs, you have to enable GraphQL APIs for your Zoho CRM profile through the enable GraphQL API call. 
  • Request URL : {api-domain}/crm/graphql/actions/enable
  • Method : POST
  • Scope: ZohoCRM.GraphQL.UPDATE
This API call generates the GraphQL schema. GraphQL schema defines the capabilities of a server, the data it contains and the actions that can be done on it. Note that it is sufficient to invoke this API call once for each profile

What are the operations supported in Zoho CRM GraphQL APIs?

   Currently, Zoho CRM GraphQL APIs support only query operations. Query operation is analogous to the GET method in REST APIs.

How do I configure requests for Zoho CRM’s GraphQL APIs?

How do I write a basic query in GraphQL? 

The below query can be used to fetch Last_Name in Leads module.

Request body 

query {

    Records {

        Leads {_data {Last_Name {value}}}

    }

}

 

Output 

{"data":{"Records":{"Leads":{"_data":[

  {"Last_Name":{"value":"Kitzman"}},

  {"Last_Name":{"value":"Frey"}}

  // ...

]}}}}


What are the supported metadata types that can be fetched using GraphQL APIs?

Using GraphQL APIs you can fetch metadata from Modules, Users, KanbanView, UserProperties, ProfilePermissions, Profiles, Rolesand Widgets

Can I fetch metadata and data of a particular module in a single query using GraphQL APIs?

Yes, using GraphQL it is possible to fetch both metadata and data in a single query. 
 For example, the below query can be used to fetch Last_Name from Leads module and metadata information of the Last_Name field in the Leads module.

Request body

{

  Records {

    Leads { _data { Last_Name { value } } }

  }

  Meta {

    Modules(filter: { api_name: "Leads" }) {

      _data {

        fields(filter: { api_names: "Last_Name" }) {

_data {

                        id

                        api_name

                        display_label

                        json_type

                        data_type

}}}}}}

 

 Output 

{

  "data": {

    "Records": {

      "Leads": {

        "_data": [

          { "Last_Name": { "value": "Kitzman" } },

          { "Last_Name": { "value": "Frey" } }

          // ...

        ]

      }

    },

    "Meta": {

      "Modules": {

        "_data": [

          {

            "fields": {

              "_data": [

                {

                  "id": "6660682000000002595",

                  "api_name": "Last_Name",

                  "display_label": "Last Name",

                  "json_type": "string",

                  "data_type": "text"

   }]}}]}}}}

 

We have covered this in detail in this Kaizen post: Using GraphQL APIs to fetch data in a consolidated way.

Are there any limits applicable for a GraphQL API query?

Yes, Zoho CRM imposes certain limits on the GraphQL API to ensure fair usage. 
  • Credits: A single query can consume up to a maximum of 10 credits
  • Complexity: Complexity is a measure of workload a query exerts on the server based on the number of fields and depth of the query. The maximum complexity allowed for a single query is 1000. 
  • Depth: The nesting level of a queried field is referred to as depth. The limit for metadata is seven, and for data is three.
Refer to the official documentation on GraphQL credits.

Is it possible to retrieve selective data using GraphQL APIs?

Records

You can use the where argument to filter records from each module.  Each field can support type specific operators and can be combined with Boolean logic and wildcards.

For example. to fetch Email, Last_Name, ID, Phone and Mobile of  contacts where last name starts with "Ni" and mobile contains the digit 5 or phone number equals 555-678-9999

Request body

{

  Records {

    Contacts(where: {

      and: [

        { Last_Name: { like: "Ni%" } },

        {

          or: [

            { Phone: { equals: "555-678-9999" } },

            { Mobile: { like: "%5%" } }

          ]

        }

      ]

    }) {

      _data {

        Email { value }

        Last_Name { value }

        id { value }

        Phone { value }

        Mobile { value }

  }}}}

 

Introspecting the GraphQL schema in Postman will reveal the details of fields and supported operators for each module. Check out our previous Kaizen, where we explained this using videos.

Metadata

You can use the filter argument to filter metadata resources.

For example, the query below fetches metadata of Deals module and api_name of its layouts and fields

Request body

query {

  Meta {

    Modules(filter: { api_name: "Deals" }) {

      _data {

        id

        singular_label

        plural_label

        layouts {

          _data {

            id

            api_name

          }

        }

        fields {

          _data {

            api_name

     }}}}}}

How do I paginate results in GraphQL?

In GraphQL, we use the offset and limit argument to paginate results.
You can use offset to fetch the next page of results by passing the value from your previous response, starting with null for the initial set.  For each page, the number of records has a limit: up to 100 records for root queries or 10 for nested data.
The value to be passed in offset is obtained by querying for previous_offset and next_offset inside _info object.

Is it possible to sort records in GraphQL? 

The order_by argument can be used to sort the response set after fetching records to ascending or descending order.

For example, the below query fetches the fields Deal_Name, Expected_Revenue, and Probability from Deals module in descending order of probability.


Request body

query {

  Records {

    Deals(order_by: { Probability: { order: DESC } }) {

      _data {

        Deal_Name { value }

        Expected_Revenue { value }

        Probability { value }

}}}}

When should I choose Zoho CRM GraphQL APIs over Zoho CRM REST APIs, and vice versa? 

Use Zoho CRM GraphQL APIs when:

  • You need to fetch complex, nested data from multiple resources (e.g., accounts with linked contacts and deals) in a single request and avoid under-fetching of required data/metadata.

  • You need to minimize over-fetching of data/metadata by selecting only specific resources, fields of the resources, and relationships of the resources.

  • You need to query data and metadata together efficiently. 

Use Zoho CRM REST APIs when :

  • You need to perform simple CRUD operations (e.g., fetch/update a single product).

  • Your use case involves straightforward endpoints without nested data/metadata.

  • You need to do add/update/delete operations.

We trust that this post addressed your doubts on GraphQL APIs. If you have any questions please let us know in the comment section or reach out to us at support@zohocrm.com.

    • Sticky Posts

    • Kaizen #197: Frequently Asked Questions on GraphQL APIs

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Kaizen #198: Using Client Script for Custom Validation in Blueprint

      Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Celebrating 200 posts of Kaizen! Share your ideas for the milestone post

      Hello Developers, We launched the Kaizen series in 2019 to share helpful content to support your Zoho CRM development journey. Staying true to its spirit—Kaizen Series: Continuous Improvement for Developer Experience—we've shared everything from FAQs
    • Kaizen #193: Creating different fields in Zoho CRM through API

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Client Script | Update - Introducing Commands in Client Script!

      Have you ever wished you could trigger Client Script from contexts other than just the supported pages and events? Have you ever wanted to leverage the advantage of Client Script at your finger tip? Discover the power of Client Script - Commands! Commands
    • Recent Topics

    • Need to extract date from datetime field

      I have a datetime field and need only the date part from it. I am unable to find a built-in function that would be <DateTime>.Date(). I don't think I want to go the string conversion route of converting the datetime to string and then parsing out values and create a date out of it. Any one out there has a better solution to this? Thanks in adavnce. Regards Moiz Tankiwala Smart Training & IT Solutions
    • 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?
    • Transition Criteria Appearing on Blueprint Transitions

      On Monday, Sept. 8th, the Transition criteria started appearing on our Blueprints when users hover over a Transition button. See image. We contacted Zoho support because it's confusing our users (there's really no reason for them to see it), but we haven't
    • Delegates should be able to delete expenses

      I understand the data integrity of this request. It would be nice if there was a toggle switch in the Policy setting that would allow a delegate to delete expenses from their managers account. Some managers here never touch their expense reports, and
    • Add Save button to Expense form

      A save button would be very helpful on the expense form. Currently there is a Save and Close button. When we want to itemize an expense, this option would be very helpful. For example, if we have a hotel expense that also has room service, which is a
    • Using Zoho Desk to support ISMS process

      Hi, I am evaluating using Zoho Desk for security incident management. This seems to be aligned with Zoho Desk purpose as its just another type of incident. However in security incident management, ideally I can link incidents (tickets) with a risk from
    • Regarding the integration of Apollo.io with Zoho crm.

      I have been seeing for the last 3 months that your Apollo.io beta version is available in Zoho Flow, and this application has not gone live yet. We requested this 2 months ago, but you guys said that 'we are working on it,' and when we search on Google
    • Open filtered deals from campaign

      Do you think a feature like this would be feasible? Say you are seeing campaign "XYZ" in CRM. The campaign has a related list of deals. If you want to see the related deals in a deal view, you should navigate to the Deals module, open the campaign filter,
    • MTD SA in the UK

      Hello ID 20106048857 The Inland Revenue have confirmed that this tax account is registered as Cash Basis In Settings>Profile I have set ‘Report Basis’ as “Cash" However, I see on Zoho on Settings>Taxes>Income Tax that the ‘Tax Basis’ is marked ‘Accrual'
    • Limiting search or dependencies with an asterisk "*".

      I have a form with several dependency fields with options still developing for each field. Since these options were developing and not yet ready to be a selection in the field, I placed a filter for the dropdown field. In this filter, I selected fields
    • workflow not working in subform

      I have the following code in a subform which works perfectly when i use the form alone but when i use the form as a subform within another main form it does not work. I have read something about using row but i just cant seem to figure out what to change
    • Fetch data from another table into a form field

      I have spent the day trying to work this out so i thought i would use the forum for the first time. I have two forms in the same application and when a user selects a customer name from a drop down field and would like the customer number field in the
    • Zoho Creator as LMS and Membership Solution

      My client is interested in using Zoho One apps to deploy their membership academy offer. Zoho Creator was an option that came up in my research: Here are the components of the program/offer: 1. Membership portal - individual login credentials for each
    • Zoho FSM API Delete Record

      Hi FSM Team, It would be great if you could delete a record via API. Thank you,
    • Record comment filter

      Hi - I have a calendar app that we use to track tasks. I have the calendar view set up so that the logged in user only sees the record if they are assigned to the task. BUT there are instances when someone is @ mentioned in the record when they are not
    • Group Tax in Service Line Items

      Hi FSM Team! I noticed that when you update a tax in the service line item the group tax is not showing up as an option. Let me know what can be done thank you!
    • How to View Part Inventory and Warehouse Location When Creating a Work Order in Zoho FSM

      Hi everyone, We’re currently setting up Zoho FSM and would like to improve how our team selects parts when creating a Work Order. Right now, when we add a part or item to a Work Order, we can select it from our Zoho Inventory list but we don’t see any
    • FSM too slow today !!

      Anybody else with problem today to loading FSM (WO, AP etc.)?
    • CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive

      Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
    • Not able to Sign In in Zoho OneAuth in Windows 10

      I recently reset my Windows 10 system, after the reset when I downloaded the OAuth app and tried to Sign In It threw an error at me. Error: Token Fetch Error. Message: Object Reference not set to an instance of an object I have attached the screenshot
    • Mapping a custom preferred date field in the estimate with the native field in the workorder

      Hi Zoho, I created a field in the estimate : "Preferred Date 1", to give the ability to my support agent to add a preferred date while viewing the client's estimate. However, in the conversion mapping (Estimate to Workorder), I'm unable to map my custom
    • Runing RPA Agents on Headless Windows 11 Machines

      Has anyone tried this? Anything to be aware of regarding screen resolution?
    • Sync Contacts in iOS

      What does the "Sync Contacts" feature in the iOS Zoho Mail app do?
    • The sending IP (136.143.188.15) is listed on spamrl.com as a source of spam.

      Hi, it just two day when i am using zoho mail for my business domain, today i was sending email and found that message "The sending IP (136.143.188.15) is listed on https://spamrl.com as a source of spam" I hope to know how this will affect the delivery
    • Delegates - Access to approved reports

      We realized that delegates do not have access to reports after they are approved. Many users ask questions of their delegates about past expense reports and the delegates can't see this information. Please allow delegates see all expense report activity,
    • Split functionality - Admins need ability to do this

      Admins should be able to split an expense at any point of the process prior to approval. The split is very helpful for our account coding, but to have to go back to a user and ask them to split an invoice that they simply want paid is a bit of an in
    • What is a a valid JavaScript Domain URI when creating a client-based application using the Zoho API console?

      No idea what this is. Can't see what it is explained anywhere.
    • Feature Request: Ability to Set a Custom List View as Default for All Users

      Dear Zoho CRM Support Team, We would like to request a new feature in Zoho CRM regarding List Views. Currently, each user has to manually select or favorite a custom list view in order to make it their default. However, as administrators, we would like
    • Is there a way to request a password?

      We add customers info into the vaults and I wanted to see if we could do some sort of "file request" like how dropbox offers with files. It would be awesome if a customer could go to a link and input a "title, username, password, url" all securely and it then shows up in our team vault or something. Not sure if that is safe, but it's the best I can think of to be semi scalable and obviously better than sending emails. I am open to another idea, just thought this would be a great feature.  Thanks,
    • How can I see content of system generated mails from zBooks?

      System generated mails for offers or invices appear in the mail tab of the designated customer. How can I view the content? It also doesn't appear in zMail sent folder.
    • Single Task Report

      I'd like a report or a way to print to PDF the task detail page. I'd like at least the Task Information section but I'd also like to see the Activity Stream, Status Timeline and Comments. I'd like to export the record and save it as a PDF. I'd like the
    • Auto-response for closed tickets

      Hi, We sometimes have users that (presumably) search their email inbox for the last correspondence with us and just hit reply - even if it's a 6 month old ticket... - this then re-opens the 6 month old ticket because of the ticket number in the email's subject. Yes, it's easy to 'Split as new Ticket', but I'd like something automated to respond to the user saying "this ticket has already been resolved and closed, please submit a new ticket". What's the best way to achieve this? Thanks, Ed
    • How to Push Zoho Desk time logged to Zoho Projects?

      I am on the last leg of my journey of finally automating time tracking, payments, and invoicing for my minutes based contact center company - I just have one final step to solve - I need time logged in zoho desk to add time a project which is associated
    • Cannot access KB within Help Center

      Im working with my boss to customize our knowledge base, but for some reason I can see the KB tab, and see the KB categories, but I cannot access the articles within the KB. We have been troubleshooting for weeks, and we have all permissions set up, customers
    • Export to excel stored amounts as text instead of numbers or accounting

      Good Afternoon, We have a quarterly billing report that we generate from our Requests. It exports to excel. However if we need to add a formula (something as simple as a sum of the column), it doesn't read the dollar amounts because the export stores
    • why my account is private?

      when i post on zohodesk see only agent only
    • Field Dependency Not Working on Detail Page in Zoho Desk

      Hi Support Team, I’ve created field dependencies between two fields in Zoho Desk, and they are working correctly on the Create and Edit layouts. However, on the Detail page, the fields are not displaying according to the dependencies I’ve set — they appear
    • Getting ZOHO Invoice certified in Portugal?

      Hello, We are ZOHO partners in Portugal and here, all the invoice software has to be certified by the government and ZOHO Invoice still isn´t certified. Any plans? Btw, we can help on this process, since we have a client that knows how to get the software certified. Thank you.
    • Show/ hide specific field based on user

      Can someone please help me with a client script to achieve the following? I've already tried a couple of different scripts I've found on here (updating to match my details etc...) but none of them seem to work. No errors flagged in the codes, it just
    • Why I am unable to configure Zoho Voice with my Zoho CRM account?

      I have installed Zoho Voice in my Zoho CRM, but as per the message there is some config needed in Zoho Voice interface. But when I click on the link given in the above message, I get an access denied page.
    • Next Page