Credits, Complexity, and Depth
API Credits
As in Zoho CRM Rest APIs, Zoho CRM GraphQL API calls are also associated with credits. A single GraphQL API call can consume up to 10 credits based on the type of resources queried.
When making requests, each resource consumes a specific amount of credits, ranging from 0.25 to 1. These credits are aggregated to determine the total consumption and rounded up to the nearest integer. If the total exceeds 10, an error will be thrown.
Query Complexity
Query Complexity refers to the workload a query exerts on servers. It increases based on the number of fields and depth of the query. To ensure proper server performance, complexity is capped to 1000 per GraphQL query. If a query exceeds this complexity, ExecutionAborted error will be thrown.
Root-level query refers to the top-level query that serves as the entry point for fetching data from the GraphQL API. Sub-level query refers to nested resources inside a resource.
The calculation for query complexity is done based on the below factors.
| Root level query | 100 points for each resource | 
| Sub query | 25 points for each Parent lookup (Lookup fields, User lookup fields etc). | 
| 50 points for each Child relation (Subform data). | |
| 50 points for each Multi Module lookup (what_Id, Appointments_For). | 
Credit and Complexity consumed by different resources in _Meta
| Resource | Credits | Complexity | 
|---|---|---|
| ChildRelation | .5 | 50 | 
| ChildRelations | 1 | 100 | 
| CustomView | 0.5 | 50 | 
| CustomViews | 1 | 100 | 
| Field | 0.5 | 50 | 
| Fields | 1 | 100 | 
| KanbanView | 1 | 100 | 
| Layout | 1 | 100 | 
| Layouts | 1 | 100 | 
| LayoutFields | 1 | 100 | 
| Module | 0.5 | 50 | 
| Modules | 1 | 100 | 
| Profile | 0.5 | 50 | 
| ProfileModuleProperties | 1 | 100 | 
| ProfilePermissions | 1 | 100 | 
| Profiles | 1 | 100 | 
| RelatedList | 0.5 | 50 | 
| RelatedLists | 1 | 100 | 
| Role | .5 | 50 | 
| Roles | 1 | 100 | 
| User(Except Created_By, Modified_By fields) | 0.5 | 50 | 
| UserProperties | 1 | 100 | 
| Users | 1 | 100 | 
| Widgets | 1 | 100 | 
Credit and Complexity consumed by different resources in _Records
| Resource | Credits | Complexity | 
|---|---|---|
| Child Relations(eg: Subforms) | .5 | 50 | 
| Multi Module Lookups(eg: what_Id, Appointments_For) | .5 | 50 | 
| Parent relations(eg: Lookup fields) | .25 | 25 | 
| User lookups (eg: Created_By, Modified_By) | .25 | 25 | 
Note
Multi-select lookups data has to be queried through the corresponding linking module.
Query Depth
Query Depth refers to the number of nesting levels of a field that is queried. In order to limit server load, in Zoho CRM, query depth is limited to seven for metadata and three for records. LIMIT_EXCEEDED error will be thrown if query depth exceeds allowed value.
Calculating depth
To calculate depth in a query, count the number of nesting levels of the query excluding the nesting levels of "query","Records", "Meta", "_data" and "{value}" of a field (leaf node).
Example for calculating depth
Copiedquery  { # not considered for depth
    Records {# not considered for depth
        Leads { # depth 1
            _data {# not considered for depth
                Converted_Deal { # depth 2
                    Account_Name { #depth 3
                        Owner { #depth 4
                            last_name { # not considered for depth
                                value
                            }
                        }
                    }
                }
            }
        }
    }
}
Examples for calculating credits and complexity
1. Querying Users
Copiedquery  {
    Meta {
        Users {                                               # 1 credit,100 complexity
            _data {
                id
                Reporting_To {                           # .5 credit,50 complexity
                    id
                    last_name
                }
                role {                                          # .5 credit,50 complexity
                    id
                    name
                    description
                }
                profile {                                      # .5 credit,50 complexity
                    id
                    name
                    description
                }
            }
        }
    }
}Total Credits: 1 + 0.5 + 0.5 + 0.5 =ceil(2.5) = 3 credits.
Total Complexity: 100 + 50 + 50 + 50 = 250
2. Querying what_Id
Copiedquery {
    Records {
        Tasks {                                                #1 credit,100 complexity
            _data {
                What_Id {                                     #.5 credit,50 complexity
                    id {
                        value
                    }
                }
                id {
                    value
                }
            }
        }
    }
}Total Credits: 1+.5 = ceil(1.5) = 2 credits
Total Complexity: 100 + 50 = 150
3. Querying Parent and Child Relationships (Subforms)
Copiedquery {
    Records {                                               #1 Credit,100 complexity
        Leads {
            _data {
                id {
                    value
                }
                Subform_1__r {                           #.5 Credits,50 complexity
                    _data {
                        id {
                            value
                        }
                    }
                }
                Converted_Deal {                       #.25 Credits,25 complexity
                    id {
                        value
                    }
                }
            }
        }
    }
}Total Credits: 1+0.5 +.25= ceil(1.75) = 2 Credits
Total Complexity: 100 + 50 + 25 = 175
4. Multiple resources nested query
Copiedquery {
    Meta {
        Modules(filter: { api_name: "Leads" }) {        # 1 credit,100 complexity
            _data {
                id
                api_name
                module_name
                singular_label
                api_supported
                status
                fields {                                            # 1 credit,100 complexity
                    _data {
                        id
                        api_name
                        ui_type
                        data_type
                        json_type
                        visible
                    }
                }
                custom_view(filter: { api_name: "Todays_Leads" }) {   # 1 credit,100 complexity
                    _data {
                        id
                        api_name
                        display_value
                        name
                        system_defined
                    }
                }
            }
        }
        Roles {                                      # 1 credit,100 complexity
            _data {
                id
                display_label
                api_name
                name
                reporting_to {            # 0.5 credit,50 complexity
                    id
                    display_label
                    api_name
                    name
                }
            }
        }
    }
}Total Credits :1+1+1+1+0.5 = ceil(4.5) = 5
Total Complexity: 100 + 100 + 100 + 100 + 50 = 450