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
Copied
Examples for calculating credits and complexity
1. Querying Users
Copied
Show full
Show less
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
Copied
Total Credits: 1+.5 = ceil(1.5) = 2 credits
Total Complexity: 100 + 50 = 150
3. Querying Parent and Child Relationships (Subforms)
Copied
Show full
Show less
Total Credits: 1+0.5 +.25= ceil(1.75) = 2 Credits
Total Complexity: 100 + 50 + 25 = 175
4. Multiple resources nested query
Copied
Show full
Show less
Total Credits :1+1+1+1+0.5 = ceil(4.5) = 5
Total Complexity: 100 + 100 + 100 + 100 + 50 = 450