Each query hitting our Content Delivery API has a complexity score based on which type of field and how many fields are present in it.
Root fields related to your models have a complexity score of 80
.
query {allArtists { # 80idname}}
Also root fields like _allArtistsMeta
and artist
have a complexity score of 80
too.
The following query has a complexity score of 162
.
query {_allArtistsMeta { # 80count # 1}artist(filter: {id: {eq: "10"}}) { # 80name # 1}}
Each model subfield has a complexity of 1
, apart from file, gallery, link, links and modular content fields which have a complexity of 10
.
The following query has a complexity score of 91
.
query {allArtists { # 80photo { # 10 (file field)url # 1}}
Root fields about uploads, _allUploadsMeta
and upload
, have a complexity score of 25
both.
The following query has a complexity score of 52
.
query {_allUploadsMeta { # 25count # 1}upload(filter: {id: {eq: "564"}}) { # 25url # 1}}
Root fields about single-instance records have a complexity score of 25
.
The following query has a complexity score of 27
.
query {contactPage { # 25phoneNumber # 1emailAddress # 1}}
Root field _site
has a complexity score of 10
.
The following query has a complexity score of 13
.
query {_site { # 10globalSeo { # 1siteName # 1titleSuffix # 1}}}
Inverse relationship queries have a complexity score of 500
.
The following query has a complexity score of 1082
.
query {allAuthors { # 80_allReferencingBlogPosts { # 500title # 1}_allReferencingBlogPostsMeta { # 500count # 1}}}
The Content Delivery API sets the x-complexity
header in the response to let you know the calculated complexity score for your submitted query.
If the query complexity score is over 1200, you'll get an error from the Content Delivery API:
{"errors": [{"message": "Query has complexity of 1276, which exceeds max complexity of 1200"}]}
Higher complexity score limit may apply to your project. Take a look at the "Plan and usage" section of your project in the Account dashboard.