Learn how to query the complexity of an API call using the monday.com platform API

Query complexity defines the cost of each operation you make. Each API token is allotted a fixed complexity limit for a given period to help manage the load placed on the API. The complexity endpoint can be included in any API request to return the cost of that specific query or mutation.

Queries

  • Returns a JSON object containing the complexity cost of your queries
  • Can only be queried directly at the root
query {
  complexity {
    before
    query
    after
    reset_in_x_seconds
  }
  boards (ids: 1234567890) {
    items {
      id
      name
    }
  }
}
mutation {
  complexity {
    query
    before
    after
  }
  create_item(board_id:1234567890, item_name:"test item") {
    id
  }
}
let query = "query { complexity { before query after reset_in_x_seconds } boards (ids: 1234567890) { id	name } } }";
let mutation = "mutation { complexity { query before after } create_item(board_id: 1234567890, item_name: \"test\") { id }}";

fetch ("https://api.monday.com/v2", {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY_HERE'
   },
   body: JSON.stringify({
     query : query
   })
  })
   .then(res => res.json())
   .then(res => console.log(JSON.stringify(res, null, 2)));


fetch ("https://api.monday.com/v2", {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY_HERE'
   },
   body: JSON.stringify({
     query : mutation
   })
  })
   .then(res => res.json())
   .then(res => console.log(JSON.stringify(res, null, 2)));
let mutation = "mutation { complexity { query before after } create_item(board_id: 1234567890, item_name: \"test\") { id }}";

fetch ("https://api.monday.com/v2", {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY_HERE'
   },
   body: JSON.stringify({
     query : mutation
   })
  })
   .then(res => res.json())
   .then(res => console.log(JSON.stringify(res, null, 2)));

Fields

You can use the following field(s) to specify what information your complexity query will return.

FieldDescription
after Int!The remaining complexity after the query's execution.
before Int!The remaining complexity before the query's execution.
query Int!This specific query's complexity.
reset_in_x_seconds Int!The length of time (in seconds) before the complexity budget resets.